[solved] Problem executing Perl script from poller

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

cahonis
Cacti User
Posts: 123
Joined: Fri Jun 06, 2008 5:50 am

[solved] Problem executing Perl script from poller

Post by cahonis »

I've installed Perl on my Windows 2003 Cacti server to enable a Perl script associated with SQL WMI poll for this http://forums.cacti.net/viewtopic.php?t=5225&start=30.

If I run the script from a command line it returns valid values but the poller log only returns the following:

Code: Select all

12/10/2009 03:29:18 PM - SPINE: Poller[0] Host[323] ERROR: Empty result [lon-sqldb01]: 'C:\Perl\Bin\perl.exe D:/cacti/scripts/w32_sql_query_connections.pl LON-SQLDB01 get UserConnections,LoginsPersec,LogoutsPersec' 
Can anyone point me in the direction of where I have misconfigured?
Last edited by cahonis on Mon Jan 04, 2010 10:23 am, edited 1 time in total.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

WMI probably isn't configured to allow your cacti scheduled task user account to access the info. Read in my installation guide FAQ section, on how to configured WMI for a user account. Link in signature.
cahonis
Cacti User
Posts: 123
Joined: Fri Jun 06, 2008 5:50 am

Post by cahonis »

I have followed the instructions in your FAQ with the exception of the Firewall settings (the service is disabled on the system I am trying to moonitor).

I am still seeing the same errors in the cacti logs.
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

Logon to the Windows host you are trying to poll:

1. Open command prompt
2. In command prompt window, type wmiadap /f and press enter
3. You won't see any output - this is normal
4. Restart the Windows Management Instrumentation (WMI) service

Try again.
cahonis
Cacti User
Posts: 123
Joined: Fri Jun 06, 2008 5:50 am

Post by cahonis »

I tried that but still receive the same error message.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Still must be a user permission issue, since your user account the script works but the cacti scheduled task user, it does not. Log onto the server with the cacti scheduled task user and then try to run the script. It should not work.
cahonis
Cacti User
Posts: 123
Joined: Fri Jun 06, 2008 5:50 am

Post by cahonis »

just logged on to the cacti server as the cactipoller account and ran the script against the target system successfully:

Code: Select all

C:\>C:\Perl\Bin\perl.exe D:/cacti/scripts/w32_sql_query_connections.pl LON-SQLDB01 get UserConnections,LoginsPersec,LogoutsPersec
UserConnections:322 LoginsPersec:563098 LogoutsPersec:562246
C:\>
so it doesn't appear to be a permissions problem.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Try changing the poller to cmd.php instead.
cahonis
Cacti User
Posts: 123
Joined: Fri Jun 06, 2008 5:50 am

Post by cahonis »

ah ha! it's working now using cmd.php

what would cause it to fail with spine?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Well spine is a completely different poller/language than cmd.php... spine is often more picky about how things work/set up. Make sure your script/paths are using forward slashes too.

If you really wanted to dig into the problem, use Sysinternals Process Monitor during a polling cycle with cmd.php and then Spine. Watch what happens around when w32_sql_query_connections.pl is launched.
cahonis
Cacti User
Posts: 123
Joined: Fri Jun 06, 2008 5:50 am

Post by cahonis »

It appears it only ran for a single polling cycle then stopped again....
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Well that doesn't make any sense... it should either work all the time or none at all.

Lets start with the basics -- does cacti work with the scripts/templates that it comes with against any of your systems?
cahonis
Cacti User
Posts: 123
Joined: Fri Jun 06, 2008 5:50 am

Post by cahonis »

which scripts come with Cacti 'out-of-the-box'?

I have some PHP scripts that monitor the cacti poller etc which all work fine.

This perl script I am having issues with is the only one in use on my cacti installation.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

cahonis wrote:which scripts come with Cacti 'out-of-the-box'?
SNMP - Get Mounted Partitions
SNMP - Get Processor Information
SNMP - Interface Statistics

etc
cahonis wrote:I have some PHP scripts that monitor the cacti poller etc which all work fine
That script does php calls to fetch info from the mysql db...
cahonis wrote:This perl script I am having issues with is the only one in use on my cacti installation.
Yea, well that script is quite hackish, due to the complexity of things. Cacti scheduled task launches php (poller.php), which then launches the collection agent (cmd.php or spine.exe), which then launches Perl to do Windows only WMI calls on a system.

Spine needs all forward slashes in the path. Make sure to clear the poller cache after changing the script path. That one time you said it ran with cmd.php -- did you manually run it (I think you did) or let the scheduled task normally run?
cahonis
Cacti User
Posts: 123
Joined: Fri Jun 06, 2008 5:50 am

Post by cahonis »

Yes, all of the 'out-the-box' scripts are working correctly.

I forced a run of the scheduled task when it ran successfully. I'm not sure what this might indicate though as I have logged onto the server console using the poller scheduler account and ran the perl script manually without issue.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest