<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "需要批量部署snmp的腳本"]]></title>
		<link>https://forum.andowson.com/posts/list/9.page</link>
		<description><![CDATA[Latest messages posted in the topic "需要批量部署snmp的腳本"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>需要批量部署snmp的腳本</title>
				<description><![CDATA[ 之前因為需要大批量的服務器監控，選擇了[url=http://www.cacti.net/]Cacti[/url]，所以需要在所有被監控的服務器上安裝snmp，於是有了shell小腳本。 
<br>
源服務器上是有snmp的tar包及snmpd.conf的配置文件。 
<br>
<br>
snmp.sh 
<br>
[code=bash] 
<br>
#!/bin/sh 
<br>
####snmp######### 
<br>
alias rm=rm 
<br>
alias cp=cp 
<br>
rm -rf libelf-0.8.9* 
<br>
rm -rf beecrypt-4.1.2* 
<br>
rm -rf net-snmp-5.2.5* 
<br>
rm -f snmpd.conf 
<br>
wget http://192.168.1.2/soft/net-snmp-5.2.5.tar.gz 
<br>
wget http://192.168.1.2/soft/snmpd.conf 
<br>
tar -zxvf net-snmp-5.2.5.tar.gz 
<br>
cd net-snmp-5.2.5 
<br>
./configure --prefix=/opt/net-snmp --with-sys-contact=root@monitor.com --with-sys-location=member2.monitor.com --with-default-snmp-version=2 --with-logfile=/var/log/snmpd.log --with-persistent-directory=/var/net-snmp 
<br>
make 
<br>
make install 
<br>
mkdir -p /opt/net-snmp/etc/snmp/ 
<br>
cd .. 
<br>
cp snmpd.conf /opt/net-snmp/etc/snmp/ 
<br>
echo "/opt/net-snmp/sbin/snmpd" &gt;&gt;/etc/rc.local 
<br>
/opt/net-snmp/sbin/snmpd 
<br>
rm -rf net-snmp* 
<br>
rm -rf snmpd.conf 
<br>
rm -f doupdate.sh 
<br>
rm -f dosnmpnew.sh 
<br>
rm -rf beecrypt* 
<br>
rm -rf libelf* 
<br>
[/code] 
<br>
<br>
snmpd的配置文件裏面是根據自己的環境修改過的 
<br>
com2sec 
<br>
group MyRWGroup 
<br>
access MyRWGroup 
<br>
syslocation 
<br>
syscontact 
<br>
…… 
<br>
…… 
<br>
<br>
snmp.sh之後就可以直接用snmpwalk來檢查是否成功安裝。]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/376/719.page</guid>
				<link>https://forum.andowson.com/posts/preList/376/719.page</link>
				<pubDate><![CDATA[Thu, 24 Dec 2009 09:19:54]]> GMT</pubDate>
				<author><![CDATA[ 疯癫二楞子]]></author>
			</item>
	</channel>
</rss>