MRTG nasce per
Monitoring di ROUTER
Riesce a monitorare
qualsiasi contatore SNMP
Quindi anche la maggior
parte degli switch
“managed”
Ma anche computer
general purpose.
18 Ottobre 2000 CNAF
Michele Michelotto
MRTG nasce per
Monitoring di ROUTER
Riesce a monitorare
qualsiasi contatore SNMP
Quindi anche la maggior
parte degli switch
“managed”
Ma anche computer
general purpose.
18 Ottobre 2000 CNAF
Michele Michelotto
I log files
Ospd03.pd.infn.it> more garrb-16aal5.log
971780102 385491343 3262750497
971780102 108110 136510 108110 136510
971779202 82392 563641 82392 563641
971779200 82392 563641 82392 563641
971778900 82392 563641 82392 563641
971778600 82360 563533 82392 563641
971778300 72999 531482 72999 531482
971778000 72999 531482 72999 531482
971777700 72898 529309 72999 531482
971777400 57987 205656 57987 205656
971777100 57987 205656 57987 205656
Ultimo Valore
Valori recenti
..omissis..
971548200
971546400
971544600
971542800
971541000
971539200
971537400
11477
11948
14928
15044
19427
13598
15470
86393 15353 118439
89613 15353 118439
264001 17118 390472
201285 18408 390472
141293 27024 163605
66418 27024 163605
130078 16533 148518
18 Ottobre 2000 CNAF
Michele Michelotto
Valori mediati
File di configurazione
WorkDir: /d1/mrtg/html
ThreshDir: /d1/mrtg/thresh
Title[^]: Padova LAN - Monitoring with MRTG
PageTop[^]: <H1> INFN Padova LAN devices </H1><p>
WriteExpires: Yes
WithPeak[_]: ymw
#
# ospd00
#
PageTop[ospd00feth]: In and Out Octets on ospd00 Fast Ethernet
MaxBytes[ospd00feth]: 12500000
Target[ospd00feth]: ifInOctets.1&ifOutOctets.1:public@ospd00
#Unscaled[ospd00feth]: ymw
WithPeak[ospd00feth]: ymw
#
USO il nome abbreviato
18 Ottobre 2000 CNAF
Michele Michelotto
La temperatura del
nostro router CISCO
18 Ottobre 2000 CNAF
Michele Michelotto
File di configurazione
# Temperature
#
MaxBytes[pdags2.temp]: 100
Target[pdags2.temp]:
1.3.6.1.4.1.9.9.13.1.3.1.3.1&1.3.6.1.4.1.9.9.13.1.3.1.3.3:public@pdags2
PageTop[pdags2.temp]: <H1> Temperatura di pdags2 </H1>
Options[pdags2.temp]: gauge, noinfo, absolute, nopercent
ShortLegend[pdags2.temp]: &nbsp;&#176;C
YLegend[pdags2.temp]: Degree Celsius
Legend1[pdags2.temp]: inlet
Legend2[pdags2.temp]: outlet
Legend3[pdags2.temp]: max-inlet
Legend4[pdags2.temp]: max-outlet
LegendI[pdags2.temp]: inlet
LegendO[pdags2.temp]: outlet
WithPeak[pdags2.temp]: ym
ThreshMaxI[pdags2.temp]: 26
ThreshProgI[pdags2.temp]: /d1/mrtg/bin/threshold2.pl
ThreshProgOKI[pdags2.temp]: /d1/mrtg/bin/thresholdOK2.pl
Uso l’ OID
18 Ottobre 2000 CNAF
Michele Michelotto
File di configurazione
#
# User and Process
#
MaxBytes[ospd00.usr.proc]: 1000
Target[ospd00.usr.proc]: 1.3.6.1.2.1.25.1.5.0&1.3.6.1.2.1.25.1.6.0:public@ospd00
PageTop[ospd00.usr.proc]: <H1> User and Process on ospd00 </H1> <BR><H2><FONT
COLOR=blue>Current Users</FONT> and <FONT COLOR=red>Current Process</FONT><
/H2>
Options[ospd00.usr.proc]: gauge, noinfo, absolute, nopercent
ShortLegend[ospd00.usr.proc]: unit
YLegend[ospd00.usr.proc]: User and Process
#Colours[ospd00.usr.proc]: BLUE#1000FF,RED#FF0000,BLUE#1000FF,RED#FF0000
Legend1[ospd00.usr.proc]: users
Legend2[ospd00.usr.proc]: processes
Legend3[ospd00.usr.proc]: max users
Legend4[ospd00.usr.proc]: max processes
LegendI[ospd00.usr.proc]: Users
LegendO[ospd00.usr.proc]: Procs
WithPeak[ospd00.usr.proc]: ymwd
#
Uso l’ OID
18 Ottobre 2000 CNAF
Michele Michelotto
Lo spazio su disco
Non c’è un contatore
SNMP, si deve usare
uno script
18 Ottobre 2000 CNAF
Michele Michelotto
Monitor disco locale
# Spool Disk Usage on ospd03.
#
Target[spool.disk.alloc]: `/d1/mrtg/script/diskspace.sh /dev/rz2a`
Title[spool.disk.alloc]: Disk Usage /dev/rz2a (/var)
PageTop[spool.disk.alloc]: <H1> Disk Usage /dev/rz2a (/var)</H1>
Options[spool.disk.alloc]: gauge, nopercent
MaxBytes[spool.disk.alloc]:100
Unscaled[spool.disk.alloc]: dwmy
WithPeak[spool.disk.alloc]: dwmy
YLegend[spool.disk.alloc]: % Used
ShortLegend[spool.disk.alloc]: %
Legend1[spool.disk.alloc]: Avg Percent Diskspace Used
Legend2[spool.disk.alloc]: Avg Percent Inodes Used
LegendI[spool.disk.alloc]: Diskspace
LegendO[spool.disk.alloc]: Inodes
ThreshMaxI[spool.disk.alloc]: 65
ThreshProgI[spool.disk.alloc]: /d1/mrtg/bin/threshold2.pl
ThreshProgOKI[spool.disk.alloc]: /d1/mrtg/bin/thresholdOK2.pl
18 Ottobre 2000 CNAF
Michele Michelotto
Script per disco locale
!/bin/sh
# by Michele Michelotto 18 Aug 1999
# Get various diskspace numbers for MRTG.#
# This is the output format by df -k -i
# usage: diskspace.sh Filesystem
# i.e.
diskpace.sh /dev/rz2a
#
where /dev/rz2a is the filesys.
#
retch=`df -k -i $1 | tail -1 | tr -d %`
set $retch
# break apart into fields using IFS seperators
echo $5
# Percentage diskspace used
echo $8
# Percentage inodes used
18 Ottobre 2000 CNAF
Michele Michelotto
Threshold
!/usr/local/bin/perl
#
Called when MRTG detects a threshold problem for a variable.
#
ARGV[0] = Parameter name, such as 'mpclm1005.disk0'.
#
ARGV[1] = Threshold value which was breached, such as "95".
#
ARGV[2] = Actual current value of the parameter, such as "100".
#
Example: thisprogram mpclm1005 95 100
my($timestr, $param, $thresh, $value, $message, $logfile);
$timestr = localtime(time);
$param = $ARGV[0];
$thresh = $ARGV[1];
$value = $ARGV[2];
$logfile = "/tmp/mrtgthresh.log";
$emailprog = "/usr/bin/mailx -s 'MRTG Thresh of $param '";
$emailuser = "supporto\@pd.infn.it";
#
Do something meaningful with the information.
#
Send an email message, log to a file, execute some script...
if ($thresh > $value) { $abovebelow = "below"; }
else { $abovebelow = "above"; }
$message .= "$param ($value) is $abovebelow threshold ($thresh)";
# Log it.
open(LOG, ">>$logfile");
print LOG "$timestr $message\n";
close(LOG);
# Email it.
system("echo '$message' | $emailprog $emailuser");
exit(0);
18 Ottobre 2000 CNAF
Michele Michelotto
I mail entranti e
uscenti dal mail
server
18 Ottobre 2000 CNAF
Michele Michelotto
MailServer lo script
!/usr/local/bin/perl5
# this script relies on the sendmail.st file being activated.
# the data is called via mailstats that run out of inetd, on port 7256.
open (OLD,"</tmp/mailstat01.old") or die "can't open file!\n";
# read the old data
while (<OLD>) {
if ($. == "1") {
$count = $_;
}
($oldfrm, $oldto) = split (' ',$count);
}
close (OLD);
$remote = "ospd01";
$port = "7256";
$iaddr = inet_aton($remote) or die "no host: $remote";
$paddr = sockaddr_in($port, $iaddr);
$proto = getprotobyname ('tcp');
socket (SOCK, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
connect (SOCK, $paddr) or die "connect: $!";
18 Ottobre 2000 CNAF
Michele Michelotto
MailServer lo script continua
while (<SOCK>) {
if ($. == "5" ) {
$line = $_;
($a, $curfrm, $b, $curto, $c, $d) = split(' ',$line);
# do some sums
$msgsfrm = $curfrm - $oldfrm;
$msgsto = $curto - $oldto;
chomp $msgsfrm;
chomp $msgsto;
# open the old file for overwrite
open (OLD,">/tmp/mailstat01.old") or die "can't open file!\n";
# print the data for mrtg
print "$msgsfrm\n$msgsto\n1\nospd01\n";
# print the data to the old file
print OLD "$curfrm $curto\n";
} #endif
}
close (SOCK) or die "close: $!";
exit;
$!";
18 Ottobre 2000 CNAF
Michele Michelotto
Nell’albero di un linux
[michelot@pcferrari noi]$ snmpwalk lxde01 public .1.3.6.1.4.1.2021 | more
enterprises.ucdavis.memory.memIndex.0 = 0
enterprises.ucdavis.memory.memErrorName.0 = swap
enterprises.ucdavis.memory.memTotalSwap.0 = 770900
enterprises.ucdavis.memory.memAvailSwap.0 = 767484
enterprises.ucdavis.memory.memTotalReal.0 = 257728
enterprises.ucdavis.memory.memAvailReal.0 = 226200
enterprises.ucdavis.memory.memTotalFree.0 = 31528
enterprises.ucdavis.memory.memMinimumSwap.0 = 16000
enterprises.ucdavis.memory.memShared.0 = 21648
enterprises.ucdavis.memory.memBuffer.0 = 118108
enterprises.ucdavis.memory.memCached.0 = 68748
enterprises.ucdavis.memory.memSwapError.0 = 0
enterprises.ucdavis.memory.memSwapErrorMsg.0 =
18 Ottobre 2000 CNAF
Michele Michelotto
Nell’albero di un linux
enterprises.ucdavis.laTable.laEntry.laIndex.1 = 1
enterprises.ucdavis.laTable.laEntry.laIndex.2 = 2
enterprises.ucdavis.laTable.laEntry.laIndex.3 = 3
enterprises.ucdavis.laTable.laEntry.laNames.1 = Load-1
enterprises.ucdavis.laTable.laEntry.laNames.2 = Load-5
enterprises.ucdavis.laTable.laEntry.laNames.3 = Load-15
enterprises.ucdavis.laTable.laEntry.laLoad.1 = 0.36
enterprises.ucdavis.laTable.laEntry.laLoad.2 = 0.12
enterprises.ucdavis.laTable.laEntry.laLoad.3 = 0.03
enterprises.ucdavis.laTable.laEntry.laConfig.1 = 12.00
enterprises.ucdavis.laTable.laEntry.laConfig.2 = 12.00
enterprises.ucdavis.laTable.laEntry.laConfig.3 = 12.00
enterprises.ucdavis.laTable.laEntry.laLoadInt.1 = 35
enterprises.ucdavis.laTable.laEntry.laLoadInt.2 = 11
enterprises.ucdavis.laTable.laEntry.laLoadInt.3 = 2
enterprises.ucdavis.laTable.laEntry.laLoadFloat.1 = Opaque: Float: 0.360000
enterprises.ucdavis.laTable.laEntry.laLoadFloat.2 = Opaque: Float: 0.120000
enterprises.ucdavis.laTable.laEntry.laLoadFloat.3 = Opaque: Float: 0.030000
enterprises.ucdavis.laTable.laEntry.laErrorFlag.1 = 0
enterprises.ucdavis.laTable.laEntry.laErrorFlag.2 = 0
enterprises.ucdavis.laTable.laEntry.laErrorFlag.3 = 0
enterprises.ucdavis.laTable.laEntry.laErrMessage.1 =
enterprises.ucdavis.laTable.laEntry.laErrMessage.2 =
enterprises.ucdavis.laTable.laEntry.laErrMessage.3 =
18 Ottobre 2000 CNAF
Michele Michelotto
Nell’albero di un linux
enterprises.ucdavis.systemStats.ssIndex.1 = 1
enterprises.ucdavis.systemStats.ssErrorName.1 = systemStats
enterprises.ucdavis.systemStats.ssSwapIn.1 = 0
enterprises.ucdavis.systemStats.ssSwapOut.1 = 0
enterprises.ucdavis.systemStats.ssIOSent.1 = 0
enterprises.ucdavis.systemStats.ssIOReceive.1 = 1
enterprises.ucdavis.systemStats.ssSysInterrupts.1 = 13
enterprises.ucdavis.systemStats.ssSysContext.1 = 15
enterprises.ucdavis.systemStats.ssCpuUser.1 = 0
enterprises.ucdavis.systemStats.ssCpuSystem.1 = 0
enterprises.ucdavis.systemStats.ssCpuIdle.1 = 14
enterprises.ucdavis.version.versionIndex.0 = 1
enterprises.ucdavis.version.versionTag.0 = 4.0.1
enterprises.ucdavis.version.versionDate.0 = $Date: 1999/08/18 09:51:57 $
enterprises.ucdavis.version.versionCDate.0 = Tue Oct 17 12:51:03 2000
18 Ottobre 2000 CNAF
Michele Michelotto
La Farm di
Delphi/CMS
Uso della CPU
18 Ottobre 2000 CNAF
Michele Michelotto
La Farm di
Delphi/CMS
System CPU
User CPU
18 Ottobre 2000 CNAF
Michele Michelotto
La Farm di
Delphi/CMS
Interrupt
Context Switch
18 Ottobre 2000 CNAF
Michele Michelotto
La Farm di
Delphi/CMS
IO Sent
IO Received
18 Ottobre 2000 CNAF
Michele Michelotto
La Farm di
Delphi/CMS
Real Memory
Free Memory
18 Ottobre 2000 CNAF
Michele Michelotto
Penso sia usato anche nella farm di D.G.O.
18 Ottobre 2000 CNAF
Michele Michelotto
Possibili uso in WP2.4
Monitor di variabili SNMP in una farm Linux
Script per chiedere via socket/inetd altri valori non SNMP
Modifiche a SNMP su Linux per inserire nuove variabili
Uso di RRD e front-end grafici separati
con RRD separo la fase di acquisizione
da quella di visualizzazione (on demand)
18 Ottobre 2000 CNAF
Michele Michelotto
18 Ottobre 2000 CNAF
Michele Michelotto
Scarica

WP24_MRTG_PD