snmp+mrtg - cpu graph?
rozhodol som sa ze si zacnem grafovat cpu vyuzitie a tak, ale mam problem.
z tohoto webu ( http://www.enterastream.com/whitepapers/mrtg/mrtg-manual-cap9.html ) som si dal konfiguraciu
Target[10.0.0.254-cpu]:.1.3.6.1.4.1.311.1.1.3.1.1.33.9.0&.1.3.6.1.4.1.311.1.1.3.1.1.33.9.0:public@10.0.0.254
AbsMax[10.0.0.254-cpu]: 100
MaxBytes[10.0.0.254-cpu]: 100
Title[10.0.0.254-cpu]: CPU Utilization (average)
PageTop[10.0.0.254-cpu]: CPU Utilization
Options[10.0.0.254-cpu]: gauge,growright,nopercent, noo
YLegend[10.0.0.254-cpu]: CPU Utilization
ShortLegend[10.0.0.254-cpu]: %
LegendI[10.0.0.254-cpu]: CPU Utilization (percentage)
vsetko by islo len ked idem spustit MRTG tak vyhodi toto:
root@buri-laptop:/net# env LANG=C /usr/bin/mrtg /home/buri/mrtg.conf
SNMP Error:
Received SNMP response with error code
error status: noSuchName
index 2 (OID: 1.3.6.1.4.1.2021.13.16.3.1.3.1)
SNMPv1_Session (remote host: "localhost" [127.0.0.1].161)
community: "public"
request ID: 1166482177
PDU bufsize: 8000 bytes
timeout: 2s
retries: 5
backoff: 1)
at /usr/share/perl5/SNMP_util.pm line 492
SNMPGET Problem for .1.3.6.1.4.1.2021.13.16.3.1.3.1 .1.3.6.1.4.1.2021.13.16.3.1.3.1 sysUptime sysName on public@localhost::::::v4only
at /usr/bin/mrtg line 2207
2010-07-05 02:11:20: ERROR: Target[localhost.fan][_IN_] ' $target->[3]{$mode} ' did not eval into defined data
2010-07-05 02:11:20: ERROR: Target[localhost.fan][_OUT_] ' $target->[3]{$mode} ' did not eval into defined data
-
dalej ako som skusal, tak hociaky snmpwalk prikaz ak zadam, hned mi vrati toto:
root@buri-laptop:/etc/snmp# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.9
End of MIB
viete niekto poradit?
Pre pridávanie komentárov sa musíte prihlásiť.
preco to robis cez snmp? ak tie data ziskavas len z localhost-u tak je zbytocne. mrtg dokaze spustit hocijaky skript co si napises a jeho vystup pouzije ako data pre graf.
napr.:
# more /etc/mrtg/cpu.conf
Target[cpu_percent]: ` sar -P ALL 1 1|grep Average|grep all|awk {'print $3'}'`
....
Target[cpu0.0]: `sar -P 0 1 1|grep Average|awk {'print $3'}`
AbsMax[cpu0.0]: 100
MaxBytes[cpu0.0]: 100
Title[cpu0.0]: CPU Utilization (average)
PageTop[cpu0.0]: CPU Utilization
Options[cpu0.0]: gauge,growright,nopercent, noo
YLegend[cpu0.0]: CPU Utilization
ShortLegend[cpu0.0]: %
LegendI[cpu0.0]: CPU Utilization (percentage)
a pise:
root@buri-laptop:/home/buri# env LANG=C /usr/bin/mrtg /home/buri/mrtg.conf
2010-07-05 12:46:18: WARNING: Problem with External get 'sar -P 0 1 1|grep Average|awk {'print $3'}':
Expected a Number for 'out' but nothing'
2010-07-05 12:46:22: ERROR: Target[cpu0.0][_OUT_] ' $target->[3]{$mode} ' did not eval into defined data
root@buri-laptop:/home/buri#
daj si to do googla. Zatial narychlo skus:
sar -P 0 1 1|grep Average|awk {'print $3'} && echo 0
Mne taketo nieco normalne funguje, ale musim mat nakonfigurovanu a beziacu sluzbu SNMP ktora nesmie mat blokovanu komunikaciu medzi strojom na ktorom bezi SNMP a kolektovaciou masinou (napriklad cez firewall).
Pre MIBs som sa s tym moc nehral, jednoducho som vyuzil UCB definiciu a u mna to vyzera takto:
S preklepmi som sa nekaslal, je to lokalne na mojom desktope. A mam jednoprocesorovu masinu, preto max 100%.