VMware Cloud Community
robertwebb
Contributor
Contributor

Cannot enable SNMP in ESX 4 via CLI

I am attempting to write a short perl script to enable SNMP on each of my ESX hosts. I am using the remote CLI and loggin in through a vsphere 4 server to do the config. However, it keeps erroring out everytime I try.

Here are the commands I am using:

vicfg-snmp.pl --server myvsphereserver --username myusername --password mypassword --vihost nameofhost --communities mycommunityname

then

vicfg-snmp.pl --server myvsphereserver --username myusername --password mypassword --vihost nameofhost --enable

Both commands get the following error: "SNMP system is not available on this system."

Any help would be greatly appreciated.

Oh, BTW, we are running licensed ESX hosts with vCenter Server Standard license.

0 Kudos
11 Replies
Troy_Clavell
Immortal
Immortal

I'm assuming your followed this KB article?

http://kb.vmware.com/kb/1008065

0 Kudos
robertwebb
Contributor
Contributor

Yes, followed that article. Even when trying to issue the first config command as they suggest I get the same error I posted.

0 Kudos
Troy_Clavell
Immortal
Immortal

Is the snmp daemon running?

>service snmpd status

try this then try to configure snmp again

1. esxcfg-firewall -e snmpd
2. chkconfig snmpd on
3. service snmpd start

0 Kudos
robertwebb
Contributor
Contributor

I can almost guarantee that the daemon is not running and the the firewallports are not open. If this is hte case, am I going to have to go to EVERY host individually and do these steps? I do not see cli command for the firewall config or to check/modify services.

0 Kudos
robertwebb
Contributor
Contributor

Ok, second reply...

Looks like I can move over to using the Power CLI commands as there are service and firewall optins in there. I will keep you posted...

0 Kudos
Troy_Clavell
Immortal
Immortal

cool!

0 Kudos
robertwebb
Contributor
Contributor

That was a bust... The cmdlet I was looking at was for setting services on the VM itself. Not for the ESX host.

This is going to really suck if I have to got to the console of 35 machines that are blades in three different chasis in order to get this working.

0 Kudos
Troy_Clavell
Immortal
Immortal

I found this, it seems pretty useful. see attachement

0 Kudos
robertwebb
Contributor
Contributor

Looks like you found the answer. Thank you!!

It appears you have to run the command against each esx host directly and cannot use the vaphere server as the go between. I ran the command directly again a host and it seems to have worked.

I will let you know.

0 Kudos
robertwebb
Contributor
Contributor

Script is working for enabling SNMP against the individual host and bypassing vsphere. Now just to figure out how to set the firewall setting to open up the snmp ports.

Thanks for all your help...

0 Kudos
lamw
Community Manager
Community Manager

Yea unfortunately not all functionality on an ESX(i) host is available via vCenter ...

So yes, you'll need to connect to each of your ESX(i) hosts to configure SNMP ... .but with the release of vMA 4.0, a new utility can be used to help with bulk 'similar' operations that isn't well known by many:

/opt/vmware/vima/samples/perl/mcli.pl

This script allows you to execute a specific command across set of hosts.

Take a look at an example on my site: http://engineering.ucsb.edu/~duonglt/vmware/#vmware_vma

This should help speed up the configurations.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos