# bsnmpd and mrtg oid problem



## kisscool-fr (Aug 22, 2011)

Hi,

I have a little issue with my monitoring server with mrtg and a server with bsnmpd daemon running. 

When i start snmpwalk from my monitoring server to the bsnmpd daemon, i can read with success the value for example hrProcessorLaod.5.

The problem is when i put hrProcessorLoad.5 in the target line in mrtg, mrtg complain about it


```
2011-08-22 18:55:08 -- Unknown SNMP var hrProcessorLoad.5
 at /usr/local/bin/mrtg line 2242
2011-08-22 18:55:10 -- 2011-08-22 18:55:09: ERROR: Target[10.1.1.204_cpu][_OUT_] ' $target->[315]{$mode} ' did not eval into defined data
```


I tried adding different mibs to the LoadMIBs: line in mrtg.cfg but without success. 

I am sure it is related to mibs because if I put the numerical oid it works. It's just I can't find any solutions to this.


Does anyone have a suggestion to resolve this issue ? 

Thanks.


----------



## SirDice (Aug 23, 2011)

kisscool-fr said:
			
		

> I have a little issue with my monitoring server with mrtg and a server with bsnmpd daemon running.
> 
> When i start snmpwalk from my monitoring server to the bsnmpd daemon, i can read with success the value for example hrProcessorLaod.5.
> 
> The problem is when i put hrProcessorLaod.5 in the target line in mrtg, mrtg complain about it


Try spelling it correctly; hrProcessorL*oa*d.5.


----------



## kisscool-fr (Aug 23, 2011)

Sorry, I wrote it manually and copied/pasted the wrong value. 

All is spelled correclty in the mrtg conf file. 


I had the same problem with swap checking 


```
2011-08-22 17:59:07 -- Unknown SNMP var hrStorageSize.3
 at /usr/local/bin/mrtg line 2242
2011-08-22 17:59:07 -- Unknown SNMP var hrStorageUsed.3
 at /usr/local/bin/mrtg line 2242
2011-08-22 17:59:09 -- 2011-08-22 17:59:08: ERROR: Target[10.1.1.204_swap][_IN_] ' $target->[316]{$mode} ' did not eval into defined data
2011-08-22 17:59:09 -- 2011-08-22 17:59:08: ERROR: Target[10.1.1.204_swap][_OUT_] ' $target->[316]{$mode} ' did not eval into defined data
```


----------



## phoenix (Aug 23, 2011)

FreeBSD (via bsnmpd) uses different MIBs for checking resources than Linux systems (via net-snmp).  You have to play around with snmpwalk and snmpget in order to find the correct values.

For example, on our FreeBSD firewalls, these are the MIBs I check:

```
# Total CPU Usage
Target[remotehost_cpu]:      ( ssCpuRawUser.0&ssCpuRawUser.0:public@remotehost.domain + ssCpuRawSystem.0&ssCpuRawSystem.0:public@remotehost.domain + ssCpuRawNice.0&ssCpuRawNice.0:public@remotehost.domain + ssCpuRawInterrupt.0&ssCpuRawInterrupt.0:public@remotehost.domain ) / ( ssCpuRawUser.0&ssCpuRawUser.0:public@remotehost.domain + ssCpuRawSystem.0&ssCpuRawSystem.0:public@remotehost.domain + ssCpuRawNice.0&ssCpuRawNice.0:public@remotehost.domain + ssCpuRawInterrupt.0&ssCpuRawInterrupt.0:public@remotehost.domain + ssCpuRawIdle.0&ssCpuRawIdle.0:public@remotehost.domain ) * 100

# % Idle
Target[remotehost_cpuidle]:  ssCpuRawIdle.0&ssCpuRawIdle.0:public@remotehost.domain           / ( ssCpuRawUser.0&ssCpuRawUser.0:public@remotehost.domain + ssCpuRawSystem.0&ssCpuRawSystem.0:public@remotehost.domain + ssCpuRawNice.0&ssCpuRawNice.0:public@remotehost.domain + ssCpuRawInterrupt.0&ssCpuRawInterrupt.0:public@remotehost.domain + ssCpuRawIdle.0&ssCpuRawIdle.0:public@remotehost.domain ) * 100

# % Sys
Target[remotehost_cpusys]:   ssCpuRawSystem.0&ssCpuRawSystem.0:public@remotehost.domain       / ( ssCpuRawUser.0&ssCpuRawUser.0:public@remotehost.domain + ssCpuRawSystem.0&ssCpuRawSystem.0:public@remotehost.domain + ssCpuRawNice.0&ssCpuRawNice.0:public@remotehost.domain + ssCpuRawInterrupt.0&ssCpuRawInterrupt.0:public@remotehost.domain + ssCpuRawIdle.0&ssCpuRawIdle.0:public@remotehost.domain ) * 100

# % User
Target[remotehost_cpuuser]:  ssCpuRawUser.0&ssCpuRawUser.0:public@remotehost.domain           / ( ssCpuRawUser.0&ssCpuRawUser.0:public@remotehost.domain + ssCpuRawSystem.0&ssCpuRawSystem.0:public@remotehost.domain + ssCpuRawNice.0&ssCpuRawNice.0:public@remotehost.domain + ssCpuRawInterrupt.0&ssCpuRawInterrupt.0:public@remotehost.domain + ssCpuRawIdle.0&ssCpuRawIdle.0:public@remotehost.domain ) * 100

# % Interrupt
Target[remotehost_cpuint]:   ssCpuRawInterrupt.0&ssCpuRawInterrupt.0:public@remotehost.domain / ( ssCpuRawUser.0&ssCpuRawUser.0:public@remotehost.domain + ssCpuRawSystem.0&ssCpuRawSystem.0:public@remotehost.domain + ssCpuRawNice.0&ssCpuRawNice.0:public@remotehost.domain + ssCpuRawInterrupt.0&ssCpuRawInterrupt.0:public@remotehost.domain + ssCpuRawIdle.0&ssCpuRawIdle.0:public@remotehost.domain ) * 100

# % Nice
Target[remotehost_cpunice]:  ssCpuRawNice.0&ssCpuRawNice.0:public@remotehost.domain           / ( ssCpuRawUser.0&ssCpuRawUser.0:public@remotehost.domain + ssCpuRawSystem.0&ssCpuRawSystem.0:public@remotehost.domain + ssCpuRawNice.0&ssCpuRawNice.0:public@remotehost.domain + ssCpuRawInterrupt.0&ssCpuRawInterrupt.0:public@remotehost.domain + ssCpuRawIdle.0&ssCpuRawIdle.0:public@remotehost.domain ) * 100
```

