Hi all. I am not a Guru, so maybe anyone can help me.
I have cacti working with 10 or 15 sites and works perfectly.
I made a new data input with a script to graph modems in use in a Cisco 2500.
#!/usr/bin/perl
#Get Modems usage Cisco 2xxx
$conn = `snmpwalk \"$ARGV[0]\" \"$ARGV[1]\" interfaces.ifTable.ifEntry.ifOperStatus | grep \"$ARG
V[2]\" | wc -l`;
chomp $conn;
print $conn;
When I look into the logs, i see:
09/19/2002 11:15 AM - CMD: /usr/bin/rrdtool update /var/www/adm2.lc-2.la.inter.net/html/cacti/rra/system_users_tunuya.rrd --template system_users_tunuya N:U
>>>>>> there is no value in N: just U
If I run the scripts manually:
[root@adm2 scripts]# perl cisco_usage.pl 200.xx.xx.xx community up
9[root@adm2 scripts]#
9 is the exact number of modems.
In another Case, with another script, it shows me the result:
09/19/2002 11:20 AM - CMD: /usr/bin/rrdtool update /var/www/adm2.lc-2.la.inter.net/html/cacti/rra/system_users_necoch.rrd --template system_users_Necoch N: 3
the extrange is that the value N: 3 don´t appear like all the rest, something like this, without any space N:3
and anyway there is no graphics at all
This is the script:
#!/usr/bin/perl
#gets modems usage for Total Controll Necochea
$cantidad=`snmpwalk -m 1.3.6.1.4.1.429.4.2.1.10.0 200.xx.xx.xx community|grep ptp |wc -l`;
print $cantidad;
Thanks for all the help, and sorry my english
gllenas.
No graphic with script.
Moderators: Developers, Moderators
One simplier option is to bypass the use of a perl script completely. I suggest creating a data input source with an input string like:
Then make sure to define 'ip', 'community' and 'grepstr' as inputs. Next define a single output that writes data to the RRD file.
Hopefully you'll have better luck using that method.
-Ian
Code: Select all
snmpwalk <ip> "<community>" interfaces.ifTable.ifEntry.ifOperStatus | grep "<grepstr>" | wc -l
Hopefully you'll have better luck using that method.
-Ian
Thank you, very much......but.....
Following your advice, i left the script and I made the data input. It works, shows the exact value. But anyway, does not even show nothing in the graphic, continues being empty. Maybe I am doing something wrong when i create the graphic, some detail that I ignore. I duplicated the system users graph, but is the same. Empty.
Thank you very much by the aid. The program is very good anyway.
It works.....
09/21/2002 3:30 AM - CMD: /usr/bin/rrdtool update /var/www/adm2.lc-2.la.inter.net/html/cacti/rra/system_users_tunuya.rrd --template system_users_tunuya N: 2
Any idea, thank you man.
Thank you very much by the aid. The program is very good anyway.
It works.....
09/21/2002 3:30 AM - CMD: /usr/bin/rrdtool update /var/www/adm2.lc-2.la.inter.net/html/cacti/rra/system_users_tunuya.rrd --template system_users_tunuya N: 2
Any idea, thank you man.
Taking a closer look at the log entry you pasted:
I saw a space before the '2' in the update statement. Checking further, I found that rrdtool will not enter the data because of this. I would modify your data input source to pipe your output to a command to strip the spaces. Modifying my previous command would work:
-Ian
Code: Select all
/usr/bin/rrdtool update /var/www/adm2.lc-2.la.inter.net/html/cacti/rra/system_users_tunuya.rrd --template system_users_tunuya N: 2
Code: Select all
snmpwalk <ip> "<community>" interfaces.ifTable.ifEntry.ifOperStatus | grep "<grepstr>" | wc -l | sed 's/ //g'
About the sentence..
Thank you very much man for your support, your solution is great. Anyway, I did it work, I erased the wc -l and added to the grep " -c " to count wiht it. In this way, there are not more spaces before the result
snmpwalk <ip> <community> interfaces.ifTable.ifEntry.ifOperStatus | grep -c up
That 's all, thanks a lot. Until the next.........
snmpwalk <ip> <community> interfaces.ifTable.ifEntry.ifOperStatus | grep -c up
That 's all, thanks a lot. Until the next.........
Who is online
Users browsing this forum: No registered users and 3 guests