LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   MRTG problem (http://www.linuxquestions.org/questions/linux-software-2/mrtg-problem-507850/)

kicko 12-06-2006 06:59 AM

MRTG problem
 
I've setup net-SNMPD and MRTG, but MRTG returns errors.

I'm installing it on new server - Mandriva 2007. I have old server - Mandriva 2006 and it is working on it.

MRTG config file:
Code:

# File: /etc/mrtg/server-info.cfg
#
# Configuration file for non bandwidth server statistics
#


#
# Define global options
#

LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/TCP-MIB.txt,/usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt,/usr/sh
are/snmp/mibs/HOST-RESOURCES-TYPES.txt

workdir: /var/www/html/mrtg/

 
#
# CPU Monitoring
# (Scaled so that the sum of all three values doesn't exceed 100)
#

Target[server.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:test@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:test@localhost + ssCpuRawNice.0&
ssCpuRawNice.0:test@localhost
Title[server.cpu]: Server CPU Load
PageTop[server.cpu]: <H1>CPU Load - System, User and Nice Processes</H1>
MaxBytes[server.cpu]: 100
ShortLegend[server.cpu]: %
YLegend[server.cpu]: CPU Utilization
Legend1[server.cpu]: Current CPU percentage load
LegendI[server.cpu]: Used
LegendO[server.cpu]:
Options[server.cpu]: growright,nopercent
Unscaled[server.cpu]: ymwd

#
# Load Average
#

Target[server.loadavg]: laLoadInt.2&laLoadInt.3:test@localhost
MaxBytes[server.loadavg]: 5000
Title[server.loadavg]: Load Average * 100
PageTop[server.loadavg]:<h1>Load Average * 100</h1>
YLegend[server.loadavg]: Load Average
ShortLegend[server.loadavg]: &nbsp;
Legend1[server.loadavg]: Load average 5 min
Legend2[server.loadavg]: Load average 15 min
LegendI[server.loadavg]: &nbsp;5min load avg
LegendO[server.loadavg]: &nbsp;15min load avg
Options[server.loadavg]: nopercent,growright,noinfo,gauge
[root@m6 mrtg]# cat ser
server-stats.cfg  server-stats.ok 
[root@m6 mrtg]# cat server-stats.cfg
#
# File: /etc/mrtg/server-info.cfg
#
# Configuration file for non bandwidth server statistics
#


#
# Define global options
#

LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/TCP-MIB.txt,/usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt,/usr/st

workdir: /var/www/html/mrtg/

 
#
# CPU Monitoring
# (Scaled so that the sum of all three values doesn't exceed 100)
#

Target[server.cpu]:ssCpuRawUser.0&ssCpuRawUser.0:test@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:test@localhost + ssCpuRawNice.0t
Title[server.cpu]: Server CPU Load
PageTop[server.cpu]: <H1>CPU Load - System, User and Nice Processes</H1>
MaxBytes[server.cpu]: 100
ShortLegend[server.cpu]: %
YLegend[server.cpu]: CPU Utilization
Legend1[server.cpu]: Current CPU percentage load
LegendI[server.cpu]: Used
LegendO[server.cpu]:
Options[server.cpu]: growright,nopercent
Unscaled[server.cpu]: ymwd

#
# Load Average
#

Target[server.loadavg]: laLoadInt.2&laLoadInt.3:test@localhost
MaxBytes[server.loadavg]: 5000
Title[server.loadavg]: Load Average * 100
PageTop[server.loadavg]:<h1>Load Average * 100</h1>
YLegend[server.loadavg]: Load Average
ShortLegend[server.loadavg]: &nbsp;
Legend1[server.loadavg]: Load average 5 min
Legend2[server.loadavg]: Load average 15 min
LegendI[server.loadavg]: &nbsp;5min load avg
LegendO[server.loadavg]: &nbsp;15min load avg
Options[server.loadavg]: nopercent,growright,noinfo,gauge


#
# Memory Monitoring (Total Versus Available Memory)
#

Target[server.memory]: memAvailReal.0&memTotalReal.0:test@localhost
Title[server.memory]: Free Memory
PageTop[server.memory]: <H1>Free Memory</H1>
MaxBytes[server.memory]: 100000000000
ShortLegend[server.memory]: B
YLegend[server.memory]: Bytes
LegendI[server.memory]: Free
LegendO[server.memory]: Total
Legend1[server.memory]: Free memory, not including swap, in bytes
Legend2[server.memory]: Total memory
Options[server.memory]: gauge,growright,nopercent
kMG[server.memory]: k,M,G,T,P,X

#
# Memory Monitoring (Percentage usage)
#

#Target[server.mempercent]: ( memTotalReal.0&memTotalReal.0:test@localhost ) * 100 / ( memTotalReal.0&memTotalReal.0:test@localhost)
#Title[server.mempercent]: Percentage Free Memory
#PageTop[server.mempercent]: <h1>Percentage Free Memory</h1>
#options[server.mempercent]: growright,gauge,transparent,nopercent
#Unscaled[server.mempercent]: ymwd
#MaxBytes[server.mempercent]: 100
#YLegend[server.mempercent]: Memory %
#ShortLegend[server.mempercent]: Percent
#LegendI[server.mempercent]: Used
#LegendO[server.mempercent]: Used
#Legend1[server.mempercent]: Percentage Free Memory
#Legend2[server.mempercent]: Percentage Free Memory

#
# New TCP Connection Monitoring (per minute)
#

Target[server.newconns]: tcpPassiveOpens.0&tcpActiveOpens.0:test@localhost
Title[server.newconns]: Newly Created TCP Connections
PageTop[server.newconns]: <H1>New TCP Connections</H1>
MaxBytes[server.newconns]: 10000000000
ShortLegend[server.newconns]: c/s
YLegend[server.newconns]: Conns / Min
LegendI[server.newconns]: In
LegendO[server.newconns]: Out
Legend1[server.newconns]: New inbound connections
Legend2[server.newconns]: New outbound connections
Options[server.newconns]: growright,nopercent,perminute
 
#
# Established TCP Connections
#

Target[server.estabcons]: tcpCurrEstab.0&tcpCurrEstab.0:test@localhost
Title[server.estabcons]: Currently Established TCP Connections
PageTop[server.estabcons]: <H1>Established TCP Connections</H1>
MaxBytes[server.estabcons]: 10000000000
ShortLegend[server.estabcons]:
YLegend[server.estabcons]: Connections
LegendI[server.estabcons]: In
LegendO[server.estabcons]:
Legend1[server.estabcons]: Established connections
Legend2[server.estabcons]:
Options[server.estabcons]: growright,nopercent,gauge

 
#
# Bandwidt TCP
#

Target[backb]: 2:test@localhost
Title[backb]: Bandwidth
PageTop[backb]: <H1>TCP Bandwidth</H1>
MaxBytes[backb]: 12500000
YLegend[backb]: Bytes / Sec
LegendI[backb]: In
LegendO[backb]: Out
Legend1[backb]: Bandwidth in
Legend2[backb]: Bandwidth out
Options[backb]: growright 
 

#
# Disk Usage Monitoring
#

 
Target[server.disk]: dskPercent.1&dskPercent.1:test@localhost
Title[server.disk]: Disk Partition Usage
PageTop[server.disk]: <H1>Disk Partition Usage /</H1>
MaxBytes[server.disk]: 100
ShortLegend[server.disk]: %
YLegend[server.disk]: Utilization
LegendI[server.disk]: /
LegendO[server.disk]: /var
Options[server.disk]: gauge,growright,nopercent
Unscaled[server.disk]: ymwd

#
# SWAP Usage
#

Target[server.SWAP_USAGE]:.1.3.6.1.4.1.2021.4.3.0&.1.3.6.1.4.1.2021.4.4.0:test@localhost
RouterUptime[server.SWAP_USAGE]: test@localhost
Title[server.SWAP_USAGE]: Swap Space
MaxBytes[server.SWAP_USAGE]: 10000000000
Options[server.SWAP_USAGE]: growright, gauge, nopercent
ShortLegend[server.SWAP_USAGE]:KB
YLegend[server.SWAP_USAGE]: Available Swap
Legend1[server.SWAP_USAGE]: Used Swap
LegendI[server.SWAP_USAGE]: Available Swap
LegendO[server.SWAP_USAGE]: Used Swap
PageTop[server.SWAP_USAGE]: <H1>Swap Usage</H1>


MRTG errors:
Code:

Unknown SNMP var ssCpuRawUser.0
 at /usr/bin/mrtg line 2035
Unknown SNMP var ssCpuRawUser.0
 at /usr/bin/mrtg line 2035
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got '8:04:14'
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got 'Not defined (edit /etc/snmp/snmpd.conf or use snmpconf)'
Unknown SNMP var ssCpuRawSystem.0
 at /usr/bin/mrtg line 2035
Unknown SNMP var ssCpuRawSystem.0
 at /usr/bin/mrtg line 2035
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got '8:04:14'
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got 'Not defined (edit /etc/snmp/snmpd.conf or use snmpconf)'
Unknown SNMP var ssCpuRawNice.0
 at /usr/bin/mrtg line 2035
Unknown SNMP var ssCpuRawNice.0
 at /usr/bin/mrtg line 2035
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got '8:04:14'
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got 'Not defined (edit /etc/snmp/snmpd.conf or use snmpconf)'
Unknown SNMP var laLoadInt.2
 at /usr/bin/mrtg line 2035
Unknown SNMP var laLoadInt.3
 at /usr/bin/mrtg line 2035
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got '8:04:14'
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got 'Not defined (edit /etc/snmp/snmpd.conf or use snmpconf)'
Unknown SNMP var memAvailReal.0
 at /usr/bin/mrtg line 2035
Unknown SNMP var memTotalReal.0
 at /usr/bin/mrtg line 2035
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got '8:04:14'
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got 'Not defined (edit /etc/snmp/snmpd.conf or use snmpconf)'
Unknown SNMP var dskPercent.1
 at /usr/bin/mrtg line 2035
Unknown SNMP var dskPercent.1
 at /usr/bin/mrtg line 2035
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got '8:04:14'
Thursday, 30 November 2006 at 23:10: WARNING: Expected a number but got 'Not defined (edit /etc/snmp/snmpd.conf or use snmpconf)'
Thursday, 30 November 2006 at 23:10: ERROR: Target[server.cpu][_IN_] ' $target->[0]{$mode}  +  $target->[1]{$mode}  +  $target->[2].
Thursday, 30 November 2006 at 23:10: ERROR: Target[server.cpu][_OUT_] ' $target->[0]{$mode}  +  $target->[1]{$mode}  +  $target->[2.
Thursday, 30 November 2006 at 23:10: ERROR: Target[server.loadavg][_IN_] ' $target->[3]{$mode} ' did not eval into defined data
Thursday, 30 November 2006 at 23:10: ERROR: Target[server.loadavg][_OUT_] ' $target->[3]{$mode} ' did not eval into defined data
Thursday, 30 November 2006 at 23:10: ERROR: Target[server.memory][_IN_] ' $target->[4]{$mode} ' did not eval into defined data
Thursday, 30 November 2006 at 23:10: ERROR: Target[server.memory][_OUT_] ' $target->[4]{$mode} ' did not eval into defined data
Thursday, 30 November 2006 at 23:10: ERROR: Target[server.disk][_IN_] ' $target->[8]{$mode} ' did not eval into defined data
Thursday, 30 November 2006 at 23:10: ERROR: Target[server.disk][_OUT_] ' $target->[8]{$mode} ' did not eval into defined data

Statistics for network are OK (Established TCP Connections, TCP Bandwidth etc.), but statistics for CPU, load average doesn't work.

I tried to use snmpwalk and it looks OK:
Code:

[root@m6 ~]# snmpwalk -v1 -c test localhost ssCpuRawUser
UCD-SNMP-MIB::ssCpuRawUser.0 435141


What am I doing wrong?
Can someone help me with this?

packetscan 07-01-2008 03:22 PM

Madness - ok not really.
 
This was bugging me for a few hours until i came across a doc that recommended using full ID numbers rather than short names.

Mandriva 2008 - spring, Base install, used URPMI ( urpmi ) to install mrtg and Dependants.
Then used cfgmaker and indexmaker to create files.

Some Graphics didn't build properly and manually running
env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg i could not see some OID's when referenced by short names woud error out. However snmpwalk would work properly

Delving into my config file what i found is preempted by a #, and what i changed it to is on the bottom line.

CPU Monitoring
**original**
#Target[server.cpu]: ssCpuRawUser.0&ssCpuRawUser.0:public@localhost + ssCpuRawSystem.0&ssCpuRawSystem.0:public@localhost + ssCpuRawNice.0&ssCpuRawNice.0:public@localhost
**changed/updated**
Target[server.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.53.0&1.3.6.1.4.1.2021.11.53.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

[root@vortex ~]# snmpwalk -v 2c localhost -c public ssCpuRawUser.0
UCD-SNMP-MIB::ssCpuRawUser.0 496112

[root@vortex ~]# snmpwalk -v 2c localhost -c public .1.3.6.1.4.1.2021.11.50
UCD-SNMP-MIB::ssCpuRawUser.0 496112


So in short replace the short name with the full OID.


All times are GMT -5. The time now is 05:04 AM.