2008/08/28

The Labs.Com Admin Lab MyLogger
Last update 2002/05/27
The Labs - Design & Functionality For The Net

The Logger to Watch your Server(s)

MyLogger is a small package to overview various system-activites of your server ranch. Right now it's only watching one system.
  1. Introduction
  2. Download
  3. Screenshots
  4. Installation
  5. Customizing
  6. TODO
MyLogger
1. Introduction
MyLogger is a small perl-script I wrote to have a 'one-view' of my system I work on, and a few servers we run.

MyLogger
2. Download

mylogger.tar.gz

$MyVersion: 0.046 - Mon May 27 17:23:59 CEST 2002 - kiwi$

$MyHistory$
	27 May 2002: 0.046: date fix .
	21 Oct 2001: 0.045: another fix with @_ = split() .
	12 Oct 2001: 0.043: fix in diverse diverse memory-leaks in perl: @_=split() .
	11 Oct 2001: 0.042: minor bug fix (.cgi gets now via arg) .
	16 Oct 2000: 0.041: further y-axis improvement .
	15 Oct 2000: 0.034: better y-axis .
	13 Oct 2000: 0.032: host=name in mylogger.conf .
	06 Oct 2000: 0.030: PNG support now too, refresh bug fix .
	29 Aug 1999: 0.028: netstat included .
	29 Aug 1999: 0.027: enforcing 10sec tick .
	29 Aug 1999: 0.026: more extensions .
	29 Aug 1999: 0.025: interruption also listed .
	28 Aug 1999: 0.024: more complex focusing possible .
	22 Aug 1999: 0.023: logs and cgi can be at different dirs .
	21 Aug 1999: 0.022: misc bug fixes .
	21 Aug 1999: 0.020: y-axis and zero-line fixed .
	20 Aug 1999: 0.019: multiple httpd-logfiles supported .
	20 Aug 1999: 0.018: automatic color-palette .
	13 Aug 1999: 0.016: more options to view overview .
	13 Aug 1999: 0.015: myloggerrc is now mylogger.conf .
	12 Aug 1999: 0.013: palette and body available in myloggerrc .
	12 Aug 1999: 0.012: fix weeky, month, and year overview .
	10 Aug 1999: 0.011: bug fix for weekly overiew .
	07 Aug 1999: 0.010: time-axis labeled .
	07 Aug 1999: 0.009: myloggerrc fully supported now .
	03 Aug 1999: 0.008: all graphs individually selectable .

MyLogger
3. Screenshots

The short interruptions on the screenshot-samples is due that my workstation (which the logger shows) isn't up and running 24hrs a day (unlike this server):


Overview

CPU detail

CPU detail 5mins average

MyLogger
4. Installation

  1. Make sure you have GD.pm (check GD-homepage)

  2. Edit mylogger.cgi if you have older GD.pm without PNG support

  3. Copy mylogger and mylogger.cgi to your web location under directory MyLogger.

     cd /home/httpd/; 
     mkdir MyLogger; cd MyLogger 
     tar zxvf mylogger.tar.gz 
     cp mylogger.conf.dist mylogger.conf 
     ln -s mylogger.cgi index.cgi 

  4. Go and edit /etc/rc.local (FreeBSD) or /etc/rc.d/rc.local (Linux) and add:

     echo "Starting MyLogger ..." 
     (cd /home/httpd/MyLogger; sh nobody -c "./mylogger &") 

  5. Start mylogger by hand:

     ./mylogger &  

  6. Start your browser http://some.machine.com/MyLogger/ and you are done.

MyLogger
5. Customizing

MyLogger is extensible using mylogger.conf file:

 cgi=./ 
 services=cpu,memory,httpd,ping,mail,disk,mydb 
  
 http_access_logs=/usr/local/apache/var/log/access_log,another-log-file 
 ping_hosts=some.reliable.host.com,anotherone.com 
 maillog=/path/to/your/Inbox_or_log_file 

Check the mylogger.conf for a sample configuration. You can also customize the page colors, and graph colors.

Supported devices and infos:

  • cpu: cpu-load
  • memory: memory usage (only for LINUX)
  • process: different processes (total, httpd etc)
  • disk: disk-usage of all partitions
  • httpd: httpd-requests (via access_log)
  • ping: network connectivity via ping
  • vmstat: virtual memory stat
  • user: logins (users)
  • netstat: log packets of div. net interfaces (ether,ppp,etc)
  • services: measures all services
In the directory devs/ are cpu.pm, memory.pm and so forth, each modules needs two methods:
  • init(): which should return an array with the name of the values.
    this function is called only once, used to initialize data
  • value(): returns an array of values (relative or absolute)
    this function is called every 10 secs, so program it efficiently

Let's say you have a CPU temperatur to log, make in devs/cpu_temp.pm and within mylogger.conf add at the line of services the string "cpu_temp":

 services=cpu,memory,httpd....,cpu_temp 

cpu_temp.pm requires two functions as mentioned above, init() and value():

 package cpu_temp; 
  
 sub init { 'Celsius'; } 
  
 sub value { 
    local($temp); 
    # --- gets temperature 
    $temp; 
 } 

Restart mylogger

 kill `cat mylogger.pid`; ./mylogger & 

That's it!

MyLogger
6. TODO

  • auto-configure for different UNIX flavors
  • more detailed y-axis
  • ...

                                                                                                                                   

MyVersion Admin LabQMail

Last update 2002/05/27

All Rights Reserved - (C) 1997 - 2008 by The Labs.Com

Top of Page

The Labs.Com