Freifunk-Gateway aufsetzen/Statistik/mrtg: Unterschied zwischen den Versionen
Aus Freifunk Franken
RedDog (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „snmpd und mrtg installieren. /etc/snmp/snmpd.conf: Zugriff ändern: <pre> agentAddress udp:localhost:161,udp6:[::1]:161 rocommunity public 127.0.0.1 </pre>…“) |
RedDog (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
snmpd und mrtg installieren. | snmpd und mrtg installieren. | ||
/etc/snmp/snmpd.conf: | /etc/snmp/snmpd.conf: systemonly auskommentiert | ||
<pre> | <pre> | ||
rocommunity public default #-V systemonly | |||
rocommunity6 public default #-V systemonly | |||
</pre> | </pre> | ||
Zeile 12: | Zeile 11: | ||
Die mrtg CPU Config neu anlegen: | Die mrtg CPU Config neu anlegen: | ||
<pre> | <pre> | ||
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt | |||
WorkDir: /var/www/mrtg | WorkDir: /var/www/mrtg | ||
Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@127.0.0.1 + ssCpuRawSystem.0&ssCpuRawSystem.0:public@127.0.0.1 + ssCpuRawNice.0&ssCpuRawNice.0:public@127.0.0.1 | Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@127.0.0.1 + ssCpuRawSystem.0&ssCpuRawSystem.0:public@127.0.0.1 + ssCpuRawNice.0&ssCpuRawNice.0:public@127.0.0.1 | ||
RouterUptime[localhost.cpu]: public@127.0.0.1 | RouterUptime[localhost.cpu]: public@127.0.0.1 | ||
MaxBytes[localhost.cpu]: 100 | MaxBytes[localhost.cpu]: 100 | ||
Title[localhost.cpu]: CPU Load | Title[localhost.cpu]: CPU Load | ||
PageTop[localhost.cpu]: < | PageTop[localhost.cpu]: <h1>Active CPU Load %</h1> | ||
Unscaled[localhost.cpu]: ymwd | Unscaled[localhost.cpu]: ymwd | ||
ShortLegend[localhost.cpu]: % | ShortLegend[localhost.cpu]: % | ||
Zeile 100: | Zeile 99: | ||
<pre> | <pre> | ||
*/5 * * * * perl /etc/olsrd/dotDraw.pl > /dev/null 2>&1 | */5 * * * * perl /etc/olsrd/dotDraw.pl > /dev/null 2>&1 | ||
*/1 * * * * /usr/bin/mrtg /etc/mrtg/cpu.cfg > /dev/null 2>&1 | */1 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/cpu.cfg > /dev/null 2>&1 | ||
*/1 * * * * /usr/bin/mrtg /etc/mrtg/traffic.cfg > /dev/null 2>&1 | */1 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/traffic.cfg > /dev/null 2>&1 | ||
</pre> | </pre> |
Version vom 12. September 2015, 22:08 Uhr
snmpd und mrtg installieren.
/etc/snmp/snmpd.conf: systemonly auskommentiert
rocommunity public default #-V systemonly rocommunity6 public default #-V systemonly
snmpd restarten.
Die mrtg CPU Config neu anlegen:
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt WorkDir: /var/www/mrtg Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@127.0.0.1 + ssCpuRawSystem.0&ssCpuRawSystem.0:public@127.0.0.1 + ssCpuRawNice.0&ssCpuRawNice.0:public@127.0.0.1 RouterUptime[localhost.cpu]: public@127.0.0.1 MaxBytes[localhost.cpu]: 100 Title[localhost.cpu]: CPU Load PageTop[localhost.cpu]: <h1>Active CPU Load %</h1> Unscaled[localhost.cpu]: ymwd ShortLegend[localhost.cpu]: % YLegend[localhost.cpu]: CPU Utilization Legend1[localhost.cpu]: Active CPU in % (Load) Legend2[localhost.cpu]: Legend3[localhost.cpu]: Legend4[localhost.cpu]: LegendI[localhost.cpu]: Active LegendO[localhost.cpu]: Options[localhost.cpu]: growright,nopercent
Die mrtg traffic Config neu anlegen:
/usr/bin/cfgmaker --output=/etc/mrtg/traffic.cfg --ifdesc=ip --ifref=desc --global "WorkDir: /var/www/mrtg" --global "Options[_]: bits,growright" public@localhost
Den mrtg Index neu machen:
/usr/bin/indexmaker --output=/var/www/mrtg/index.html --title="ro1" --sort=name --enumerat /etc/mrtg/traffic.cfg /etc/mrtg/cpu.cfg
Den eigenen Index neu machen:
cat /var/www/mrtg/index.html | sed -e 's/SRC="/SRC="mrtg\//g' -e 's/HREF="/HREF="mrtg\//g' -e 's/<\/H1>/<\/H1><img src="topology.png">/g' > /var/www/index.html
/etc/olsrd/dotDraw.pl:
#!/usr/bin/perl use IO::Socket; $TOPPATH = "/var/www"; $NAME = "topology"; $FILENAME = "$TOPPATH/$NAME.dot"; $EXT = "png"; `touch $TOPPATH/$NAME.$EXT`; $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => "localhost", PeerPort => "2004", ) or die "cannot connect to daytime port at localhost"; $f; while ( <$remote> ) { $line = $_; if ( m/^[\{\\}]$|digraph|topology|^"10\.50\..*" -> "10\.50.*"|^"10\.50\.[0-9]+\.[0-9\/]+"\[/) { $f = $f . $line; } if ( $line =~ /}/i ) { print "* "; open DOTFILE, ">$FILENAME"; print DOTFILE $f; close DOTFILE; $f = ""; `neato -Tpng -Gsize=9,6 -Gbgcolor=white -Gsplines=true -Nstyle=filled -Nfontsize=15 -Ncolor=black -Nfillcolor=white -Nfontname=verdana -Ecolor=black -Elen=4 -Earrowsize=2 $FILENAME -o $TOPPATH/$NAME.new`; `mv $TOPPATH/$NAME.new $TOPPATH/$NAME.$EXT`; `cp $TOPPATH/$NAME.dot $TOPPATH/$NAME-\$(date +'%Y-%m-%d-%H-%M-%S').dot`; } }
/etc/olsrd/olsrd.conf:
LoadPlugin "olsrd_dot_draw.so.0.3" { }
Crontab:
*/5 * * * * perl /etc/olsrd/dotDraw.pl > /dev/null 2>&1 */1 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/cpu.cfg > /dev/null 2>&1 */1 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/traffic.cfg > /dev/null 2>&1