mrtg und SNMP

April 23rd, 2010 by chris

Habe ident installierte Server, doch bei ein paar davon erscheint beim Ausführen von mrtg folgende Fehlermeldung:

Unknown SNMP var ssCpuRawUser.0
 at /usr/bin/mrtg line 2202
Unknown SNMP var ssCpuRawUser.0
 at /usr/bin/mrtg line 2202
2010-04-23 08:28:50: WARNING: Expected a number but got '24 days, 9:52:40'
2010-04-23 08:28:50: WARNING: Expected a number but got 'mars'
Unknown SNMP var ssCpuRawSystem.0
 at /usr/bin/mrtg line 2202
Unknown SNMP var ssCpuRawSystem.0
 at /usr/bin/mrtg line 2202
2010-04-23 08:28:50: WARNING: Expected a number but got '24 days, 9:52:40'
2010-04-23 08:28:50: WARNING: Expected a number but got 'mars'
Unknown SNMP var ssCpuRawNice.0
 at /usr/bin/mrtg line 2202
Unknown SNMP var ssCpuRawNice.0
 at /usr/bin/mrtg line 2202
2010-04-23 08:28:50: WARNING: Expected a number but got '24 days, 9:52:40'
2010-04-23 08:28:50: WARNING: Expected a number but got 'mars'
2010-04-23 08:28:51: ERROR: Target[localhost.cpu][_IN_] ' $target->[5]{$mode}  +  $target->[6]{$mode}  +  $target->[7]{$mode} ' (warn): Use of uninitialized value in addition (+) at (eval 9467) line 1.
2010-04-23 08:28:51: ERROR: Target[localhost.cpu][_OUT_] ' $target->[5]{$mode}  +  $target->[6]{$mode}  +  $target->[7]{$mode} ' (warn): Use of uninitialized value in addition (+) at (eval 9468) line 1.

Wenn jemand nen Tip für mich hat wie das zu beheben ist dann nur her damit, danke

EDIT:
Ein halbes Jahr später konnte ich das Problem endlich beheben. Neuere Versionen von mrtg und net-snmp machten auch keinen Unterschied. Die Frage, warum es auf identen System unterschiedlicher Konfigurationen bedarf, ist allerdings weiterhin nicht geklärt.

Nun zur Lösung. Der “Identifier” muss direkt eingegeben werden.

snmpwalk -v1 localhost -c public -On ssCpuRawUser.0

.1.3.6.1.4.1.2021.11.50.0 = Counter32: 50940884

snmpwalk -v1 localhost -c public -On ssCpuRawSystem.0

.1.3.6.1.4.1.2021.11.52.0 = Counter32: 27018942

snmpwalk -v1 localhost -c public -On ssCpuRawNice.0

.1.3.6.1.4.1.2021.11.51.0 = Counter32: 1108

Die fett gedruckten Werte sind interessant für uns und werden in die neue Config eingesetzt.

Die ursprüngliche Config:

LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[localhost.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:public@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:public@localhost + ssCpuRawNice.0&ssCpuRawNice.0:public@localhost
RouterUptime[localhost.cpu]: public@localhost
MaxBytes[localhost.cpu]: 100
Title[localhost.cpu]: CPU Load
PageTop[localhost.cpu]: \Active CPU Load %\
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 neue Config:

LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Target[localhost.cpu]:.1.3.6.1.4.1.2021.11.50.0&.1.3.6.1.4.1.2021.11.50.0:public@localhost + .1.3.6.1.4.1.2021.11.52.0&.1.3.6.1.4.1.2021.11.52.0:public@localhost + .1.3.6.1.4.1.2021.11.51.0&.1.3.6.1.4.1.2021.11.51.0:public@localhost
RouterUptime[localhost.cpu]: public@localhost
MaxBytes[localhost.cpu]: 100
Title[localhost.cpu]: CPU Load
PageTop[localhost.cpu]: \Active CPU Load %\
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

Posted in Allgemein | 2 Comments »

2 Kommentare »

  1. Many thanks! Very helpful!

    Kommentar by Ian — 21 Dezember 2010 @ 09:42

  2. Hi,

    ich kenn mich mit mrtg nicht wirklich aus, aber ich bin grade über was ähnliches gestolpert.

    https://lists.oetiker.ch/pipermail/mrtg/2006-June/031683.html

    Hast du auch mehrere LoadMIBs Statements verwendet? Es sieht danach aus, denn deine Lösung basiert ja darauf, dass er die Abkürzungen nicht auflösen kann, mit den kompletten OIDs aber sehr wohl zurecht kommt.

    Kommentar by P — 15 August 2011 @ 14:25

RSS Feed für Kommentare zu diesem Artikel. TrackBack URL

Hinterlasse einen Kommentar