Thursday 6 November 2014

Can't call method "configuration" on an undefined value at /usr/bin/vicfg-snmp line 248

Configure SNMP on an ESXi 5.5 host through vMA:

I tried to configure SNMP on an ESXi host, and didn't set a port and a community string for the target, so it returned a warning saying that the switch requires at least a community string and optionally a port (I assumed it would set the default port as it's set for the agent). Once the target and community string are set, the show switch returns a strange error. Basically, the target requires a port to be specified as well, but it cannot be corrected by re-setting the target info. Instead, we need to revert the SNMP agent configuration to factory default or set the port in snmp.xml file or recreate the xml file and set the full target info.







Log on to the host through WinSCP and edit /etc/vmware/snmp.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<config><snmpSettings><enable>true</enable><port>161</port><syscontact></syscontact><syslocation></syslocation><EnvEventSource>indications</EnvEventSource><communities>123123</communities><targets>192.168.1.61</targets><engineid>00000063000000a100000000</engineid><loglevel>info</loglevel><authProtocol></authProtocol><privProtocol></privProtocol></snmpSettings></config>

The KBA Cannot enable or test SNMP on a VMware ESXi 5.1 host (2036910) says:

In the targets section, set an IP Address to which the SNMP traps are to be sent. Alternatively, if you do not want an extra traffic on the network, set a loop-back address. 

For example:

<targets>
192.168.1.61@162 123123
</targets>

So, if we now try to add a port and community string to the target, it returns another error:


So we can either reset the agent configuration to factory default with the switch –r, add a port and community string in the xml file, or rename or delete the xml file and configure the agent again:


<?xml version="1.0" encoding="ISO-8859-1"?>
<config><snmpSettings><enable>true</enable><port>161</port><syscontact></syscontact><syslocation></syslocation><EnvEventSource>indications</EnvEventSource><communities>123123</communities><targets>192.168.1.61@162/123123</targets><engineid>00000063000000a100000000</engineid><loglevel>info</loglevel><authProtocol></authProtocol><privProtocol></privProtocol></snmpSettings></config>

 

So the target port number is required when setting an SNMP target.

No comments:

Post a Comment