$sudo apt-get install mrtg mrtgutils
$sudo nano /etc/mrtg.cfg
######################################################################
# Multi Router Traffic Grapher -- Sample Configuration File
######################################################################
# Global configuration
# Global Config Options
#-----------------------------
WorkDir: /data/webs/default/mrtg/
EnableIPv6: no
XSize[_]: 380
# System: Load
#-----------------------------
Target[system-load]: `/usr/bin/mrtg-load -m 200`
Title[system-load]: System Load
PageTop[system-load]: <H1>System Load</H1>
MaxBytes[system-load]: 200
Options[system-load]: unknaszero gauge
ShortLegend[system-load]:
YLegend[system-load]: 200x Load
#---------Memory--------------------
Target[mem]: `bash /usr/local/bin/mrtg/mem`
Options[mem]: nopercent,gauge,noinfo, nobanner
Unscaled[mem]:dwmy
MaxBytes[mem]: 3630060000
Kilo[mem]:1024
YLegend[mem]: RAM
ShortLegend[mem]: o
Legend1[mem]: Memory free
Legend2[mem]: Memory used
LegendI[mem]: Memory free:
LegendO[mem]: Memory used:
Title[mem]: Memory
PageTop[mem]: <h1>Memory</h1>
WithPeak[mem]:wmy
Legend3[mem]: Memory free max
Legend4[mem]: Memory used max
#--------end Memory-----------------------------
# Net: eth0
#-----------------------------
Target[eth0]: `/usr/bin/mrtg-ip-acct eth0`
Title[eth0]: Traffic Analysis for eth0 (LAN)
PageTop[eth0]: <H1>Traffic Analysis for eth0 (LAN)</H1>
MaxBytes[eth0]: 12500000
kilo[eth0]: 1024
kMG[eth0]: ,K,M,G,T,P
Options[eth0]: unknaszero
# Net: eth1
#-----------------------------
Target[eth1]: `/usr/bin/mrtg-ip-acct eth1`
Title[eth1]: Traffic Analysis for eth1 (LAN)
PageTop[eth1]: <H1>Traffic Analysis for eth1 (LAN)</H1>
MaxBytes[eth1]: 12500000
kilo[eth1]: 1024
kMG[eth1]: ,K,M,G,T,P
Options[eth1]: unknaszero
# Net: mysql
#-----------------------------
Target[mysql]: `perl /usr/local/bin/mrtg/mrtg-mysql-load -u pam -p ipfguefdF84SA -h localhost`
Options[mysql]: perminute, nopercent, integer
MaxBytes[mysql]: 200
AbsMax[mysql]: 20000
Unscaled[mysql]: dwmy
Title[mysql]: MySQL load analysis
PageTop[mysql]: <H1>MySQL LOAD ANALYSIS</H1>
YLegend[mysql]: # of Questions
ShortLegend[mysql]: q/m
Legend1[mysql]: # of Questions
Legend2[mysql]: # of Slow queries
Legend3[mysql]: Maximal # of Questions per min.
Legend4[mysql]: Maximal # of Slow queries per min.
LegendI[mysql]: # of Questions:
LegendO[mysql]: # of Slow queries:
#---------Apache hits-----------------------
Target[apache]: `perl /usr/local/bin/mrtg/webstat.pl hits`
Options[apache]: unknaszero, perhour, nopercent, noinfo, nobanner, noi
MaxBytes[apache]: 1000000
YLegend[apache]: hits/hour
ShortLegend[apache]: per hour
LegendO[apache]: Hits:
Legend2[apache]: Hits hourly
Legend4[apache]: Hits hourly max
Title[apache]: Hits hourly Apache
PageTop[apache]: <H1>Apache HITS</H1>
WithPeak[apache]: wmy
#------------End Apache Hits------------------
#---------Apache traffic-----------------------
Target[apache_bytes]: `perl /usr/local/bin/mrtg/webstat.pl bytes`
Options[apache_bytes]: unknaszero, nopercent, noinfo, nobanner, noi
MaxBytes[apache_bytes]:16000
AbsMax[apache_bytes]:20000
YLegend[apache_bytes]: bytes/s
ShortLegend[apache_bytes]: b/s
LegendO[apache_bytes]: Traffic Apache:
Legend2[apache_bytes]: Traffic Apache
Title[apache_bytes]: Traffic server Apache
PageTop[apache_bytes]: <H1>Apache TRAFFIC</H1>
WithPeak[apache_bytes]: wmy
Legend4[apache_bytes]: Traffic max Apache
#------------End Apache Traffic------------------
#---------Apache Busy workers-----------------------
Target[apache_workers]: `perl /usr/local/bin/mrtg/webstat.pl workers`
Options[apache_workers]: unknaszero, perhour, nopercent, noinfo, nobanner, noi
MaxBytes[apache_workers]: 1000000
YLegend[apache_workers]: workers/hour
ShortLegend[apache_workers]: per hour
LegendO[apache_workers]: Workers:
Legend2[apache_workers]: Workers hoyrly
Legend4[apache_workers]: Workers Hourly max
Title[apache_workers]: Workers hourly Apache
PageTop[apache_workers]: <H1>Apache Workers</H1>
WithPeak[apache_workers]: wmy
#------------End Apache Traffic------------------
# Disk: sda
#-----------------------------
Target[sda]: `/usr/local/bin/mrtg/mrtg-disk-io sda 512`
Title[sda]: Traffic Analysis for disk sdA -raid 1
PageTop[sda]: <H1>Traffic Analysis for disk sdA -raid 1</H1>
MaxBytes[sda]: 100000000000
kilo[sda]: 1024
kMG[sda]: ,K,M,G,T,P
Options[sda]: unknaszero
# Disk: sdb
#-----------------------------
Target[sdb]: `/usr/local/bin/mrtg/mrtg-disk-io sdb 512`
Title[sdb]: Traffic Analysis for disk sdB -raid 1
PageTop[sdb]: <H1>Traffic Analysis for disk sdB -raid 1</H1>
MaxBytes[sdb]: 100000000000
kilo[sdb]: 1024
kMG[sdb]: ,K,M,G,T,P
Options[sdb]: unknaszero
#---------Espace libre disk md0--------------------
Target[md0]: `bash /usr/local/bin/mrtg/checkdisk md0`
Options[md0]: nopercent,gauge,noinfo, nobanner
MaxBytes[md0]:476774
Unscaled[md0]:dwmy
kMG[md0]:M,G,T,P
YLegend[md0]: GBites
ShortLegend[md0]: B
Kilo[md0]:1024
Legend1[md0]: Space free
Legend2[md0]: Space used
LegendI[md0]: Space free :
LegendO[md0]: Space used:
Title[md0]: Space on disk sda
PageTop[md0]: <h1>Space on disk md0</h1>
#--------end disk md0-----------------------------
#--------------Number of processes----------------
Target[procs]: `perl /usr/local/bin/mrtg/stat.pl procs`
Options[procs]: nopercent,gauge,noinfo, nobanner, noi
Title[procs]: Process
MaxBytes[procs]: 1000000
YLegend[procs]: Process
ShortLegend[procs]: procs
LegendO[procs]: Procs:
Legend2[procs]: Number of process
PageTop[procs]: <h1>Process</h1>
WithPeak[procs]:wmy
Legend4[procs]: Number max process
#------------End number of processes------------------
#--------------Number of links----------------
Target[tcp_links]: `/usr/local/bin/mrtg/tcpcount`
Options[tcp_links]: nopercent,gauge,noinfo, nobanner, noi
Title[tcp_links]: Links
MaxBytes[tcp_links]: 1000000
YLegend[tcp_links]: Links
ShortLegend[tcp_links]: links
LegendO[tcp_links]: Links:
Legend2[tcp_links]: Number of TCP links
PageTop[tcp_links]: <h1>TCP Links</h1>
WithPeak[tcp_links]:wmy
Legend4[tcp_links]: Number max TCP links
#------------End number of processes------------------
# Sensors: CPU Temp
#-----------------------------
Target[sensors-temp]: `sleep 2 ; /usr/bin/mrtg-sensors lm85-i2c-0-2e 'CPU Temp' lm85-i2c-0-2e 'CPU Temp'`
Title[sensors-temp]: CPU Temperature
PageTop[sensors-temp]: <H1>CPU Temperature</H1>
MaxBytes[sensors-temp]: 200
Options[sensors-temp]: unknaszero gauge
ShortLegend[sensors-temp]: C
YLegend[sensors-temp]: Temperature
# Sensors: CPU Fan
#-----------------------------
Target[sensors-fan]: `/usr/bin/mrtg-sensors lm85-i2c-0-2e 'fan2' lm85-i2c-0-2e 'fan2'`
Title[sensors-fan]: CPU Fan speed
PageTop[sensors-fan]: <H1>CPU Fan speed</H1>
MaxBytes[sensors-fan]: 8000
Options[sensors-fan]: unknaszero gauge
ShortLegend[sensors-fan]: RPM
YLegend[sensors-fan]: Rotat. per min.
Unscaled[sensors-fan]: dwmy
#---------uptime---------------------------
Target[uptime]: `perl /usr/local/bin/mrtg/uptime.pl`
Suppress[uptime]: d
Options[uptime]: gauge,noinfo, nopercent, nobanner, noi
Title[uptime]: Uptime
MaxBytes[uptime]: 1000000
YLegend[uptime]: hours
ShortLegend[uptime]: hours
LegendO[uptime]: Uptime:
Legend2[uptime]: Uptime hours Linux-start
PageTop[uptime]: <h1>Uptime - Linux-start</h1>
WithPeak[uptime]:wmy
#-------End uptime------------------------------
FILES
checkdisk
#!/bin/sh
df="/bin/df"
cut="/usr/bin/cut"
grep="/bin/grep"
part=$1
line=`$df -m -x nfs| grep "$part"`
libre=`echo $line|$cut -d" " -f 4`
utilise=`echo $line|$cut -d" " -f 3`
echo $libre
echo $utilise
$sudo nano /etc/mrtg.cfg
######################################################################
# Multi Router Traffic Grapher -- Sample Configuration File
######################################################################
# Global configuration
# Global Config Options
#-----------------------------
WorkDir: /data/webs/default/mrtg/
EnableIPv6: no
XSize[_]: 380
# System: Load
#-----------------------------
Target[system-load]: `/usr/bin/mrtg-load -m 200`
Title[system-load]: System Load
PageTop[system-load]: <H1>System Load</H1>
MaxBytes[system-load]: 200
Options[system-load]: unknaszero gauge
ShortLegend[system-load]:
YLegend[system-load]: 200x Load
#---------Memory--------------------
Target[mem]: `bash /usr/local/bin/mrtg/mem`
Options[mem]: nopercent,gauge,noinfo, nobanner
Unscaled[mem]:dwmy
MaxBytes[mem]: 3630060000
Kilo[mem]:1024
YLegend[mem]: RAM
ShortLegend[mem]: o
Legend1[mem]: Memory free
Legend2[mem]: Memory used
LegendI[mem]: Memory free:
LegendO[mem]: Memory used:
Title[mem]: Memory
PageTop[mem]: <h1>Memory</h1>
WithPeak[mem]:wmy
Legend3[mem]: Memory free max
Legend4[mem]: Memory used max
#--------end Memory-----------------------------
# Net: eth0
#-----------------------------
Target[eth0]: `/usr/bin/mrtg-ip-acct eth0`
Title[eth0]: Traffic Analysis for eth0 (LAN)
PageTop[eth0]: <H1>Traffic Analysis for eth0 (LAN)</H1>
MaxBytes[eth0]: 12500000
kilo[eth0]: 1024
kMG[eth0]: ,K,M,G,T,P
Options[eth0]: unknaszero
# Net: eth1
#-----------------------------
Target[eth1]: `/usr/bin/mrtg-ip-acct eth1`
Title[eth1]: Traffic Analysis for eth1 (LAN)
PageTop[eth1]: <H1>Traffic Analysis for eth1 (LAN)</H1>
MaxBytes[eth1]: 12500000
kilo[eth1]: 1024
kMG[eth1]: ,K,M,G,T,P
Options[eth1]: unknaszero
# Net: mysql
#-----------------------------
Target[mysql]: `perl /usr/local/bin/mrtg/mrtg-mysql-load -u pam -p ipfguefdF84SA -h localhost`
Options[mysql]: perminute, nopercent, integer
MaxBytes[mysql]: 200
AbsMax[mysql]: 20000
Unscaled[mysql]: dwmy
Title[mysql]: MySQL load analysis
PageTop[mysql]: <H1>MySQL LOAD ANALYSIS</H1>
YLegend[mysql]: # of Questions
ShortLegend[mysql]: q/m
Legend1[mysql]: # of Questions
Legend2[mysql]: # of Slow queries
Legend3[mysql]: Maximal # of Questions per min.
Legend4[mysql]: Maximal # of Slow queries per min.
LegendI[mysql]: # of Questions:
LegendO[mysql]: # of Slow queries:
#---------Apache hits-----------------------
Target[apache]: `perl /usr/local/bin/mrtg/webstat.pl hits`
Options[apache]: unknaszero, perhour, nopercent, noinfo, nobanner, noi
MaxBytes[apache]: 1000000
YLegend[apache]: hits/hour
ShortLegend[apache]: per hour
LegendO[apache]: Hits:
Legend2[apache]: Hits hourly
Legend4[apache]: Hits hourly max
Title[apache]: Hits hourly Apache
PageTop[apache]: <H1>Apache HITS</H1>
WithPeak[apache]: wmy
#------------End Apache Hits------------------
#---------Apache traffic-----------------------
Target[apache_bytes]: `perl /usr/local/bin/mrtg/webstat.pl bytes`
Options[apache_bytes]: unknaszero, nopercent, noinfo, nobanner, noi
MaxBytes[apache_bytes]:16000
AbsMax[apache_bytes]:20000
YLegend[apache_bytes]: bytes/s
ShortLegend[apache_bytes]: b/s
LegendO[apache_bytes]: Traffic Apache:
Legend2[apache_bytes]: Traffic Apache
Title[apache_bytes]: Traffic server Apache
PageTop[apache_bytes]: <H1>Apache TRAFFIC</H1>
WithPeak[apache_bytes]: wmy
Legend4[apache_bytes]: Traffic max Apache
#------------End Apache Traffic------------------
#---------Apache Busy workers-----------------------
Target[apache_workers]: `perl /usr/local/bin/mrtg/webstat.pl workers`
Options[apache_workers]: unknaszero, perhour, nopercent, noinfo, nobanner, noi
MaxBytes[apache_workers]: 1000000
YLegend[apache_workers]: workers/hour
ShortLegend[apache_workers]: per hour
LegendO[apache_workers]: Workers:
Legend2[apache_workers]: Workers hoyrly
Legend4[apache_workers]: Workers Hourly max
Title[apache_workers]: Workers hourly Apache
PageTop[apache_workers]: <H1>Apache Workers</H1>
WithPeak[apache_workers]: wmy
#------------End Apache Traffic------------------
# Disk: sda
#-----------------------------
Target[sda]: `/usr/local/bin/mrtg/mrtg-disk-io sda 512`
Title[sda]: Traffic Analysis for disk sdA -raid 1
PageTop[sda]: <H1>Traffic Analysis for disk sdA -raid 1</H1>
MaxBytes[sda]: 100000000000
kilo[sda]: 1024
kMG[sda]: ,K,M,G,T,P
Options[sda]: unknaszero
# Disk: sdb
#-----------------------------
Target[sdb]: `/usr/local/bin/mrtg/mrtg-disk-io sdb 512`
Title[sdb]: Traffic Analysis for disk sdB -raid 1
PageTop[sdb]: <H1>Traffic Analysis for disk sdB -raid 1</H1>
MaxBytes[sdb]: 100000000000
kilo[sdb]: 1024
kMG[sdb]: ,K,M,G,T,P
Options[sdb]: unknaszero
#---------Espace libre disk md0--------------------
Target[md0]: `bash /usr/local/bin/mrtg/checkdisk md0`
Options[md0]: nopercent,gauge,noinfo, nobanner
MaxBytes[md0]:476774
Unscaled[md0]:dwmy
kMG[md0]:M,G,T,P
YLegend[md0]: GBites
ShortLegend[md0]: B
Kilo[md0]:1024
Legend1[md0]: Space free
Legend2[md0]: Space used
LegendI[md0]: Space free :
LegendO[md0]: Space used:
Title[md0]: Space on disk sda
PageTop[md0]: <h1>Space on disk md0</h1>
#--------end disk md0-----------------------------
#--------------Number of processes----------------
Target[procs]: `perl /usr/local/bin/mrtg/stat.pl procs`
Options[procs]: nopercent,gauge,noinfo, nobanner, noi
Title[procs]: Process
MaxBytes[procs]: 1000000
YLegend[procs]: Process
ShortLegend[procs]: procs
LegendO[procs]: Procs:
Legend2[procs]: Number of process
PageTop[procs]: <h1>Process</h1>
WithPeak[procs]:wmy
Legend4[procs]: Number max process
#------------End number of processes------------------
#--------------Number of links----------------
Target[tcp_links]: `/usr/local/bin/mrtg/tcpcount`
Options[tcp_links]: nopercent,gauge,noinfo, nobanner, noi
Title[tcp_links]: Links
MaxBytes[tcp_links]: 1000000
YLegend[tcp_links]: Links
ShortLegend[tcp_links]: links
LegendO[tcp_links]: Links:
Legend2[tcp_links]: Number of TCP links
PageTop[tcp_links]: <h1>TCP Links</h1>
WithPeak[tcp_links]:wmy
Legend4[tcp_links]: Number max TCP links
#------------End number of processes------------------
# Sensors: CPU Temp
#-----------------------------
Target[sensors-temp]: `sleep 2 ; /usr/bin/mrtg-sensors lm85-i2c-0-2e 'CPU Temp' lm85-i2c-0-2e 'CPU Temp'`
Title[sensors-temp]: CPU Temperature
PageTop[sensors-temp]: <H1>CPU Temperature</H1>
MaxBytes[sensors-temp]: 200
Options[sensors-temp]: unknaszero gauge
ShortLegend[sensors-temp]: C
YLegend[sensors-temp]: Temperature
# Sensors: CPU Fan
#-----------------------------
Target[sensors-fan]: `/usr/bin/mrtg-sensors lm85-i2c-0-2e 'fan2' lm85-i2c-0-2e 'fan2'`
Title[sensors-fan]: CPU Fan speed
PageTop[sensors-fan]: <H1>CPU Fan speed</H1>
MaxBytes[sensors-fan]: 8000
Options[sensors-fan]: unknaszero gauge
ShortLegend[sensors-fan]: RPM
YLegend[sensors-fan]: Rotat. per min.
Unscaled[sensors-fan]: dwmy
#---------uptime---------------------------
Target[uptime]: `perl /usr/local/bin/mrtg/uptime.pl`
Suppress[uptime]: d
Options[uptime]: gauge,noinfo, nopercent, nobanner, noi
Title[uptime]: Uptime
MaxBytes[uptime]: 1000000
YLegend[uptime]: hours
ShortLegend[uptime]: hours
LegendO[uptime]: Uptime:
Legend2[uptime]: Uptime hours Linux-start
PageTop[uptime]: <h1>Uptime - Linux-start</h1>
WithPeak[uptime]:wmy
#-------End uptime------------------------------
FILES
checkdisk
#!/bin/sh
df="/bin/df"
cut="/usr/bin/cut"
grep="/bin/grep"
part=$1
line=`$df -m -x nfs| grep "$part"`
libre=`echo $line|$cut -d" " -f 4`
utilise=`echo $line|$cut -d" " -f 3`
echo $libre
echo $utilise
mem
#!/bin/sh
# Thierry Nkaoua tnkaoua@yahoo.fr
USED=`free -b|grep cache:|cut -d ":" -f2|cut -c1-11`
FREE=`free -b|grep cache:|cut -d ":" -f2|cut -c12-22`
echo $FREE
echo $USED
No comments:
Post a Comment