SNMPD delayed start possible?

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
bartplessers
Posts: 1
Joined: Tue Nov 16, 2021 3:59 pm

SNMPD delayed start possible?

Post by bartplessers »

Hello,

Is it possible to have a delayed start of the snmpd.service ?
Although this service is enabled at startup, on some of my servers this service does not start after a reboot.
I think it's a timing issue, because if I start the service manually after I logged on, no problem.

Code: Select all

journalctl -b |grep snmpd.service

Nov 16 15:49:45 rpi-87 systemd[1]: snmpd.service: Main process exited, code=exited, status=1/FAILURE
Nov 16 15:49:45 rpi-87 systemd[1]: snmpd.service: Failed with result 'exit-code'.


config:

Code: Select all

# --------------------------------------------------------
[Unit]
Description=Simple Network Management Protocol (SNMP) Daemon.
After=network.target
ConditionPathExists=/etc/snmp/snmpd.conf

[Service]
Type=simple
ExecStartPre=/bin/mkdir -p /var/run/agentx
ExecStart=/usr/sbin/snmpd -LOw -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f -p /run/snmpd.pid
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
# --------------------------------------------------------


How can I autmatically start my snmpd.service ?

kind regards,
Bart
User avatar
Joulinar
Posts: 6441
Joined: Sat Nov 16, 2019 12:49 am

Re: SNMPD delayed start possible?

Post by Joulinar »

You can add something like this to service definition to delay service start by 30 second.

Code: Select all

ExecStartPre=/bin/sleep 30
Btw you con use following to check the journalctl

Code: Select all

journalctl -u snmpd
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
trendy
Posts: 389
Joined: Tue Feb 25, 2020 2:54 pm

Re: SNMPD delayed start possible?

Post by trendy »

Is snmpd bound on a specific address or interface? Normally it should listen to udp:161 and udp6:161
Post Reply