snmp自动化安装脚本
生活随笔
收集整理的這篇文章主要介紹了
snmp自动化安装脚本
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Centos7適用
#/bin/bash echo "" echo "" echo "**************************************" echo "* *" echo "* *" echo "* SNMP服務自動安裝部署 *" echo "* *" echo "* *" echo "**************************************" echo "" echo "" echo "*****安裝時間大約需要1分鐘,請耐心等待*****" yum install -y net-snmp-* sed -i 'N;54aview??? systemview??? included?? .1' /etc/snmp/snmpd.conf service snmpd restartservice snmpd statusecho "*****snmpd服務開機自啟!*****" systemctl enable snmpd.serviceecho "*****查看snmpd服務是否開機自啟!*****" systemctl is-enabled snmpd.serviceecho "*****查看本機的主機名稱*****" snmpwalk -v 2c -c public 127.0.0.1 sysNameecho "*****snmp安裝配置完成!*****"echo "" echo "" echo "**************************************" echo "* *" echo "* *" echo "* 開啟161端口號 *" echo "* *" echo "* *" echo "**************************************" echo "" echo "" echo "**正在開啟防火墻的161端口,請耐心等待**"firewall-cmd --zone=public --add-port=161/tcp --permanent echo "*****刷新防火墻*****" firewall-cmd --reload echo "*****查看已經開放的防火墻端口號*****" firewall-cmd --list-ports echo "*****防火墻端口號開啟完成!*****"Ubantu適用
#/bin/bash echo "" echo "" echo "**************************************" echo "* *" echo "* *" echo "* SNMP服務自動安裝部署 *" echo "* *" echo "* *" echo "**************************************" echo "" echo "" echo "*****安裝時間大約需要1分鐘,請耐心等待*****"apt-get -y autoremove snmpd snmp snmp-*apt-get -y install snmpd snmp snmp-*sed -i '/view systemonly included .1.3.6.1.2.1.1/i\view systemonly included .1' /etc/snmp/snmpd.confsed -i 's/^agentaddress/#&/' /etc/snmp/snmpd.confsed -i 's/^agentAddress udp:127.0.0.1:161/#&/' /etc/snmp/snmpd.confservice snmpd restartecho "*****snmp安裝配置完成!*****" service snmpd statusecho "*****snmpd服務開機自啟!*****" systemctl enable snmpd.serviceecho "*****查看snmpd服務是否開機自啟!*****" systemctl is-enabled snmpd.serviceecho "*****查看本機的主機名稱*****" snmpwalk -v 2c -c public 127.0.0.1 echo "*****查允許外部訪問161端口號*****" sudo ufw allow 161echo "*****停止本機的防火墻*****" sudo ufw disableecho "*****查看本機防火墻狀態*****" sudo ufw status?
總結
以上是生活随笔為你收集整理的snmp自动化安装脚本的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 电信营业厅app如何退订业务(中国电信网
- 下一篇: 逆战诸神套装怎么切换矛