lunes, 16 de diciembre de 2024

Enable SNMP on Ubuntu Server

On the agent and manager server:

apt update
apt install snmp snmp-mibs-downloader
 
On the agent server:
vim /etc/snmp/snmp.conf  
/etc/snmp/snmp.conf

# As the snmp packages come without MIB files due to license reasons, loading # of MIBs is disabled by default. If you added the MIBs you can reenable # loading them by commenting out the following line.  

#mibs :

 
vim /etc/snmp/snmpd.conf
Comment the following lines: 
 #  Listen for connections from the local system only
#agentAddress  udp:127.0.0.1:161
#  Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161
 
vim /etc/snmp/snmpd.conf
Add these lines: 
createUser bootstrap MD5 temp_password DES
rwuser bootstrap priv
rwuser demo priv 
 
systemctl restart snmpd
 
On the Manager server:
Verify with snmpget 
snmpget -u bootstrap -l authPriv -a MD5 -x DES -A temp_password -X temp_password agent_server_ip_address 1.3.6.1.2.1.1.1.0 
 
Output
SNMPv2-MIB::sysDescr.0 = STRING: Linux agent 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64
 
 
Create a user based on bootstrap 
snmpusm -u bootstrap -l authPriv -a MD5 -x DES -A temp_password -X temp_password agent_server_ip_address create demo bootstrap 
 Change the password
snmpusm -u demo -l authPriv -a MD5 -x DES -A temp_password -X temp_password agent_server_ip_address passwd temp_password new_password 

On the Agent server:
Remove the bootstrap
vim /etc/snmp/snmpd.conf 
Comment the following lines:
...
#createUser bootstrap MD5 temp_password DES
#rwuser bootstrap priv
...
 
On the Manager server:
snmpusm -u bootstrap -l authPriv -a MD5 -x DES -A temp_password -X temp_password 100.90.8.48 delete bootstrap
User successfully deleted.
 
On the Agent server:
systemctl restart snmpd
 

No hay comentarios:

Publicar un comentario