Linux安装与配置Snmpd

Posted by 4Aiur on 03/16/2011 in Linux |

Linux安装与配置Snmpd

下面是两个主流的Linux,CentOS与Ubuntu的snmpd安装与自动配置脚本

Script on CentOS

#!/usr/bin/bash
# Install snmp and agent
yum install -y net-snmp net-snmp-utils

# Backup snmpd.conf
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf-date +%Y%m%d%H%M%S

# Write new snmpd config
cat > /etc/snmp/snmpd.conf  (configure /etc/snmp/snmp.local.conf)
disk / 20%
EOF

chkconfig snmpd on
/etc/init.d/snmpd restart

Script on Unbuntu

#!/usr/bin/bash
# Install snmp and agent
apt-get -y install snmpd snmp

# Modify snmpd listening ipaddress
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/default/snmpd

# Backup snmpd.conf
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf-date +%Y%m%d%H%M%S

# Write new snmpd config
cat > /etc/snmp/snmpd.conf  (configure /etc/snmp/snmp.local.conf)
disk / 20%
EOF
/etc/init.d/snmpd restart

Tags: ,

Copyright © 2010-2019 4Aiur All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.