MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

25
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.

description

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. MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP - PowerPoint PPT Presentation

Transcript of MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

Page 1: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

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.

Page 2: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

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.

Page 3: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

I log filesOspd03.pd.infn.it> more garrb-16aal5.log971780102 385491343 3262750497971780102 108110 136510 108110 136510971779202 82392 563641 82392 563641971779200 82392 563641 82392 563641971778900 82392 563641 82392 563641971778600 82360 563533 82392 563641971778300 72999 531482 72999 531482971778000 72999 531482 72999 531482971777700 72898 529309 72999 531482971777400 57987 205656 57987 205656971777100 57987 205656 57987 205656

..omissis..

971548200 11477 86393 15353 118439971546400 11948 89613 15353 118439971544600 14928 264001 17118 390472971542800 15044 201285 18408 390472971541000 19427 141293 27024 163605971539200 13598 66418 27024 163605971537400 15470 130078 16533 148518

Ultimo Valore

Valori recenti

Valori mediati

Page 4: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

File di configurazioneWorkDir: /d1/mrtg/htmlThreshDir: /d1/mrtg/threshTitle[^]: Padova LAN - Monitoring with MRTGPageTop[^]: <H1> INFN Padova LAN devices </H1><p>WriteExpires: YesWithPeak[_]: ymw## ospd00#PageTop[ospd00feth]: In and Out Octets on ospd00 Fast EthernetMaxBytes[ospd00feth]: 12500000Target[ospd00feth]: ifInOctets.1&ifOutOctets.1:public@ospd00#Unscaled[ospd00feth]: ymwWithPeak[ospd00feth]: ymw#

USO il nome abbreviato

Page 5: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

La temperatura del nostro router CISCO

Page 6: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

File di configurazione# Temperature#MaxBytes[pdags2.temp]: 100Target[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@pdags2PageTop[pdags2.temp]: <H1> Temperatura di pdags2 </H1>Options[pdags2.temp]: gauge, noinfo, absolute, nopercentShortLegend[pdags2.temp]: &nbsp;&#176;CYLegend[pdags2.temp]: Degree CelsiusLegend1[pdags2.temp]: inletLegend2[pdags2.temp]: outletLegend3[pdags2.temp]: max-inletLegend4[pdags2.temp]: max-outletLegendI[pdags2.temp]: inletLegendO[pdags2.temp]: outletWithPeak[pdags2.temp]: ymThreshMaxI[pdags2.temp]: 26ThreshProgI[pdags2.temp]: /d1/mrtg/bin/threshold2.plThreshProgOKI[pdags2.temp]: /d1/mrtg/bin/thresholdOK2.pl

Uso l’ OID

Page 7: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

File di configurazione## User and Process#MaxBytes[ospd00.usr.proc]: 1000Target[ospd00.usr.proc]: 1.3.6.1.2.1.25.1.5.0&1.3.6.1.2.1.25.1.6.0:public@ospd00PageTop[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, nopercentShortLegend[ospd00.usr.proc]: unitYLegend[ospd00.usr.proc]: User and Process#Colours[ospd00.usr.proc]: BLUE#1000FF,RED#FF0000,BLUE#1000FF,RED#FF0000Legend1[ospd00.usr.proc]: usersLegend2[ospd00.usr.proc]: processesLegend3[ospd00.usr.proc]: max usersLegend4[ospd00.usr.proc]: max processesLegendI[ospd00.usr.proc]: UsersLegendO[ospd00.usr.proc]: ProcsWithPeak[ospd00.usr.proc]: ymwd#

Uso l’ OID

Page 8: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

Lo spazio su disco

Non c’è un contatore SNMP, si deve usare uno script

Page 9: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

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, nopercentMaxBytes[spool.disk.alloc]:100Unscaled[spool.disk.alloc]: dwmyWithPeak[spool.disk.alloc]: dwmyYLegend[spool.disk.alloc]: % UsedShortLegend[spool.disk.alloc]: %Legend1[spool.disk.alloc]: Avg Percent Diskspace UsedLegend2[spool.disk.alloc]: Avg Percent Inodes UsedLegendI[spool.disk.alloc]: DiskspaceLegendO[spool.disk.alloc]: InodesThreshMaxI[spool.disk.alloc]: 65ThreshProgI[spool.disk.alloc]: /d1/mrtg/bin/threshold2.plThreshProgOKI[spool.disk.alloc]: /d1/mrtg/bin/thresholdOK2.pl

Page 10: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

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 seperatorsecho $5 # Percentage diskspace usedecho $8 # Percentage inodes used

Page 11: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

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 100my($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);

Page 12: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

I mail entranti e uscenti dal mail server

Page 13: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

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 datawhile (<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: $!";

Page 14: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

MailServer lo script continuawhile (<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 overwriteopen (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;$!";

Page 15: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

Nell’albero di un linux[michelot@pcferrari noi]$ snmpwalk lxde01 public .1.3.6.1.4.1.2021 | moreenterprises.ucdavis.memory.memIndex.0 = 0enterprises.ucdavis.memory.memErrorName.0 = swapenterprises.ucdavis.memory.memTotalSwap.0 = 770900enterprises.ucdavis.memory.memAvailSwap.0 = 767484enterprises.ucdavis.memory.memTotalReal.0 = 257728enterprises.ucdavis.memory.memAvailReal.0 = 226200enterprises.ucdavis.memory.memTotalFree.0 = 31528enterprises.ucdavis.memory.memMinimumSwap.0 = 16000enterprises.ucdavis.memory.memShared.0 = 21648enterprises.ucdavis.memory.memBuffer.0 = 118108enterprises.ucdavis.memory.memCached.0 = 68748enterprises.ucdavis.memory.memSwapError.0 = 0enterprises.ucdavis.memory.memSwapErrorMsg.0 =

Page 16: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

Nell’albero di un linuxenterprises.ucdavis.laTable.laEntry.laIndex.1 = 1enterprises.ucdavis.laTable.laEntry.laIndex.2 = 2enterprises.ucdavis.laTable.laEntry.laIndex.3 = 3enterprises.ucdavis.laTable.laEntry.laNames.1 = Load-1enterprises.ucdavis.laTable.laEntry.laNames.2 = Load-5enterprises.ucdavis.laTable.laEntry.laNames.3 = Load-15enterprises.ucdavis.laTable.laEntry.laLoad.1 = 0.36enterprises.ucdavis.laTable.laEntry.laLoad.2 = 0.12enterprises.ucdavis.laTable.laEntry.laLoad.3 = 0.03enterprises.ucdavis.laTable.laEntry.laConfig.1 = 12.00enterprises.ucdavis.laTable.laEntry.laConfig.2 = 12.00enterprises.ucdavis.laTable.laEntry.laConfig.3 = 12.00enterprises.ucdavis.laTable.laEntry.laLoadInt.1 = 35enterprises.ucdavis.laTable.laEntry.laLoadInt.2 = 11enterprises.ucdavis.laTable.laEntry.laLoadInt.3 = 2enterprises.ucdavis.laTable.laEntry.laLoadFloat.1 = Opaque: Float: 0.360000enterprises.ucdavis.laTable.laEntry.laLoadFloat.2 = Opaque: Float: 0.120000enterprises.ucdavis.laTable.laEntry.laLoadFloat.3 = Opaque: Float: 0.030000enterprises.ucdavis.laTable.laEntry.laErrorFlag.1 = 0enterprises.ucdavis.laTable.laEntry.laErrorFlag.2 = 0enterprises.ucdavis.laTable.laEntry.laErrorFlag.3 = 0enterprises.ucdavis.laTable.laEntry.laErrMessage.1 = enterprises.ucdavis.laTable.laEntry.laErrMessage.2 = enterprises.ucdavis.laTable.laEntry.laErrMessage.3 =

Page 17: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

Nell’albero di un linuxenterprises.ucdavis.systemStats.ssIndex.1 = 1enterprises.ucdavis.systemStats.ssErrorName.1 = systemStatsenterprises.ucdavis.systemStats.ssSwapIn.1 = 0enterprises.ucdavis.systemStats.ssSwapOut.1 = 0enterprises.ucdavis.systemStats.ssIOSent.1 = 0enterprises.ucdavis.systemStats.ssIOReceive.1 = 1enterprises.ucdavis.systemStats.ssSysInterrupts.1 = 13enterprises.ucdavis.systemStats.ssSysContext.1 = 15enterprises.ucdavis.systemStats.ssCpuUser.1 = 0enterprises.ucdavis.systemStats.ssCpuSystem.1 = 0enterprises.ucdavis.systemStats.ssCpuIdle.1 = 14enterprises.ucdavis.version.versionIndex.0 = 1enterprises.ucdavis.version.versionTag.0 = 4.0.1enterprises.ucdavis.version.versionDate.0 = $Date: 1999/08/18 09:51:57 $enterprises.ucdavis.version.versionCDate.0 = Tue Oct 17 12:51:03 2000

Page 18: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

La Farm di Delphi/CMS

Uso della CPU

Page 19: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

La Farm di Delphi/CMS

System CPUUser CPU

Page 20: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

La Farm di Delphi/CMS

InterruptContext Switch

Page 21: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

La Farm di Delphi/CMS

IO SentIO Received

Page 22: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

La Farm di Delphi/CMS

Real MemoryFree Memory

Page 23: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

Penso sia usato anche nella farm di D.G.O.

Page 24: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto

Possibili uso in WP2.4

Monitor di variabili SNMP in una farm LinuxScript per chiedere via socket/inetd altri valori non SNMPModifiche a SNMP su Linux per inserire nuove variabiliUso di RRD e front-end grafici separati

con RRD separo la fase di acquisizioneda quella di visualizzazione (on demand)

Page 25: MRTG nasce per Monitoring di ROUTER Riesce a monitorare qualsiasi contatore SNMP

18 Ottobre 2000 CNAF Michele Michelotto