poller executes script getting incorrect output

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Moderators, Developers

Post Reply
Posts: 16
Joined: Wed May 09, 2012 11:03 am

poller executes script getting incorrect output

#1 Post by enriquet » Thu Mar 14, 2019 10:26 am

Hi all. I am facing a problem for which i could not find a solution, event reading some posts regarding similar issues.
When i executed script from shell with user www-data:
$ id
uid=33(www-data) gid=33(www-data) grupos=33(www-data)
$ perl /usr/share/cacti/site/scripts/Gateway_modbus.pl xxx 300041 1
30523$ exit

Executed by poller:
03/14/2019 12:16:32 PM - CMDPHP: Poller[0] Host[1037] DS[31521] CMD: perl /usr/share/cacti/site/scripts/Gateway_modbus.pl xxxx 300041 1, output: U

I tried:
1) verified script permisions, and owners (shown in paste above)
2) tried different scripts written in shell, perl and python, same results
3) redirected output to file and search for special characters, nothing noticed
4) Even so, added some string cleaning comands, to remove special characters in output. No changes.
5) cleaned poller cache, without knowing exactly what i could achive with this, but following recomendation of one post with similar issue (no changes)
6) reboot host

Scripts is as follows:


# chequea que se pase un parametro
if ( @ARGV != 3 )
print "Uso es: $0 <ip o hostname> <direccion> <count>\n";


open(COMANDO, "modbus read -p 502 $host $direccion $count | ");
$salida = <COMANDO>;

#command exit example
#modbus read -p 502 xxxx 300041 1
#300041 30517

# extract second value
if ($salida =~ /(\d+)\s+(\d+)/) {
print $valor;


Also, if i add a line $valor=12345; just before print then things works as expected and poller shows correct result
I ve run out of ideas of what to try. I have some graphs with script input, and working ok. Its the first time i find this kind of problem, and also never found a problem in cacti so hard and so long to solve, so any help will be greatly appreciated

Post Reply