Jay Thomas
asked on
Set snmp on ESXi version 4.1, 5.1 and 5.5
Hi all,
I've been looking on the web for an answer to how to setup SNMP on 3 different versions of ESXi that I have.
My questions are from a console.
1. How do i check that the SNMP service is running on an ESXi host?
2. How do I start it and set it to automatic?
3. How do I set the community and trap destinations?
Any help appreciated.
I've been looking on the web for an answer to how to setup SNMP on 3 different versions of ESXi that I have.
My questions are from a console.
1. How do i check that the SNMP service is running on an ESXi host?
2. How do I start it and set it to automatic?
3. How do I set the community and trap destinations?
Any help appreciated.
ASKER
Hi Andrew, when i run:
vicfg-snmp.pl --server hostname --username username --password password --show
With correct credentials i receive an error "vicfg.snmp.pl: not found". I get this on a ESXi 4.1 and a 5.5 host.
vicfg-snmp.pl --server hostname --username username --password password --show
With correct credentials i receive an error "vicfg.snmp.pl: not found". I get this on a ESXi 4.1 and a 5.5 host.
ASKER
Hi again, I am running the following commands on ESX5.5:
esxcli system snmp set --enable true
esxcli system snmp set --communities MyName
esxcli system snmp set --targets MyIPAddress/MyCommunity.
And all works very well. I am able to test alert on my monitoring system and all is well however when I run the command on 4.1 I get an error "Unknown Namespace System". Clearly the command isn't supported but would you know what the command is that I should be using?
esxcli system snmp set --enable true
esxcli system snmp set --communities MyName
esxcli system snmp set --targets MyIPAddress/MyCommunity.
And all works very well. I am able to test alert on my monitoring system and all is well however when I run the command on 4.1 I get an error "Unknown Namespace System". Clearly the command isn't supported but would you know what the command is that I should be using?
So, is the issue now only with 4.1 ?
ASKER
Hi Andrew. Yes, I looked at the link you sent and have successfully deployed SNMP on 5x versions. Just 4.1 outstanding.
it could be the version of vCLI you are using for 4.1.
what version of vCLI are you using ?
what command are you using ?
vicfg-snmp.pl --server host.example.com --username root --password password -t target.example.com@162 -c public
what version of vCLI are you using ?
what command are you using ?
vicfg-snmp.pl --server host.example.com --username root --password password -t target.example.com@162 -c public
ASKER
HI, I ran the command and the output I get is:
vicfg-snmp.pl: not found
These are 4.1 hosts that haven't been looked after properly IMO. I'm not even sure vcli is installed, is there any way for me to tell whether it has and if so what version it is?
vicfg-snmp.pl: not found
These are 4.1 hosts that haven't been looked after properly IMO. I'm not even sure vcli is installed, is there any way for me to tell whether it has and if so what version it is?
vCLI is installed on the workstation.
ASKER
My miss-understanding.
ASKER
So that I am clear. vCLI is used to administer vSphere server or ESXi hosts? The 5.5 ESXi hosts are all individual, not clustered and so I ran the commands after connecting to the console using SSH program. If the 4.1 hosts are part of a cluster do I specify the SNMP through vSphere then?
vCLI are remote tools, that connect to an ESXi Host (or vSphere Server!)
so you connect via vCLI to host.
so you connect via vCLI to host.
ASKER
Almost there. From a server with vCLI installed I run
1. vicfg-snmp.pl --server yServerName --username root --enable
Enter password:
Enabling agent...
Complete.
2. I then run vicfg-snmp.pl --server MyServerName --username root --show
Enter password:
Current SNMP agent settings:
Enabled : 1
UDP port : 161
Looks good, I then add a community and trap destinations, but I get an error(please see below) and I can't make out what or why the error comes up.
3.bin>vicfg-snmp.pl --server MyServerName --username root -t MySNMPManagerServerName -c MyCommunityString
Enter password:
Changing community list to: MyCommunityString...
Complete.
Changing notification(trap) targets list to: MyServerName...
target "MyServerName" must specify destination/community and optionally
a port
Failed.
Complete.
1. vicfg-snmp.pl --server yServerName --username root --enable
Enter password:
Enabling agent...
Complete.
2. I then run vicfg-snmp.pl --server MyServerName --username root --show
Enter password:
Current SNMP agent settings:
Enabled : 1
UDP port : 161
Looks good, I then add a community and trap destinations, but I get an error(please see below) and I can't make out what or why the error comes up.
3.bin>vicfg-snmp.pl --server MyServerName --username root -t MySNMPManagerServerName -c MyCommunityString
Enter password:
Changing community list to: MyCommunityString...
Complete.
Changing notification(trap) targets list to: MyServerName...
target "MyServerName" must specify destination/community and optionally
a port
Failed.
Complete.
From a SSH connection to a ESXi host:
1.- Set the "public" community, enable SNMP and set a target for traps:
esxcli system snmp set --communities public --enable yes --targets=192.168.130.1/pu blic
esxcli system snmp set -c public -e yes -t=192.168.130.1/public
2.- Review the config
esxcli system snmp get
3.- Test the actual config
esxcli system snmp test
4.- Review the msg sent by the ESXi host on the target server.
5.- Done!
1.- Set the "public" community, enable SNMP and set a target for traps:
esxcli system snmp set --communities public --enable yes --targets=192.168.130.1/pu
esxcli system snmp set -c public -e yes -t=192.168.130.1/public
2.- Review the config
esxcli system snmp get
3.- Test the actual config
esxcli system snmp test
4.- Review the msg sent by the ESXi host on the target server.
5.- Done!
ASKER
Hi Carlos. From SSH I get error unknown namespace system when I run esxcli command.
So using power client from my machine I have run:
1. vicfg-snmp.pl --MyServerName --username root -t TargetServerName -c MyCommunityName
2. I run the show command and I get the following output -
Current SNMP agent settings:
Enabled : 1
UDP port : 161
Communities :
MyCommunityName
public
Notification targets :
(I do not see any notification targets and so when I do a SNMP test it tell me:
Sending test nofication(trap) to all configured targets...
Failed : A general system error occurred: No destinations have been configured t
o send notifications to
It would appear I can set the community because that does show up I'm just having trouble with the syntax of the command to set the target. Any help appreciated.
So using power client from my machine I have run:
1. vicfg-snmp.pl --MyServerName --username root -t TargetServerName -c MyCommunityName
2. I run the show command and I get the following output -
Current SNMP agent settings:
Enabled : 1
UDP port : 161
Communities :
MyCommunityName
public
Notification targets :
(I do not see any notification targets and so when I do a SNMP test it tell me:
Sending test nofication(trap) to all configured targets...
Failed : A general system error occurred: No destinations have been configured t
o send notifications to
It would appear I can set the community because that does show up I'm just having trouble with the syntax of the command to set the target. Any help appreciated.
Yes, because he's not quite correct esxcli is ESXi 5.x! not 4.x!
the correct command is vicfg-snmp.pl
the syntax is
--targets | -t <hostname[@port]> </community>[,...]
vicfg-snmp.pl --server <ESXi4.x_Host_IP> -c <communityname> -p 161 -t <destination_host@161/<com munityname >
You can edit the XML file directly, it you so choose.
the correct command is vicfg-snmp.pl
the syntax is
--targets | -t <hostname[@port]> </community>[,...]
vicfg-snmp.pl --server <ESXi4.x_Host_IP> -c <communityname> -p 161 -t <destination_host@161/<com
You can edit the XML file directly, it you so choose.
ASKER
Thanks Andrew. Sorry I have just found out I need to add 2 community strings. Would this be done using a semi colon perhaps between names?
a comma
two community strings
like
public1
private1
vicfg-snmp.pl --server 192.168.1.1 -c public1,private1 -t 192.168.1.254/public1,192. 168.1.6@16 3/private1 -p 163
two community strings
like
public1
private1
vicfg-snmp.pl --server 192.168.1.1 -c public1,private1 -t 192.168.1.254/public1,192.
ASKER
Thank you Andrew. So before I run and just so that I am clear. The above example would add a "private1" community name reporting to 192.168.1.254 and a "public1" community name that reports to 192.168.1.6?
I'm just wondering why the @163 isn't specified twice?
Thanks for all your help.
I'm just wondering why the @163 isn't specified twice?
Thanks for all your help.
well you could specify 161 twice!
default port 161! (so if not specified, assumes 161!)
163 is a different port!
for completeness, specify 161 twice!
default port 161! (so if not specified, assumes 161!)
163 is a different port!
for completeness, specify 161 twice!
ASKER
So mine are port 161 so I run:
vicfg-snmp.pl --server ServerName -c CommName1,CommName2 -t ManagementServer1, ManagementServer2.
I get the error of:
Changing community list to: CommName1,CommName2...
Complete.
Changing notification(trap) targets list to: IPAddress1,IPAddress2...
target "IPAddress1" must specify destination/community and optionally a port
Failed.
target "IPAddress2" must specify destination/community and optionally a port
Failed.
Complete.
I know I must be doing something wrong...
vicfg-snmp.pl --server ServerName -c CommName1,CommName2 -t ManagementServer1, ManagementServer2.
I get the error of:
Changing community list to: CommName1,CommName2...
Complete.
Changing notification(trap) targets list to: IPAddress1,IPAddress2...
target "IPAddress1" must specify destination/community and optionally a port
Failed.
target "IPAddress2" must specify destination/community and optionally a port
Failed.
Complete.
I know I must be doing something wrong...
vicfg-snmp --server esx1-old --username root --password vmware -t <trap.server1.hostname>@16 2/public ,<trap.server2.hostname>@1 62/public
please paste the command you are using.....
please paste the command you are using.....
ASKER
Hi, I run this:
vicfg-snmp.pl --server ServerName -c CommName1,CommName2 -t ManagementServer1, ManagementServer2
vicfg-snmp.pl --server ServerName -c CommName1,CommName2 -t ManagementServer1, ManagementServer2
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you Andrew. I will try it when back at the office tomorrow morning.
ASKER
Yep, all working now many thanks.
Let me know when you release your VMware ESXI eBook and I'll be the first in the queue to purchase it ;)
Let me know when you release your VMware ESXI eBook and I'll be the first in the queue to purchase it ;)
VMware KB: Configuring SNMP Traps in ESXi/ESX
the VMware vSphere CLI command is used to configure
vicfg-snmp.pl
the command
vicfg-snmp.pl --server hostname --username username --password password --show
will show existing configuration.
The same command, can be used to test and enable SNMP.