#!/bin/bash
echo "Install snmp client"
sleep 1
yum install net-snmp* -y
ll /etc/snmp/snmpd.conf
cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori
cat >/etc/snmp/snmpd.conf<<EOF
com2sec local localhost public
com2sec mynetwork 10.0.0.0/24 public
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 local mynetwork
group MyROGroup v2c local mynetwork
group MyROGroup usm mynetwork
view all include .1 80
access MyROGroup "" any noauth exact all none none
access MyROGroup "" any noauto exact all all none
syslocation etiantian.org
syscontact Me <rscpass@163.com>
proc mountd
proc ntalkd 4
proc sendmail 10 1
proc httpd 10 1
exec echotest /bin/echo hello world
exec disk_used_shell /bin/bash /root/current_disk_used.sh
exec httpd_proc /bin/bash /root/current_httpd_proc.sh
disk / 10000
disk /root 10000
load 12 14 14
EOF
cat -n /etc/snmp/snmpd.conf
/etc/init.d/snmpd start
netstat -lntup | grep 161
lsof -i :161
ps -ef | grep snmpd| grep -v grep
snmpget -v 1 -c public localhost system.sysUpTime.0
tail -10 /var/log/snmpd.log
2016-11-22
SNMP客户端自动安装脚本
评论
发表评论
姓 名: