Problem with selfmade script (After reading all the docs)

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Post Reply
Author
Message
sacoo
Posts: 14
Joined: Fri Mar 30, 2007 2:22 am

Problem with selfmade script (After reading all the docs)

#1 Post by sacoo » Fri Mar 30, 2007 2:43 am

Version 0.8.6f (sorry about that :( )

I've been trying to use a script to monitor the qmail's remote queue for some days and haven't been capable of getting a result.

Server side script

Code: Select all

#!/usr/bin/perl
$remote = `/usr/bin/find /var/qmail/queue -name "*" -type f | grep  remote | wc -l`;
chomp ($remote);
$remote =~ tr/ //d;
print "$remote";
Script in perl in cacti machine

Code: Select all

#!/usr/bin/perl
$output = `/usr/bin/snmpwalk -v 1 -c public $ARGV[0] .1.3.6.1.4.1.2021.51.101.1`;
print $output;
Output when calling it as user cacti from the shell with ./queuecheck.pl 192.168.1.7
enterprises.ucdavis.51.101.1 = "323"

And when doing php -q cmd.php 39 39 and with debug mode I can see in the cacti.log
03/29/2007 06:53:46 PM - CMDPHP: Poller[0] Host[39] DS[2276] WARNING: Result from CMD not valid. Partial Result: enterprises.ucdavis.
03/29/2007 06:53:46 PM - CMDPHP: Poller[0] Host[39] DS[2276] CMD: /usr/bin/perl /srv/www/htdocs/cacti/scripts/queuecheck.pl 192.168.1.7, output: U


Now I'm stuck and don't know what else to do.

Thanks in advance

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Problem with selfmade script (After reading all the docs

#2 Post by gandalf » Fri Mar 30, 2007 5:05 am

sacoo wrote: Script in perl in cacti machine

Code: Select all

#!/usr/bin/perl
$output = `/usr/bin/snmpwalk -v 1 -c public $ARGV[0] .1.3.6.1.4.1.2021.51.101.1`;
print $output;
Please try

Code: Select all

#!/usr/bin/perl
$output = `/usr/bin/snmpwalk -v 1 -c public -OQve $ARGV[0] .1.3.6.1.4.1.2021.51.101.1`;
print $output;
instead. But why do you use a perl wrapper for simple OID calls? See first link of my signature for another approach
Reinhard

sacoo
Posts: 14
Joined: Fri Mar 30, 2007 2:22 am

Problem with selfmade script (After reading all the docs)

#3 Post by sacoo » Fri Mar 30, 2007 6:03 am

But why do you use a perl wrapper for simple OID calls? See first link of my signature for another approach
Well, in origin I was trying to use the soltuion from http://forums.cacti.net/post-95420.html to use with my qmail wich has two outputs. I managed to reduce the dependencies so I didn't need to use the qmHandle.

Anyway at the end I managed to use the OID as you told and no problem.

I still donno how to use to Results at the same time, but that's another questions.

Thanks a lot

Post Reply