mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-09-18 16:48:44 +00:00
Add nova and keystone plugin for openstack essex
This commit is contained in:
parent
bda7b6ea64
commit
22fbe167af
6 changed files with 452 additions and 0 deletions
65
plugins/nova/nova_instance_timing
Executable file
65
plugins/nova/nova_instance_timing
Executable file
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Plugin to monitor trending of launch/schedule times for last 5 successful instances
|
||||
#
|
||||
# To monitor a floating ips, link floating_ips to this file.
|
||||
# E.g.
|
||||
# ln -s /usr/share/munin/plugins/nova_instance_timing /etc/munin/plugins/
|
||||
#
|
||||
# Needs following minimal configuration in plugin-conf.d/nova:
|
||||
# [nova_*]
|
||||
# user nova
|
||||
#
|
||||
# Magic markers
|
||||
#%# capabilities=autoconf
|
||||
#%# family=nova
|
||||
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova import flags
|
||||
from nova import utils
|
||||
from nova.db.sqlalchemy.session import get_session
|
||||
import sys
|
||||
|
||||
|
||||
def print_config():
|
||||
global states
|
||||
print 'graph_title Nova Launch Times'
|
||||
print 'graph_vlabel seconds'
|
||||
print 'graph_args --base 1000 --lower-limit 0'
|
||||
print 'graph_category nova'
|
||||
print 'graph_scale no'
|
||||
print 'graph_info This the average time for the last 5 schedulings/launchings'
|
||||
print 'schedule.label schedule time'
|
||||
print 'schedule.draw LINE2'
|
||||
print 'schedule.info average time for last 5 instance to be scheduled'
|
||||
print 'launch.label launch time'
|
||||
print 'launch.draw LINE2'
|
||||
print 'launch.info average time for last 5 instance to be launched after scheduling'
|
||||
|
||||
|
||||
def get_status():
|
||||
connection = get_session().connection()
|
||||
row = connection.execute("select AVG(TIME_TO_SEC(TIMEDIFF(scheduled_at, created_at))) from instances where scheduled_at is not null order by scheduled_at desc limit 5;").fetchall()[0]
|
||||
schedule = row[0]
|
||||
row = connection.execute("select AVG(TIME_TO_SEC(TIMEDIFF(launched_at, scheduled_at))) from instances where launched_at is not null order by launched_at desc limit 5;").fetchall()[0]
|
||||
launch = row[0]
|
||||
return (schedule, launch)
|
||||
|
||||
|
||||
def print_values():
|
||||
schedule, launch = get_status()
|
||||
print "schedule.value %s" % schedule
|
||||
print "launch.value %s" % launch
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "config":
|
||||
print_config()
|
||||
elif sys.argv[1] == "autoconf":
|
||||
print "yes"
|
||||
else:
|
||||
utils.default_flagfile()
|
||||
flags.FLAGS(sys.argv)
|
||||
print_values()
|
Loading…
Add table
Add a link
Reference in a new issue