Last active
February 15, 2021 12:32
-
-
Save netaviator/694c0382a13056a358239020803c26b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Author: Jan Gilla | |
# Company: level66.network UG (haftungsbeschränkt) | |
# Description: BASH script to install snmpd daemon on Debian/Ubuntu based linux systems, generate the configuration and reload the service by using systemd. | |
# | |
# Define variables here. | |
SNMPD_COMMUNITY=public | |
SNMPD_LOCATION="Milki Way" | |
[email protected] | |
# Do not change anything below here! | |
echo "Installing snmpd service via apt-get ..." | |
/usr/bin/apt-get update | |
/usr/bin/apt-get install snmpd lm-sensors --yes | |
echo "Deploy configuration to /etc/snmp/snmpd.conf ..." | |
cat <<EOF > /etc/snmp/snmpd.conf | |
# Listen on all ips | |
agentAddress udp:161,udp6:[::]:161 | |
# Device information | |
syslocation $SNMPD_LOCATION | |
syscontact $SNMPD_CONTACT | |
# SNMPv2 | |
rocommunity $SNMPD_COMMUNITY | |
rocommunity6 $SNMPD_COMMUNITY | |
EOF | |
echo "Restart snmpd service via systemd ..." | |
/usr/bin/systemctl restart snmpd.service | |
/usr/bin/systemctl status snmpd.service --plain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment