ubuntu Lucid(10.04) snmp snmpd

2011-12-12 阅读 175

ubuntu Lucid(10.04) snmp snmpd 安装 监控 系统状态

<pre class="brush:bash;">    apt-get install snmp snmpd
```
<pre class="brush:bash;" style="background-color: rgb(240, 240, 240); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dotted; border-right-style: dotted; border-bottom-style: dotted; border-left-style: dotted; border-top-color: rgb(170, 170, 170); border-right-color: rgb(170, 170, 170); border-bottom-color: rgb(170, 170, 170); border-left-color: rgb(170, 170, 170); margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; ">    vim /etc/snmp/snmpd.conf
```
<p>
	修改:</p>
<pre class="brush:bash;" style="background-color: rgb(240, 240, 240); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dotted; border-right-style: dotted; border-bottom-style: dotted; border-left-style: dotted; border-top-color: rgb(170, 170, 170); border-right-color: rgb(170, 170, 170); border-bottom-color: rgb(170, 170, 170); border-left-color: rgb(170, 170, 170); margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; ">    access MyROSystem "" any noauth exact all none none
```
<p>
	增加:</p>
<pre class="brush:bash;" style="background-color: rgb(240, 240, 240); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dotted; border-right-style: dotted; border-bottom-style: dotted; border-left-style: dotted; border-top-color: rgb(170, 170, 170); border-right-color: rgb(170, 170, 170); border-bottom-color: rgb(170, 170, 170); border-left-color: rgb(170, 170, 170); margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; ">    agentaddress IP
```
<p>
	本地测试:</p>
<pre class="brush:bash;">    snmpwalk -v 2c -c public localhost
```
<p>
	远程访问:</p>
<pre class="brush:bash;" style="background-color: rgb(240, 240, 240); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dotted; border-right-style: dotted; border-bottom-style: dotted; border-left-style: dotted; border-top-color: rgb(170, 170, 170); border-right-color: rgb(170, 170, 170); border-bottom-color: rgb(170, 170, 170); border-left-color: rgb(170, 170, 170); margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; ">    vim /etc/default/snmpd
```
<p>
	修改:</p>
<pre class="brush:bash;" style="background-color: rgb(240, 240, 240); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dotted; border-right-style: dotted; border-bottom-style: dotted; border-left-style: dotted; border-top-color: rgb(170, 170, 170); border-right-color: rgb(170, 170, 170); border-bottom-color: rgb(170, 170, 170); border-left-color: rgb(170, 170, 170); margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; ">    SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
```
<p>
	重启:</p>
<pre class="brush:bash;">    /etc/init.d/snmpd restart
```
<p>
	添加远程用户:</p>
<pre class="brush:bash;">    /etc/init.d/snmpd stop
net-snmp-config --create-snmpv3-user -ro -A password -a MD5 username
/etc/init.d/snmpd start
```
<p>
	测试:</p>
<pre class="brush:bash;">    snmpwalk -v 3 -l authNoPriv -a MD5 -u username -A PASSWORD IP:161 sysDescr
```

ubuntu Lucid(10.04) snmp snmpd 安装 监控 系统 状态

更新于 2023年03月28日