add_graph.php -> more than one snmp-field and regexp
Moderators: Developers, Moderators
add_graph.php -> more than one snmp-field and regexp
Hi,
I use cacti in a large deployment (~3500 devices, 75k graphs).
I've customized some cacti code to add each night a graph for the new interfaces that come up (--snmp-field=ifOperStatus --snmp-value=Up).
My problem is with that I add lot (50k!!!) of not wanted interfaces (vlan, subinterface, console etc), that I need to delete with another script.
Is it possible to add the possibility to do a regexp to the "ifType" or "ifAlias" so I can add only ethernet or gigabitethernet interface?
Thus the string to add graph will be like this :
add_graphs.php --host-id=2713 --graph-type=ds --graph-template-id=2 --snmp-query-id=1 --snmp-query-type-id=13 --snmp-field=ifOperStatus --snmp-value=Up --snmp-field_regexp=ifType --snmp-value_regexp=ethernet
I think this feature will be very useful for large deployment.
Best regards,
Vince
I use cacti in a large deployment (~3500 devices, 75k graphs).
I've customized some cacti code to add each night a graph for the new interfaces that come up (--snmp-field=ifOperStatus --snmp-value=Up).
My problem is with that I add lot (50k!!!) of not wanted interfaces (vlan, subinterface, console etc), that I need to delete with another script.
Is it possible to add the possibility to do a regexp to the "ifType" or "ifAlias" so I can add only ethernet or gigabitethernet interface?
Thus the string to add graph will be like this :
add_graphs.php --host-id=2713 --graph-type=ds --graph-template-id=2 --snmp-query-id=1 --snmp-query-type-id=13 --snmp-field=ifOperStatus --snmp-value=Up --snmp-field_regexp=ifType --snmp-value_regexp=ethernet
I think this feature will be very useful for large deployment.
Best regards,
Vince
I've coded this feature now!
http://bugs.cacti.net/view.php?id=1396
I've code a first draft (an update of add_graphs.php). I'm a network guy, not a core programmer thus be indulgent
I've tested this script on my cacti lab creating ~18k graphs on around 880 devices without issue.
I hope this feature will interest you.
Best regards,
Vincent Kilchoer aka Big Vi
Exemple : with this line I can create graphs for all up interface with Iftype containing "ethernet" for host-id 2713 :
http://bugs.cacti.net/view.php?id=1396
I've code a first draft (an update of add_graphs.php). I'm a network guy, not a core programmer thus be indulgent
I've tested this script on my cacti lab creating ~18k graphs on around 880 devices without issue.
I hope this feature will interest you.
Best regards,
Vincent Kilchoer aka Big Vi
Exemple : with this line I can create graphs for all up interface with Iftype containing "ethernet" for host-id 2713 :
Code: Select all
add_graphs.php --host-id=2713 --graph-type=ds --graph-template-id=2 --snmp-query-id=1 --snmp-query-type-id=13 --snmp-field=ifOperStatus --snmp-value=Up --snmp-field_regexp=ifType --snmp-value_regexp=ethernet
- TheWitness
- Developer
- Posts: 17059
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Contributions, what a beautiful thing...
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
- TheWitness
- Developer
- Posts: 17059
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Did you open a feature request in Mantis?
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Hello,
I used the following command to add "interface-Unicast Packets" template to each interface on a device
php add_graphs.php --host-id=365 --graph-type=ds --graph-template-id=23 --snmp-query-id=1 --snmp-query-type-id=13 --snmp-field=ifOperStatus --snmp-value=Up
The following output is obtained
Graph Added - graph-id: (21999) - data-source-ids: (22914, 22914)
Graph Added - graph-id: (22000) - data-source-ids: (22915, 22915)
Graph Added - graph-id: (22001) - data-source-ids: (22916, 22916)
Graph Added - graph-id: (22002) - data-source-ids: (22917, 22917)
Graph Added - graph-id: (22003) - data-source-ids: (22918, 22918)
Graph Added - graph-id: (22004) - data-source-ids: (22919, 22919)
Graph Added - graph-id: (22005) - data-source-ids: (22920, 22920)
Graph Added - graph-id: (22006) - data-source-ids: (22921, 22921)
Graph Added - graph-id: (22007) - data-source-ids: (22922, 22922)
Graph Added - graph-id: (22008) - data-source-ids: (22923, 22923)
Graph Added - graph-id: (22009) - data-source-ids: (22924, 22924)
But the problem is that there is interfaces are not being graphed, as show in the image below..
by turning on the Graph debug mode for one of the interface the following error is shown
RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="cranberry - Traffic - ebr3" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="packets/sec" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/www/cacti/rra/cranberry_unicast_in_22919.rrd":unicast_in:AVERAGE \
DEF:b="/var/www/cacti/rra/cranberry_unicast_in_22919.rrd":unicast_out:AVERAGE \
AREA:a#FFF200FF:"Unicast Packets In" \
GPRINTLAST:" Current\:%8.2lf%s" \
GPRINTAVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n" \
LINE1:b#00234BFF:"Unicast Packets Out" \
GPRINTLAST:"Current\:%8.2lf%s" \
GPRINTAVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n"
RRDTool Says:
ERROR: opening '/var/www/cacti/rra/cranberry_unicast_in_22919.rrd': No such file or directory
I dont understand what i am doing wrong...
Can anyone please help??
Thanks..
I used the following command to add "interface-Unicast Packets" template to each interface on a device
php add_graphs.php --host-id=365 --graph-type=ds --graph-template-id=23 --snmp-query-id=1 --snmp-query-type-id=13 --snmp-field=ifOperStatus --snmp-value=Up
The following output is obtained
Graph Added - graph-id: (21999) - data-source-ids: (22914, 22914)
Graph Added - graph-id: (22000) - data-source-ids: (22915, 22915)
Graph Added - graph-id: (22001) - data-source-ids: (22916, 22916)
Graph Added - graph-id: (22002) - data-source-ids: (22917, 22917)
Graph Added - graph-id: (22003) - data-source-ids: (22918, 22918)
Graph Added - graph-id: (22004) - data-source-ids: (22919, 22919)
Graph Added - graph-id: (22005) - data-source-ids: (22920, 22920)
Graph Added - graph-id: (22006) - data-source-ids: (22921, 22921)
Graph Added - graph-id: (22007) - data-source-ids: (22922, 22922)
Graph Added - graph-id: (22008) - data-source-ids: (22923, 22923)
Graph Added - graph-id: (22009) - data-source-ids: (22924, 22924)
But the problem is that there is interfaces are not being graphed, as show in the image below..
by turning on the Graph debug mode for one of the interface the following error is shown
RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="cranberry - Traffic - ebr3" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="packets/sec" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/www/cacti/rra/cranberry_unicast_in_22919.rrd":unicast_in:AVERAGE \
DEF:b="/var/www/cacti/rra/cranberry_unicast_in_22919.rrd":unicast_out:AVERAGE \
AREA:a#FFF200FF:"Unicast Packets In" \
GPRINTLAST:" Current\:%8.2lf%s" \
GPRINTAVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n" \
LINE1:b#00234BFF:"Unicast Packets Out" \
GPRINTLAST:"Current\:%8.2lf%s" \
GPRINTAVERAGE:"Average\:%8.2lf%s" \
GPRINTMAX:"Maximum\:%8.2lf%s\n"
RRDTool Says:
ERROR: opening '/var/www/cacti/rra/cranberry_unicast_in_22919.rrd': No such file or directory
I dont understand what i am doing wrong...
Can anyone please help??
Thanks..
- Attachments
-
- image1.gif (19.08 KiB) Viewed 22565 times
Cacti Version - 0.8.7d
Plugin Architecture - 2.4
RRDTool Version - RRDTool 1.2
Plugins - discovery, autom8, tools
Plugin Architecture - 2.4
RRDTool Version - RRDTool 1.2
Plugins - discovery, autom8, tools
The plugin looks very useful..
But i am having trouble downloading it onto my remote machine..
I tried searching but was unable to find much information on the cacti
forums about this plugin..
Can you please tell me the direct link i can used to download it straight to the machine..
Using
wget http://www.........
Thanks again
But i am having trouble downloading it onto my remote machine..
I tried searching but was unable to find much information on the cacti
forums about this plugin..
Can you please tell me the direct link i can used to download it straight to the machine..
Using
wget http://www.........
Thanks again
Cacti Version - 0.8.7d
Plugin Architecture - 2.4
RRDTool Version - RRDTool 1.2
Plugins - discovery, autom8, tools
Plugin Architecture - 2.4
RRDTool Version - RRDTool 1.2
Plugins - discovery, autom8, tools
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Please select the link given in my very first post at that thread.tilli wrote:The plugin looks very useful..
But i am having trouble downloading it onto my remote machine..
I tried searching but was unable to find much information on the cacti
forums about this plugin..
Can you please tell me the direct link i can used to download it straight to the machine..
Using
wget http://www.........
Thanks again
It will take you to the official plugin repository, wre you will find everything, including documentation. And there you'll find the download file as well.
Reinhard
Thanks for that,
i have another issue, when i run
patch -p1 -N --dry-run < plugins/autom8/cli.patch
the following error is obtained
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Nabur cacti-0.8.7d/cli/add_graph_template.php plugin087d/cli/add_graph_template.php
|--- cacti-0.8.7d/cli/add_graph_template.php 2009-02-12 03:55:46.000000000 +0100
|+++ plugin087d/cli/add_graph_template.php 2009-05-17 13:49:03.000000000 +0200
--------------------------
File to patch:
I am not sure what this error is or how to go about fixing it.
Also do you think it will be wise for me to make a backup of the current working piece of cacti just in case i cannot configure this plugin properly, to avoid loosing what i have working already.
thanks
i have another issue, when i run
patch -p1 -N --dry-run < plugins/autom8/cli.patch
the following error is obtained
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Nabur cacti-0.8.7d/cli/add_graph_template.php plugin087d/cli/add_graph_template.php
|--- cacti-0.8.7d/cli/add_graph_template.php 2009-02-12 03:55:46.000000000 +0100
|+++ plugin087d/cli/add_graph_template.php 2009-05-17 13:49:03.000000000 +0200
--------------------------
File to patch:
I am not sure what this error is or how to go about fixing it.
Also do you think it will be wise for me to make a backup of the current working piece of cacti just in case i cannot configure this plugin properly, to avoid loosing what i have working already.
thanks
Cacti Version - 0.8.7d
Plugin Architecture - 2.4
RRDTool Version - RRDTool 1.2
Plugins - discovery, autom8, tools
Plugin Architecture - 2.4
RRDTool Version - RRDTool 1.2
Plugins - discovery, autom8, tools
Warning: session_start() [functi
Cacti Version - 0.8.7d
Plugin Architecture - 2.4
RRDTool Version - RRDTool 1.2
Plugins - discovery, autom8, tools
Plugin Architecture - 2.4
RRDTool Version - RRDTool 1.2
Plugins - discovery, autom8, tools
File not found?
I have the exact same problem. But i can't locate the cli/new_graph_template.php anywhere.I have Cacti 0.8.7b with autom8 0.3.
Who is online
Users browsing this forum: No registered users and 1 guest