Problem with a script

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

Moderators: Developers, Moderators

Post Reply
lemurid
Posts: 1
Joined: Fri Mar 05, 2010 2:18 am

Problem with a script

Post by lemurid »

To get my CPU and MB temps i wrote the following script

#!/usr/pkg/bin/perl

$mbmon = `mbmon -c 1`;

$mbmon =~ /^Temp\.= (.*);(.*)$/m;
$1 =~ /^(.*),\s+(.*),\s+(.*)$/m;
$case = sprintf("%d",$1);
$cpu = sprintf("%d",$2);
print "case:$case cpu:$cpu";

Running it returns the following values

# perl ./cpumbtemp.pl
case:38 cpu:42

But in my cacti.log i see the following

03/05/2010 12:55:02 PM - CMDPHP: Poller[0] Host[1] DS[26] CMD: perl /usr/local/share/cacti/scripts/cpumbtemp.pl, output: case:0 cpu:0
03/05/2010 12:55:02 PM - CMDPHP: Poller[0] Host[1] DS[25] CMD: perl /usr/local/share/cacti/scripts/cpumbtemp.pl, output: case:0 cpu:0


Where did i go wrong?
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests