在Esxi上启用SNMP

1、需要安装VMware vSphere CLI 工具
2、启用snmp agent进程---161端口

 --enable
    -E
       Start SNMP service    

D:\Program Files (x86)\VMware\VMware vSphere CLI\bin>
    vicfg-snmp.pl  -server 192.168.4.211 --username root --password xiaoxiao --enable

3、查询SNMP的配置状态
--show

4、禁用SNMP服务( Stop SNMP service)
--disable
    -D
5、设置团体名
 Set communities separated by comma comm1[,...] (this overwrites previous settings)
--communities
    -c     

6、设置trap目标
    Set destination of notifications(traps) hostname[@port][/community][,...] (this overwrites previous settings)
        (IPv6 address valid for vSphere 4.0 and later)
--targets
    -t
7、测试
 --test //或者-T
3. 开启SNMP步骤
〉vicfg-snmp.pl --server 192.168.0.2 --username root --password password --show //或者-s查询ESXi5服务器的SNMP配置状态 
〉vicfg-snmp.pl --server 192.168.0.2 --username root --password password -c snmpcomm //设置SNMP通讯字   
〉vicfg-snmp.pl --server 192.168.0.2 --username root --password password -t 192.168.0.3@162/snmpcomm //设置SNMP陷阱信息接收服务器IP一般是监控服务器 
〉vicfg-snmp.pl --server 192.168.0.2 --username root --password password --enable //或者-E允许snmp代理
〉vicfg-snmp.pl --server 192.168.0.2 --username root --password password --test //或者-T
测试配置是否成功也可以在远程Linux主机上执行snmpwalk -v 2c -c snmpcomm 192.168.0.2测试。或者再次查询状态
D:\Program Files (x86)\VMware\VMware vSphere CLI\bin>vicfg-snmp.pl --help
Command-specific options:
   --communities
    -c
        Set communities separated by comma comm1[,...] (this overwrites previous
 settings)
   --disable
    -D
       Stop SNMP service
   --enable
    -E
       Start SNMP service    
   --hwsrc
    -y
        Where to source hardware events from IPMI sensors or CIM Indications. On
e of: indications|sensors
   --notraps
    -n
        Comma separated list of trap oids for traps not to be sent by agent. Use
 value 'reset' to clear setting
   --port
    -p
        Sets the port of the snmp agent. The default is udp/161
   --reset
    -r
        Return agent configuration to factory defaults
   --show      查询SNMP配置状态
    -s
        Displays snmp agent configuration
   --targets
    -t
        Set destination of notifications(traps) hostname[@port][/community][,...
] (this overwrites previous settings)
        (IPv6 address valid for vSphere 4.0 and later)
   --test
    -T
        Send out a test notification to validate configuration
   --vihost
    -h
        The host to use when connecting via a vCenter Server.
Common VI options:
   --config (variable VI_CONFIG)
      Location of the VI Perl configuration file
   --credstore (variable VI_CREDSTORE)
      Name of the credential store file defaults to <HOME>/.vmware/credstore/vic
redentials.xml on Linux and <APPDATA>/VMware/credstore/vicredentials.xml on Wind
ows
   --encoding (variable VI_ENCODING, default 'utf8')
      Encoding: utf8, cp936 (Simplified Chinese), iso-8859-1 (German), shiftjis
(Japanese)
   --help
      Display usage information for the script
   --passthroughauth (variable VI_PASSTHROUGHAUTH)
      Attempt to use pass-through authentication
   --passthroughauthpackage (variable VI_PASSTHROUGHAUTHPACKAGE, default 'Negoti
ate')
      Pass-through authentication negotiation package
   --password (variable VI_PASSWORD)
      Password
   --portnumber (variable VI_PORTNUMBER)
      Port used to connect to server
   --protocol (variable VI_PROTOCOL, default 'https')
      Protocol used to connect to server
   --psc (variable VI_PSC)
      Platform services controller's hostname or IP
   --savesessionfile (variable VI_SAVESESSIONFILE)
      File to save session ID/cookie to utilize
   --server (variable VI_SERVER, default 'localhost')
      VI server to connect to. Required if url is not present
   --servicepath (variable VI_SERVICEPATH, default '/sdk/webService')
      Service path used to connect to server
   --sessionfile (variable VI_SESSIONFILE)
      File containing session ID/cookie to utilize
   --url (variable VI_URL)
      VI SDK URL to connect to. Required if server is not present
   --username (variable VI_USERNAME)
      Username
   --verbose (variable VI_VERBOSE)
      Display additional debugging information
   --version
      Display version information for the script
D:\Program Files (x86)\VMware\VMware vSphere CLI\bin>

版权声明:若无特殊注明,本文皆为《hornets's blog 飘落的黄蜂》原创,转载请保留文章出处。
本文链接:在Esxi上启用SNMPhttp://hornets.pw/?post=15
正文到此结束

发表吐槽

你肿么看?

你还可以输入 250 / 250 个字

嘻嘻 大笑 可怜 吃惊 害羞 调皮 鄙视 示爱 大哭 开心 偷笑 嘘 奸笑 委屈 抱抱 愤怒 思考 日了狗

评论信息框

吃奶的力气提交吐槽中...

赶紧抢沙发咯