mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Plugin nova_floating_ips: migrate to Python3, format documentation
This commit is contained in:
parent
db7403f2d4
commit
d168d49ee4
2 changed files with 47 additions and 30 deletions
|
@ -1,18 +1,36 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
#
|
"""
|
||||||
# Plugin to monitor status of Floating IPs in Nova
|
|
||||||
#
|
=head1 NAME
|
||||||
# To monitor a floating ips, link floating_ips to this file.
|
|
||||||
# E.g.
|
nova_floating_ips - monitor status of Floating IPs in Nova
|
||||||
# ln -s /usr/share/munin/plugins/nova_floating_ips /etc/munin/plugins/
|
|
||||||
#
|
|
||||||
# Needs following minimal configuration in plugin-conf.d/nova:
|
=head1 CONFIGURATION
|
||||||
# [nova_*]
|
|
||||||
# user nova
|
To monitor a floating ips, link floating_ips to this file.
|
||||||
#
|
E.g.
|
||||||
# Magic markers
|
|
||||||
#%# capabilities=autoconf
|
ln -s /usr/share/munin/plugins/nova_floating_ips /etc/munin/plugins/
|
||||||
#%# family=auto
|
|
||||||
|
Needs following minimal configuration in plugin-conf.d/nova:
|
||||||
|
|
||||||
|
[nova_*]
|
||||||
|
user nova
|
||||||
|
|
||||||
|
|
||||||
|
=head1 AUTHORS
|
||||||
|
|
||||||
|
Copyright 2012 Mehdi Abaakouk <sileht@sileht.net>
|
||||||
|
|
||||||
|
|
||||||
|
=head1 MAGIC MARKERS
|
||||||
|
|
||||||
|
#%# capabilities=autoconf
|
||||||
|
#%# family=auto
|
||||||
|
|
||||||
|
=cut
|
||||||
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -27,21 +45,21 @@ else:
|
||||||
successful_import = True
|
successful_import = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
states = ['total', 'allocated', 'associated']
|
states = ['total', 'allocated', 'associated']
|
||||||
|
|
||||||
|
|
||||||
def print_config():
|
def print_config():
|
||||||
global states
|
global states
|
||||||
print 'graph_title Nova Floating IPs'
|
print('graph_title Nova Floating IPs')
|
||||||
print 'graph_vlabel IPs'
|
print('graph_vlabel IPs')
|
||||||
print 'graph_args --base 1000 --lower-limit 0'
|
print('graph_args --base 1000 --lower-limit 0')
|
||||||
print 'graph_category cloud'
|
print('graph_category cloud')
|
||||||
print 'graph_scale no'
|
print('graph_scale no')
|
||||||
print 'graph_info This graph shows the number of Floating IPs in Nova and their status'
|
print('graph_info This graph shows the number of Floating IPs in Nova and their status')
|
||||||
for state in states:
|
for state in states:
|
||||||
print '%s.label %s' % (state, state)
|
print('%s.label %s' % (state, state))
|
||||||
print '%s.draw LINE2' % state
|
print('%s.draw LINE2' % state)
|
||||||
print '%s.info %s IPs' % (state, state)
|
print('%s.info %s IPs' % (state, state))
|
||||||
|
|
||||||
|
|
||||||
def get_status():
|
def get_status():
|
||||||
|
@ -63,8 +81,8 @@ def get_status():
|
||||||
|
|
||||||
def print_values():
|
def print_values():
|
||||||
status = get_status()
|
status = get_status()
|
||||||
for (state, value) in status.iteritems():
|
for (state, value) in status.items():
|
||||||
print "%s.value %s" % (state, value)
|
print("%s.value %s" % (state, value))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -73,10 +91,10 @@ if __name__ == '__main__':
|
||||||
print_config()
|
print_config()
|
||||||
elif sys.argv[1] == "autoconf":
|
elif sys.argv[1] == "autoconf":
|
||||||
if not successful_import:
|
if not successful_import:
|
||||||
print 'no (failed import nova module)'
|
print('no (failed import nova module)')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
print 'yes'
|
print('yes')
|
||||||
elif successful_import:
|
elif successful_import:
|
||||||
utils.default_flagfile()
|
utils.default_flagfile()
|
||||||
flags.FLAGS(sys.argv)
|
flags.FLAGS(sys.argv)
|
||||||
|
|
|
@ -270,7 +270,6 @@ plugins/nginx/nginx-cache-multi_
|
||||||
plugins/nginx/nginx_upstream
|
plugins/nginx/nginx_upstream
|
||||||
plugins/nginx/nginx_vhost_traffic
|
plugins/nginx/nginx_vhost_traffic
|
||||||
plugins/nginx/nginx_working_set
|
plugins/nginx/nginx_working_set
|
||||||
plugins/nova/nova_floating_ips
|
|
||||||
plugins/nova/nova_instance_
|
plugins/nova/nova_instance_
|
||||||
plugins/nova/nova_instance_launched
|
plugins/nova/nova_instance_launched
|
||||||
plugins/nova/nova_instance_timing
|
plugins/nova/nova_instance_timing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue