Install a Second External SNMP Daemon
Video Lecture
Description
I will install an SNMPD on a different external server.
I do not need the SNMP tools (snnmpget, snmpwalk, etc) in this case, so I am only installing the bare minimum which is the SNMP Daemon.
SSH onto the other/external server.
1 2 |
|
1 2 |
|
Next,
SSH back onto your Prometheus server.
Open the prometheus.yml
1 |
|
Add add the extra target to the static_configs --> targets.
1 2 3 4 5 6 7 8 |
|
Save and check changes to the config are syntactically correct
1 |
|
and if OK, then restart the Prometheus service.
1 2 |
|
Since the SNMPD that I just setup is on a server accessible from the internet, I should also restrict access to the port 161.
I will use iptables to restrict access and allow only my prometheus server to query it.
1 2 3 4 |
|
I then restart the SNMPD service
1 |
|
Warning
iptables settings will be lost in case of system reboot. You will need to reapply them manually,
or
install iptables-persistent
1 |
|
This will save your settings into two files called,
/etc/iptables/rules.v4
/etc/iptables/rules.v6
Any changes you make to the iptables configuration won't be auto saved to these persistent files, so if you want to update these files with any changes, then use the commands,
iptables-save > /etc/iptables/rules.v4
iptables-save > /etc/iptables/rules.v6