Script is ok on perl command line but datasource output :0

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
fairydream
Posts: 2
Joined: Tue Feb 26, 2008 10:27 pm

Script is ok on perl command line but datasource output :0

Post by fairydream »

I have a data input method script to get current calls and the graph is ok with cacti 0.8.7a on windows host.
//------------------------------------------
#!/usr/bin/perl -w
@lists=`snmpwalk -Ov -v 2c -c snmp_str 10.84.10.29 1.3.6.1.4.1.9.9.63.1.3.2.1.25`;
$calls = @lists/2;
$test=400;
print $calls;
//----------------------------------------------
On linux host with cacti 0.8.6h, althought output value is returned when run perl command line, the cacti graph value is NaN.

[root@nms-cacti /]# perl var/www/html/cacti/scripts/ipgwcall2.pl
45[root@nms-cacti /]#

in Cacti log shows Output :0
04/02/2008 03:45:02 PM - CACTID: Poller[0] Host[0] DS[659] SCRIPT: perl /var/www/html/cacti/scripts/ipgwcall2.pl, output: 0

I misunderstand because if i replace $calls by a contant value $test , datasource output is 400 and the graph shows this value (400)

Something is wrong with my script or Cacti ? Need someone help me !
User avatar
TheWitness
Developer
Posts: 17064
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Use snmpget instead of snmpwalk, and then don't use an array.

TheWitness
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?
User avatar
TheWitness
Developer
Posts: 17064
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I also suggest that you simply use the snmp functions in cacti instead of perl, as it's much faster and then use a cdef to do the division.

TheWitness
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?
fairydream
Posts: 2
Joined: Tue Feb 26, 2008 10:27 pm

Post by fairydream »

Thank you !
But I think the problem is snmpwalk(or snmpget) don't run when cacti poller calls script, so no output value return.
Have output return in perl command line, and everything' s ok with cacti 0.87a installed in windows host (output value, graph shows)
But It crazy in linux ! I'm a linux newbie.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests