Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
To automate cacti host and graphs creation, I've written a patch for the cli/add_graphs.php script.
With this patch you can now use the --snmp-field and --snmp-value multiple times for ds graphs creation.
For example, you can create graphs for a host with only interfaces with ifType=ethernetCsmacd and ifOperStatus=Up.
You can also uise the --snmp-value-regex instead of the --snmp-value option.
This is usefull if you want to create all interfaces like 'Port-channel'
Example :
gandalf wrote:Personally, I'd like to advertise the AUTOM8 plugin which already supports such a feature
Yes similar feature can be achieved with autom8 but sometimes it is more appropriate to use the cli scripts to perform some tasks. Such enhancement could then be useful anyway.
I could not figure out how to do multiple regex maybe it is due to it being 1am. /shrug
I was trying to look for Gi or PO in the ifDescr AND GMPLS in ifAlias
meaning
any Gigabit and POS interface with GMPLS
[cactiuser@ossccacti01 cli]$ ./add_graphs.php --graph-type=ds --graph-template-id=281 --host-id=2117 --snmp-query-id=1 --snmp-query-type-id=13 --snmp-field=ifDescr --snmp-value-regex='^Gi|PO^' --snmp-field=ifAlias --snmp-value-regex='GMPLS'
ERROR: Could not find snmp-field ifDescr,ifAlias (^Gi|PO^GMPLS) for host-id 2117 (10.13.250.33)
Try --host-id=2117 --list-snmp-fields
or even
./add_graphs.php --graph-type=ds --graph-template-id=281 --host-id=2117 --snmp-query-id=1 --snmp-query-type-id=13 --snmp-field=ifDescr --snmp-value-regex='Gi|PO' --snmp-field=ifAlias --snmp-value-regex='GMPLS'
But no go I must have been using it wrong.
I can't load Automat8 yet on this system due to it being so heavily used.
This did work
[cactiuser@ossccacti01 cli]$ ./add_graphs.php --graph-type=ds --graph-template-id=281 --host-id=1307 --snmp-query-id=1 --snmp-query-type-id=13 --snmp-field=ifDescr --snmp-value-regex='Gi' --snmp-field=ifAlias --snmp-value-regex='GMPLS'
But I just went back to using the following so I got any interface with GMPLS in the description
[cactiuser@ossccacti01 cli]$ ./add_graphs.php --graph-type=ds --graph-template-id=281 --host-id=1307 --snmp-query-id=1 --snmp-query-type-id=13 --snmp-field=ifAlias --snmp-value-regex='GMPLS'
But I just went back to using the following so I got any interface with GMPLS in the description
[cactiuser@ossccacti01 cli]$ ./add_graphs.php --graph-type=ds --graph-template-id=281 --host-id=1307 --snmp-query-id=1 --snmp-query-type-id=13 --snmp-field=ifAlias --snmp-value-regex='GMPLS'
Yeah, cou can only pass the --snmp-field and --snmp-value-regex and one time !
I've received a private message about this patch, but can't read it "You are not authorised to read private messages."