NetAdminTools.com
 
Categories:
GNU/Linux | Homebrew designs | Perl | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS | Hail Support


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·REALbasic
·All Categories


Live Graph of Apache Processes - Part 2 - Displaying Scale
Topic: Monitoring   Posted:2006-02-14
Printer Friendly: Print

spacerspacer
There are 3 parts to this article:
Part 1 - Part 2 - Part 3

In the introduction to this series we showed a graph of Apache processes (httpd). This article will show how to create the scale of the graph and the initial fig file entries. See Xfig.org for more details on the graphing program we use. One advantage is that we can generate the fig file from a Perl script, and then use the fig2dev command to render the fig file. Here is the Perl script that generates the initial fig file and scale:

open (HTTPDBACK, "> /path/to/fig/file/httpd.fig");
print HTTPDBACK "#FIG 3.2  
Landscape
Center
Metric
Letter  
100.00
Single
-2
1200 2
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
-45 0 64800 0 64800 22545 -45 22545 -45 0
";
for ($i=1;$i <= 23;$i++){
print HTTPDBACK "4 0 0 50 -1 14 90 0.0000 4 360 345 ";
print HTTPDBACK $i*2700-1000;
print HTTPDBACK " 23940 ";
if ($i < 13){
print HTTPDBACK $i;
}
else{
print HTTPDBACK $i-12;
}
print HTTPDBACK "\\001\n";
}
$i=2;
while($i < 50){
print HTTPDBACK "4 0 0 50 -1 14 90 0.0000 4 360 345 -1800 ";
print HTTPDBACK 22500-$i*450;
print HTTPDBACK " ".$i;
print HTTPDBACK "\\001\n";
$i=$i+3;
}
close HTTPDBACK;

Probably the best way to go about this is to first draw the type of graph you want in Xfig, and then change the numbers above to match your design. The graph we used is specified in the beginning, before the first for loop. After the initial specification of the graph, we draw the numbers across the bottom of the graph with a for loop. There is an if clause to set the displayed numbers to a 12 hour display of the hour. The final piece is the loop that creates the numbers on the left side of the graph that show the scale of the number of Apache processes. That is it for the initial creation of the scale. set up a cron job to reset the fig file at midnight and archive the current file for reference:

0 0 * * * /bin/cp /path/to/httpd.png /path/to/httpdyest.png > 
/dev/null 2>&1;/usr/bin/perl /path/to/backhttpd.pl > /dev/null 2>&1

We discuss the script that draws the blue bars in this article.

There are 3 parts to this article:
Part 1 - Part 2 - Part 3




Please read our Terms of Use
Microsoft, Windows, Windows XP, Windows 2003, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2008 NetAdminTools.com