Install a Second External SNMP Daemon
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.
SSH back onto your Prometheus server.
Open the prometheus.yml
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
and if OK, then restart the Prometheus service.
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
iptables settings will be lost in case of system reboot. You will need to reapply them manually,
This will save your settings into two files called,
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