Apache Stats Collection Units information


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Apache Stats Collection Units information
# 1  
Old 04-11-2013
Apache Stats Collection Units information

Code:
#!/usr/bin/perl
#
## Zabbix_Apache2.pl
## Versions 2.0

#
use LWP::Simple;
use strict;
#
my($url)="http://localhost/server-status?auto";
my($server_status)=get($url);
my($total_accesses,$total_kbytes,$cpuload,$uptime, $reqpersec,$bytespersec,$bytesperreq,$busyworkers, $idleworkers,$totalworkers);
#
if (! $server_status) {
print "Can't access $url\nCheck apache configuration\n\n";
exit(1);
}
#
$total_accesses = $1 if ($server_status =~ /Total\ Accesses:\ ([\d|\.]+)/ig)||0;
$total_kbytes = $1 if ($server_status =~ /Total\ kBytes:\ ([\d|\.]+)/gi);
$cpuload = $1 if ($server_status =~ /CPULoad:\ ([\d|\.]+)/gi);
$uptime = $1 if ($server_status =~ /Uptime:\ ([\d|\.]+)/gi);
$reqpersec = $1 if ($server_status =~ /ReqPerSec:\ ([\d|\.]+)/gi);
$bytespersec = $1 if ($server_status =~ /BytesPerSec:\ ([\d|\.]+)/gi);
$bytesperreq = $1 if ($server_status =~ /BytesPerReq:\ ([\d|\.]+)/gi);
$busyworkers = $1 if ($server_status =~ /BusyWorkers:\ ([\d|\.]+)/gi);
$idleworkers = $1 if ($server_status =~ /IdleWorkers:\ ([\d|\.]+)/gi);
$totalworkers = $busyworkers + $idleworkers;
#
open (MYFILE, '>/tmp/apache_data.txt');
printf MYFILE "%i:%i:%.2f:%i:%.2f:%.2f:%.2f:%i:%i:%i\n",$total_accesses,$total_kbytes,$cpuload,$uptime,$reqpersec,$bytespersec,$bytesperreq,$busyworkers,$idleworkers,$totalworkers;
close (MYFILE); 
exit(0);


Above is a code that I found in your forums.I wanted to know if the measuring units represent exact values meaning wanted to know if some of them are in percentages?

Sample Output:
Code:
busyworkers:75 bytesperreq:2241.71 bytespersec:7634.33 CPULoad:.0853807 idleworkers:13 reqpersec:3.40558 TotalAccess:195167 totalworkers:88 Total_kbytes:427254


Last edited by Franklin52; 04-12-2013 at 03:06 AM.. Reason: Please use code tags for data and code samples
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Tool suggestion for collection CPU/memory Stats

Hi, We have around 1000 server (Red Hat + Suse + Parallels + Solaris-9/10/11). Every month, we generate a report for all servers for CPU and Memory utilization in 'percentage used'. This report is generated from HP Openview and frequency is every file minutes. In HP OpenView, we are picking 20... (0 Replies)
Discussion started by: solaris_1977
0 Replies

2. UNIX and Linux Applications

Gnuplot Same Data Two Axes Different Units)

I'm pretty familiar with Gnuplot, but I've never actually come across a reasonable solution to this problem and I'm hoping someone can help me out! I think it's because I don't know how to pose the problem neatly, so please bare with me. Also new to the forum....so yeah... I have one data set (x... (3 Replies)
Discussion started by: TC69
3 Replies

3. UNIX for Dummies Questions & Answers

apache logging - show more information

is it possible to make apache log each user activity in its log file "access_log" i have a web application here that uses apache. in the apache log files, i see that it shows when requests are made to certain pages in my web application. but it doesn't show the user name of the person making... (1 Reply)
Discussion started by: SkySmart
1 Replies

4. Solaris

Strange power supply units alarms!!!

Hi folks, I encountered this alarms on a solaris server: 04/21/12 23:17:55 MNP-PGW-A_bge3 mnp 231748 Power Supply Unit 0 is faulty 04/21/12 23:17:55 MNP-PGW-A_bge3 mnp 231748 Power Supply Unit 1 is faulty 04/21/12 23:18:26 MNP-PGW-A_bge3 mnp 231822 Power Supply Unit 0 is faulty:CLEAR... (0 Replies)
Discussion started by: kimurayuki
0 Replies

5. AIX

Processsing Units and Virtual Processors.

Hi, on redhat linux 5.5 (IBM PPC) os, whenever I am running the command top, it is showing 8 cpu. Processing Units Property Current Pending Minimum 0.1 Assigned 0.8 Maximum 1 Virtual Processors Property Current Pending Minimum 1 Assigned 4 ... (1 Reply)
Discussion started by: manoj.solaris
1 Replies

6. Hardware

Units in server racks

What does the term units mean in the context of server racks, for instance 4U? It is an indication of height, so does that mean the amount of disks the rack can hold or can the rack hold multiple motherboards / processors? (8 Replies)
Discussion started by: figaro
8 Replies

7. UNIX for Dummies Questions & Answers

How to hide Apache Server information?

When we have a directory web page open to public, there is usually a message shows on the bottom: Apache/2.0.40 Server at www.mydomain.net Port 80 Could someone tell me how to hide the information like this web page does? http://debian.cn99.com/debian-cd/ Thanx in advance. HOUSCOUS (2 Replies)
Discussion started by: HOUSCOUS
2 Replies
Login or Register to Ask a Question