WMI polling broke on update to 1.1.37

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

Moderators: Moderators, Developers

Post Reply
Author
Message
Kashyyyk
Posts: 9
Joined: Tue Mar 24, 2009 3:32 pm

WMI polling broke on update to 1.1.37

#1 Post by Kashyyyk » Mon Feb 11, 2019 11:00 am

I am not sure what happened, I have been using WMI since 8.6 and have been updating since then. I believe I updated from 1.1.7 to 37 and thats when WMI broke. I have also tried updating to 38.

In the poller logfile I am seeing these errors
2019/02/11 07:54:02 - SPINE: Poller[1] WARNING: Invalid Response, Device[100] TH[1] DS[2096] SCRIPT: /usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php '10.1.2.217' /etc/cacti/cactiwm.pw 'Win32_PerfRawData_LocalSessionManager_TerminalServices' 'ActiveSessions,InactiveSessions,TotalSessions' , output:

If I run spine manually from the command prompt to test to make sure it works properly per the INSTALL file for spine, using sudo to run as the user that runs the poller, the output is listed correctly.

sudo -u www-data spine -R -S -V 3

Device[100] TH[1] DS[2096] SCRIPT: /usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php '10.1.2.217' /etc/cacti/cactiwm.pw 'Win32_PerfRawData_LocalSessionManager_TerminalServices' 'ActiveSessions,InactiveSessions,TotalSessions' , output: ActiveSessions:2 InactiveSessions:3 TotalSessions:5

Anyone have any ideas as to what might be going on on my system?

netniV
Cacti Guru User
Posts: 2686
Joined: Sun Aug 27, 2017 12:05 am

Re: WMI polling broke on update to 1.1.37

#2 Post by netniV » Tue Feb 12, 2019 5:12 am

Are you sure that this isn't an intermittent connectivity issue or remote server resource issue? The fact that you are getting the values back when running via spine at the CLI manually, suggests that if everything is in working as it should, you do get the values. So the only logical explanation for it failing is either network connectivity (routing, firewall or latency) or the remote server's resources being tied up (CPU/Memory/Disk).

I would also check on the remote server's event viewer logs to see if it shows anything.

Kashyyyk
Posts: 9
Joined: Tue Mar 24, 2009 3:32 pm

Re: WMI polling broke on update to 1.1.37

#3 Post by Kashyyyk » Tue Feb 12, 2019 10:09 am

I have about 15 different servers setup with various WMI queries. All of them stopped working, however the responses always come back via a direct wmi query, or running spine manually and not through the poller.

I believe I also updated some other packages at the same time. It was running on CentOS when I updated to 1.1.37, and then I upgraded to 10.1.1.38 and migrated over to a Ubuntu system.

Searching older threads on this, I saw someone that mentioned a potential PHP bug but he was not sure what got his working again. It looks like my PHP version is 7.2.10-0ubuntu1.

The wmic version I compiled on this system is 4.0.0tp4.

Appreciate any ideas proffered.

netniV
Cacti Guru User
Posts: 2686
Joined: Sun Aug 27, 2017 12:05 am

Re: WMI polling broke on update to 1.1.37

#4 Post by netniV » Tue Feb 12, 2019 10:12 am

You will find that 1.1.38 will generate warnings all over the place when it comes to PHP 7.2. Not sure whether that would have a bearing on your WMI issue or not.

Kashyyyk
Posts: 9
Joined: Tue Mar 24, 2009 3:32 pm

Re: WMI polling broke on update to 1.1.37

#5 Post by Kashyyyk » Tue Feb 12, 2019 7:01 pm

Been doing a bit more testing. It feels like I should be getting close, but I'm still not sure what is wrong.

Cron Entry:
* * * * * www-data php /usr/share/cacti/site/poller.php 2>&1 >/dev/null | if [ -f /usr/bin/ts ] ; then ts ; else tee ; fi >> /var/log/cacti/poller-error.log


Disabling the cron job and manually running the poller as root or www-data the wmi queries work properly.(eg "php /usr/share/cacti/site/poller.php" or "sudo -u www-data php /usr/share/cacti/site/poller.php")

Edited the crontab to set it to run as root as a test and the wmi queries don't work.

I am not sure why the poller running from crontab would not work hoping someone may have seen something similar before, or maybe see something wrong with the crontab command.

netniV
Cacti Guru User
Posts: 2686
Joined: Sun Aug 27, 2017 12:05 am

Re: WMI polling broke on update to 1.1.37

#6 Post by netniV » Wed Feb 13, 2019 9:02 am

Are there any messages in that poller error log? Can the poller user create a log file in that location?

Kashyyyk
Posts: 9
Joined: Tue Mar 24, 2009 3:32 pm

Re: WMI polling broke on update to 1.1.37

#7 Post by Kashyyyk » Wed Feb 13, 2019 9:57 am

There are only a few thold errors in the logs, which I wasn't using thold so I disabled it. Yes the poller user can write to it.

Kashyyyk
Posts: 9
Joined: Tue Mar 24, 2009 3:32 pm

Re: WMI polling broke on update to 1.1.37

#8 Post by Kashyyyk » Wed Feb 13, 2019 11:02 am

So I finally got it working. Found some other people that had scripts that ran fine at cli but not through cron and they had path environment issues. I added this to the crontab file.

PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

Just for fun here is what I put in to see the path of the crontab environment.

* * * * * www-data echo $PATH > /var/log/cacti/crontab_path.txt

/usr/bin:/bin

Post Reply