[XML] successor to apachestats 0.4

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
leonardo_gyn
Cacti User
Posts: 85
Joined: Sat Jan 22, 2005 4:51 pm

Use of uninitialized value in concatenation

Post by leonardo_gyn »

Hi Guys,

I have installed template on a new Fedora Core 4 machine and got the following errors when running the script:


[root@proxy scripts]# perl ws_apachestats.pl www.mymachine.com
Use of uninitialized value in concatenation (.) or string at ws_apachestats.pl line 63.
Use of uninitialized value in concatenation (.) or string at ws_apachestats.pl line 65.
Use of uninitialized value in concatenation (.) or string at ws_apachestats.pl line 67.
Use of uninitialized value in concatenation (.) or string at ws_apachestats.pl line 69.
Use of uninitialized value in concatenation (.) or string at ws_apachestats.pl line 71.
Use of uninitialized value in split at ws_apachestats.pl line 91.
Use of uninitialized value in concatenation (.) or string at ws_apachestats.pl line 105.
apache_total_hits: apache_total_kbytes: apache_busy_workers: apache_idle_workers: apache_reqs_second: thread_O:0 threadC:0 threadD:0 threadG:0 threadI:0 threadK:0 threadL:0 threadR:0 threadS:0 threadW:0 thread_W:0 apache_cpuload:
[root@proxy scripts]#


Error is happening from console with root and with cacti user as well, the user i run cacti processes.

Strange is that I have this script running on some Red Hat 9 machines and got no errors at all.

Is this a new check from newer Perl versions ???
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please tell us what your browser returns when entering www.mymachine.com/server-status?auto as URL. The script awaits some output like

Code: Select all

$output =~ /Total Accesses: (.*)/;
$out .= "apache_total_hits:".$1." ";
$output =~ /Total kBytes: (.*)/;
$out .= "apache_total_kbytes:".$1." ";
$output =~ /Busy.*: (.*)/;
$out .= "apache_busy_workers:".$1." ";
$output =~ /Idle.*: (.*)/;
$out .= "apache_idle_workers:".$1." ";
Please note the apache version
Reinhard
leonardo_gyn
Cacti User
Posts: 85
Joined: Sat Jan 22, 2005 4:51 pm

Post by leonardo_gyn »

I dont know if this is related, but i upgraded perl and the warnings are gone. Unfortunely i have no fedora core 4 with original perl ... i will have one on the next days and i will redo tests on it.

I will post results until the weekend.
User avatar
dust2k
Cacti User
Posts: 101
Joined: Sun Dec 04, 2005 3:14 am

Post by dust2k »

does that pl script work under windows ?

I run it manually at command line and I got

perl G:/root/web/cacti/scripts/ws_apachestats.pl 192.168.1.20
The system cannot find the path specified.
Use of uninitialized value in concatenation (.) or string at G:/root/web/cacti/scripts/ws_apachestats.pl line 63.
Use of uninitialized value in concatenation (.) or string at G:/root/web/cacti/scripts/ws_apachestats.pl line 65.
Use of uninitialized value in concatenation (.) or string at G:/root/web/cacti/scripts/ws_apachestats.pl line 67.
Use of uninitialized value in concatenation (.) or string at G:/root/web/cacti/scripts/ws_apachestats.pl line 69.
Use of uninitialized value in split at G:/root/web/cacti/scripts/ws_apachestats.pl line 89.
Use of uninitialized value in concatenation (.) or string at G:/root/web/cacti/scripts/ws_apachestats.pl line 103.
apache_total_hits: apache_total_kbytes: apache_busy_workers: apache_idle_workers: thread_O:0 threadC:0 threadD:0 threadG:0 threadI:0 threadK:0 threadL:0 threadR:0 threadS:0 threadW:0 thread_W:0 apache_cpuload:

I compare the new script with original one and found new script actually use high speed version which use wget or lynx which I don't have on my windows box, what I can do now?
User avatar
dust2k
Cacti User
Posts: 101
Joined: Sun Dec 04, 2005 3:14 am

Post by dust2k »

Found the problem,

Apache doesn't accept IP as server name to show server-status and I need reconfig the internal DNS name to make it work.

also get wget and modify the script to use right path, everything is alright now.
User avatar
dust2k
Cacti User
Posts: 101
Joined: Sun Dec 04, 2005 3:14 am

Re: Use of uninitialized value in concatenation

Post by dust2k »

leonardo_gyn wrote: Error is happening from console with root and with cacti user as well, the user i run cacti processes.
Your Apache's problem, server-status?auto didn't return proper values.
leonardo_gyn
Cacti User
Posts: 85
Joined: Sat Jan 22, 2005 4:51 pm

Re: Use of uninitialized value in concatenation

Post by leonardo_gyn »

dust2k wrote: Your Apache's problem, server-status?auto didn't return proper values.
Yeah, i think you are sure ..... i couldnt reproduce the problem and unfortunelly i didnt check server-status?auto URL when I was having the problem. I have tried all combination of things, restarting apache, perl stock and updated versions on FC4 but couldnt, not even one single time, reproduce the error.

I can get server-status page using my IP address (http://192.168.X.X/server-status), dont think that was the problem. In fact i was using www.myserver.com and not IP address ...

Well, i would like to have found a way of reproducing the error so we could handle it, but i couldnt ...

By the time, graphs are working perfectly !!!
Attachments
apache hits.jpg
apache hits.jpg (47.2 KiB) Viewed 22061 times
User avatar
dust2k
Cacti User
Posts: 101
Joined: Sun Dec 04, 2005 3:14 am

Post by dust2k »

it's bit weired for me to implement it as well, first time it doesn't work, so I changed the httpd.conf and restarted apache, it still not working, even I just brower to test the url, but 5 mins later, everything start working, then I re-test other, everything is working..hehe .
leonardo_gyn
Cacti User
Posts: 85
Joined: Sat Jan 22, 2005 4:51 pm

Post by leonardo_gyn »

I think we should call that 'Believe it or not' TV show :D

But are your graphs finally working now, all of them ?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

dust2k wrote:it's bit weired for me to implement it as well, first time it doesn't work, so I changed the httpd.conf and restarted apache, it still not working, even I just brower to test the url, but 5 mins later, everything start working, then I re-test other, everything is working..hehe .
The 5 mins are commonly known as the poller interval. This perfectly normal that it would take at least 5 min (for GAUGE data sources) or up to 10 mins (for COUNTER data sources, difference between two polling cycles will be needed) for data to come up...
Reinhard
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Here's a snippet from my /etc/http/conf/httpd.conf

Code: Select all

# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
ExtendedStatus On
and later

Code: Select all

# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Change the ".example.com" to match your domain to enable.
#
<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from .team-scheck.de
    Allow from 127.0.0.1
</Location>
as well as a module

Code: Select all

LoadModule status_module modules/mod_status.so
After changing the httpd.cond, refresh/restart of apache will be necessary. Of course you'll need tpo customize the Allow directives to your needs.
Verify this by entering sth like

Code: Select all

http://localhost/server-status
as URL to your browser to see sth like the attached picture
Reinhard
Attachments
Apache's server-status page (example)
Apache's server-status page (example)
Bildschirmfoto-1.png (53.08 KiB) Viewed 22052 times
User avatar
dust2k
Cacti User
Posts: 101
Joined: Sun Dec 04, 2005 3:14 am

Post by dust2k »

leonardo_gyn wrote:But are your graphs finally working now, all of them ?
yes, all of them, works beautifully, the only issue I have now, the graph doesn't have pure connection chart like the IIS one, but that's ok, not a big problem anyway.

and thanks for lvm's post, it should come bit early then will save me lots of time.
jmeyerdo
Posts: 26
Joined: Mon May 02, 2005 7:11 am
Location: Dortmund, Germany

Post by jmeyerdo »

Hello!

Great tool - it is running on another server since several weeks.
With a new installation I have one problem. I read both major threads for "apachestats" now - but can't find a solution.

I installed apachestats yesterday (and the improved version this morning). Installation was without problems, the perl-script can grab the details.

But the graphs are not displayed:

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Localhost - Apache Statistics - Hits / s" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Hits/sec" \
AREA:#AAABA1:"Hits/sec"  \
GPRINT::LAST:"Current\:%8.2lf %s"  \
GPRINT::AVERAGE:"Average\:%8.2lf %s"  \
GPRINT::MAX:"Maximum\:%8.2lf %s\n"  \
COMMENT:"                            Represents the number of hits per second\n"  \
COMMENT:"                                 ApacheStats v0.4 - Rolf Poser\n" 
RRDTool Says:

ERROR: can't parse '#AAABA1:Hits/sec'
I am using rrdtool-1.0.49.

Any hint to solve this problem would be great - thank you!

Kind regards, Jens
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Seems that importing was not ok. The DEF statements are missing for the rrdtool graph. Please re-import the templates and send a screenshot/list of the outcome
Reinhard
jmeyerdo
Posts: 26
Joined: Mon May 02, 2005 7:11 am
Location: Dortmund, Germany

Post by jmeyerdo »

Hello!

Thank you for your answer.
I re-imported (without deletion - is this ok?) the xml-template.
FInd output attached to this post.

Kind regards (from Dortmund), Jens
Attachments
Screenshot (re-) import XML-file.
Screenshot (re-) import XML-file.
screenshot_import_apachexml.jpg (96.49 KiB) Viewed 21990 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest