Empty values when script is executed by poller

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

Moderators: Developers, Moderators

Post Reply
ogeeen
Posts: 4
Joined: Tue Dec 15, 2015 4:15 am

Empty values when script is executed by poller

Post by ogeeen »

Hi,
I am using esxiograph.sh script to monitor our Virtual hosts on VMWare ESXi.

The problem is that when the script is executed by poller then in cacti log I see only empty values:

Code: Select all

12/14/2015 06:25:15 PM - SPINE: Poller[0] Host[46] TH[1] DS[4847] SCRIPT: /var/www/domains/default/htdocs/cacti/scripts/esxiograph.sh mem_vm xx.xx.xx.xx esxihost vmname PASSWORD, output: usage: active:
But when I run the script manually, then everything seems ok:

Code: Select all

root@monitoring:~#/var/www/domains/default/htdocs/cacti/scripts/esxiograph.sh mem_vm xx.xx.xx.xx esxihost vmname PASSWORD
usage:1016.04 active:102.40root@monitoring:~#
Also when script is executed by cacti user:

Code: Select all

root@monitoring:~#su -c "/var/www/domains/default/htdocs/cacti/scripts/esxiograph.sh mem_vm xx.xx.xx.xx esxihost vmname PASSWORD" cacti
usage:1016.11 active:81.92root@monitoring:~#
Does anybody have any idea why should script executed by poller return empty values?
How can I debug this issue?

Thanks for help.
ogeeen
Posts: 4
Joined: Tue Dec 15, 2015 4:15 am

Re: Empty values when script is executed by poller

Post by ogeeen »

Update:

When I run the poller as root, then the script works amd returns right values:

Code: Select all

*/5 * * * *    root   /usr/bin/php /var/www/domains/default/htdocs/cacti/poller.php > /dev/null 2>&1
So the access rights are wrong somewhere.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Empty values when script is executed by poller

Post by phalek »

Does this also work ?

Code: Select all

su -l -c "/var/www/domains/default/htdocs/cacti/scripts/esxiograph.sh mem_vm xx.xx.xx.xx esxihost vmname PASSWORD" cacti
If not, then it's an environment/path thing. If you skip the "-l" then the su command will use the path/environment variables which have been set by/for the root user.

So your cacti user may miss some path and/or environment settings.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
ogeeen
Posts: 4
Joined: Tue Dec 15, 2015 4:15 am

Re: Empty values when script is executed by poller

Post by ogeeen »

phalek wrote:Does this also work ?

Code: Select all

su -l -c "/var/www/domains/default/htdocs/cacti/scripts/esxiograph.sh mem_vm xx.xx.xx.xx esxihost vmname PASSWORD" cacti
If not, then it's an environment/path thing. If you skip the "-l" then the su command will use the path/environment variables which have been set by/for the root user.

So your cacti user may miss some path and/or environment settings.

It works. No difference between running the command woth or without -l.


Thanks for your answer.
ogeeen
Posts: 4
Joined: Tue Dec 15, 2015 4:15 am

Re: Empty values when script is executed by poller

Post by ogeeen »

This post helped:

http://forums.cacti.net/viewtopic.php?f=2&t=41534

I changed suid by spine.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests