--- a/bin/pvl.verkko-rrd-interfaces Sun Jan 27 22:05:23 2013 +0200
+++ b/bin/pvl.verkko-rrd-interfaces Mon Jan 28 19:39:36 2013 +0200
@@ -79,8 +79,17 @@
# possibly multiple tags..
for tag in parts :
- collectd_type = options.collectd_type + '-' + port
- collectd_rrd = os.path.join(options.collectd_rrd, collectd_host, collectd_plugin, collectd_type) + '.rrd'
+ if options.collectd_instance == 'type' :
+ type = options.collectd_type + '-' + port
+ else :
+ type = options.collectd_type
+
+ if options.collectd_instance == 'plugin' :
+ plugin = collectd_plugin + '-' + port
+ else :
+ plugin = collectd_plugin
+
+ collectd_rrd = os.path.join(options.collectd_rrd, collectd_host, plugin, type) + '.rrd'
if not os.path.exists(collectd_rrd) :
log.warn("%s: missing collectd rrd: %s", idx, collectd_rrd)
@@ -159,6 +168,12 @@
parser.add_option('--collectd-type', metavar='TYPE', default=COLLECTD_TYPE,
help="Collectd type to use: %default")
+ # interface is by plugin, snmp is by type...
+ parser.add_option('--collectd-instance-plugin', action='store_const', dest='collectd_instance', const='plugin',
+ help="Collectd by plugin instance")
+ parser.add_option('--collectd-instance-type', action='store_const', dest='collectd_instance', const='type',
+ help="Collectd by type instance")
+
# hostnames
parser.add_option('--reverse-host', action='store_true',
help="Flip host.domain -> domain.host (default)")
@@ -174,7 +189,8 @@
help="Scan symlinks, but do not update")
parser.set_defaults(
- reverse_host = True,
+ collectd_instance = 'type',
+ reverse_host = True,
)
# parse