The first one is used in it's own graph showing total CPU usage.  The rest are used by Routers2.cgi in a user-created graph showing the breakdown by type of CPU usage.

And the following is used to check on memory usage (in percent):

```
Target[remotehost_memuse]:      100 - ( ( memAvailReal.0&memAvailReal.0:public@remotehost.domain ) * 100 / ( memTotalReal.0&memTotalReal.0:public@remotehost.domain ) )
Target[remotehost_swapuse]:     ( hrStorageUsed.3&hrStorageUsed.3:public@remotehost.domain / hrStorageSize.3&hrStorageSize.3:public@remotehost.domain ) * 100
```

I did have to make a couple changes to the /etc/snmpd.config file, adding the following to the end:

```
# Host resources module snmp_hostres(3).
#  This requires the mibII module.
begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so"

# UCD-SNMP MIB
begemotSnmpdModulePath."ucd" = "/usr/local/lib/snmp_ucd.so"
```

And installing the net-mgmt/bsnmp-ucd port.


----------



## kisscool-fr (Aug 23, 2011)

I know that that MIB are different in bsnmpd and net-snmp. I found that while searching on the net. 

What i don't understand is why snmpwalk can retrive the value for in example hrProcessorLoad and mrtg can't. With other textual oidies the problem is the same. 
If I put the numerical oid for the same value, I can retrieve the value and graph it. 

I put a lot of mibs in the LoadMIBs line in mrtg.cfg file (host-ressources begemot-host-ressources) and all the dependencies. From what i  found, mrtg can't follow imports from mib files. 

I had one promising link on the net that talked about a missing port to install p5-SNMP_session, but it is already installed on my mrtg server. Another thing i found, is that something related to perl-snmp does not load mib files in LoadMIBs. The guy said that he traced all operations and there wan no activity on the LoadMIBs mibs. 

Ah, i already have hostres activated. Found many time, that bsnmp-ucd is no longer required. Even with bsnmp-ucd, i don't remember i seen memAvailReal, ssCpuRawUser, etc ... values. I will try tomorrow once again. 

If it doesn't work, i will continue with numerical oid. That's better than nothing.


----------



## kisscool-fr (Aug 24, 2011)

Ok, i tried once again, loaded bsnmp-ucd, and it still does not work. 

snmpwalk does not see all these ss* oidies, mrtg does not see them too. 


From the man page bsnmp-ucd uses 1.3.6.1.4.1.2021, which is visible with oidview but there is no mapping between numerical oidies and textual oidies. 


What are your freebsd and mrtg versions ? Do you have something in LoadMIBs line in mrtg.conf ?


----------



## phoenix (Aug 24, 2011)

MRTG 2.16.2 running on Debian Linux 5.0.6.  From the mrtg config files for memory and cpu use:

```
# MIBs to load
LoadMIBs:       /usr/share/snmp/mibs/UCD-SNMP-MIB.txt,
                /usr/share/snmp/mibs/HOST-RESOURCES-MIB.txt,
                /usr/share/snmp/mibs/HOST-RESOURCES-TYPES.txt,
                /usr/share/snmp/mibs/NET-SNMP-MIB.txt
```

Querying systems running FreeBSD:

6.2-RELEASE-p3
6.2-RELEASE-p6
6.3-RELEASE-p11
7.0-RELEASE
8.1-RELEASE-p1
8.2-STABLE


----------



## kisscool-fr (Aug 24, 2011)

I think it should be related to something with freebsd or freebsd's versions of softwares. 

I can't make it work with textual OIDies, i'll let it work with numerical. I work just fine like that.

Thanks


----------

