Apache stats script error: output: U

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

Moderators: Developers, Moderators

Post Reply
clockwork
Posts: 22
Joined: Fri Feb 23, 2007 1:04 am

Apache stats script error: output: U

Post by clockwork »

So apache stats stopped working (Nan's in the graphs, cause the script doesnt seem to be working)

Code: Select all

05/16/2007 02:20:24 PM - CACTID: Poller[0] Host[68] DS[3083] WARNING: Result from SCRIPT not valid. Partial Result: ...
05/16/2007 02:20:24 PM - CACTID: Poller[0] Host[68] DS[3083] SCRIPT: /usr/bin/perl /opt/cacti/scripts/ws_apachestats.pl 10.6.8.24
, output: U
Running the script as the cacti user actually works just fine. So does calling cactid like so:

Code: Select all

cacti@cacti01:/opt/cacti$ ./cactid -f=68 -l=68
CACTID: Using cactid config file [/etc/cactid.conf]
CACTID: Version 0.8.6i starting
CACTID: Host[68] DS[3084] SCRIPT: /usr/bin/perl /opt/cacti/scripts/ws_apachestats.pl~ 10.6.8.24, output: apache_total_hits:4153 apache_total_kbytes:76121 apache_busy_workers:2 apache_idle_workers:510
CACTID: Host[68] DS[3085] SCRIPT: /usr/bin/perl /opt/cacti/scripts/ws_apachestats.pl~ 10.6.8.24, output: apache_total_hits:4154 apache_total_kbytes:76123 apache_busy_workers:2 apache_idle_workers:510
CACTID: Host[68] DS[3083] SCRIPT: /usr/bin/perl /opt/cacti/scripts/ws_apachestats.pl~ 10.6.8.24, output: apache_total_hits:4155 apache_total_kbytes:76124 apache_busy_workers:2 apache_idle_workers:510
So what exactly am I missing. Everything appears to work just fine, but its throwing a non-descriptive error.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Is the script named /opt/cacti/scripts/ws_apachestats.pl~ or /opt/cacti/scripts/ws_apachestats.pl?
Reinhard
clockwork
Posts: 22
Joined: Fri Feb 23, 2007 1:04 am

Post by clockwork »

its actually the exact same script. A long time ago when we were having some trouble we made a copy and poked it a bit, but everything ended up getting reverted once we determined that the script wasnt the issue.

I renamed the stuff in cacti's UI after running an md5 on the scripts. Same result. run by hand it works, run via direct cactid it works, run via normal poller cron method and it fails.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Is it an option to modify this copy of the script to simply output a constant integer? Just to verify, that calling the script is ok?
Reinhard
clockwork
Posts: 22
Joined: Fri Feb 23, 2007 1:04 am

Post by clockwork »

So I have the script basically outputting the variable it was called with, and now I get the following:

Code: Select all

05/17/2007 04:35:22 PM - CACTID: Poller[0] Host[68] DS[3093] SCRIPT: /usr/bin/perl /opt/cacti/scripts/ws_apachestats.pl~ 10.6.8.24, output
: 10.6.8.24
05/17/2007 04:35:22 PM - CACTID: Poller[0] Host[68] DS[3094] SCRIPT: /usr/bin/perl /opt/cacti/scripts/ws_apachestats.pl~ 10.6.8.24, output
: 10.6.8.24
05/17/2007 04:35:22 PM - CACTID: Poller[0] Host[68] DS[3092] SCRIPT: /usr/bin/perl /opt/cacti/scripts/ws_apachestats.pl~ 10.6.8.24, output
: 10.6.8.24
Which to my eyes looks fine. So its something weird in the output thats coming from the script. What I dont understand is why cactid works when I run it manually, and why the script works when I run it manually but for some reason it fails via the poller calling cactid.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

The script is using wget? Is wget in the path of cactiuser? Else, please provide /full/path/to/wget
Reinhard
clockwork
Posts: 22
Joined: Fri Feb 23, 2007 1:04 am

Post by clockwork »

Well hardcoding wget (and/or re-importing the entire template set) worked, which is odd because its in the cacti users path and the cacti user could exec it.

:: shrug ::

Thanks for the help.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

This should be re-written using php script server. PHP has a "file" command that will essentially read a string into an array. For example:

$my_array = file("http://big-dogs.com?ab=c&d=ef");

Will return your output data in the form of an array that can then be parsed one line at a time. No need to have high load launching both the Perl script and wget binaries.

TheWitness :D
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
clockwork
Posts: 22
Joined: Fri Feb 23, 2007 1:04 am

Post by clockwork »

I think it actually has been rewritten accordingly (at least thats what a cursory glance would lead me to believe) however the most useful data we get about apache is a log-scrape script that uses a custom log that reports service times, errors and the like which dumps into a cacti graph.

The actual stats are bonus.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests