mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 02:18:08 +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
77
plugins/nova/nova_services
Executable file
77
plugins/nova/nova_services
Executable file
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Plugin to report service status
|
||||
#
|
||||
# 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
|
||||
import sys
|
||||
|
||||
services = ['nova-compute', 'nova-volume', 'nova-scheduler', 'nova-vncproxy', 'nova-network', 'nova-cert', 'nova-console', 'nova-consoleauth']
|
||||
|
||||
|
||||
def print_config():
|
||||
global services
|
||||
print 'graph_title Nova Services'
|
||||
print 'graph_vlabel qty'
|
||||
print 'graph_args --base 1000 --lower-limit 0'
|
||||
print 'graph_category nova'
|
||||
print 'graph_scale no'
|
||||
print 'graph_info Nova services - alive and active'
|
||||
for service in services:
|
||||
print '%s_alive.label %s alive' % (service, service)
|
||||
print '%s_alive.draw LINE2' % service
|
||||
print '%s_alive.info seen in last 30 seconds' % service
|
||||
print '%s_active.label %s active' % (service, service)
|
||||
print '%s_active.draw LINE2' % service
|
||||
print '%s_active.info alive and enabled' % service
|
||||
|
||||
|
||||
def get_status():
|
||||
global services
|
||||
alive = {}
|
||||
active = {}
|
||||
for k in services:
|
||||
alive[k] = 0
|
||||
active[k] = 0
|
||||
|
||||
ctxt = context.get_admin_context()
|
||||
now = utils.utcnow()
|
||||
services = db.service_get_all(ctxt)
|
||||
for svc in services:
|
||||
delta = now - (svc['updated_at'] or svc['created_at'])
|
||||
if (delta.seconds <= 30):
|
||||
alive[svc['binary']] += 1
|
||||
if not svc['disabled']:
|
||||
active[svc['binary']] += 1
|
||||
|
||||
return {'alive': alive, 'active': active}
|
||||
|
||||
|
||||
def print_values():
|
||||
status = get_status()
|
||||
for (state, value) in status['alive'].iteritems():
|
||||
print "%s_alive.value %s" % (state, value)
|
||||
for (state, value) in status['active'].iteritems():
|
||||
print "%s_active.value %s" % (state, value)
|
||||
|
||||
|
||||
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