oetiker / SmokePing

The Active Monitoring System
http://www.smokeping.org
GNU General Public License v2.0
1.38k stars 184 forks source link

Problem with Slave Setup #361

Closed reVolt1984 closed 1 year ago

reVolt1984 commented 1 year ago

Hello Guys,

after trying around with a Master/Slave setup I am totally stuck now. I followed like every available tutorial in the internet (most of them are way too old) but I cant get that Smokeping to start in slave mode when starting via service.

Starting smokeping manually via command runs fine, the cache files and rrds are on the master, the graphs are generated. But only one time. I guess it is not recommended to start that via cronjob.

I edited both (/etc/init.d/smokeping & /etc/default/smokeping) and set this to slave mode, gave it the master url and the shared key but it does start in normal mode without showing any errors in the logs.

When I try to use the slave_mode.conf systemd tells me that it is not allowed to have more than one ExecStart= unless you got a oneshot service.

I got the same issue on two different systems - one is a ubuntu 12.10 and the other one is a debian 11.5

Maybe it is due to my depricated linux experience but I really need help with that.

Thank you in advance.

Jens

Strykar commented 1 year ago

This is not a Smokeping issue. /etc/init.d/smokeping is not a systemd directory on Debian or Ubuntu, changing anything there won't work.

Run the slave as the appropriate user in a terminal and post the debug log like:

./smokeping --debug \
             --master-url=http://smokeping/smokeping.cgi \
             --cache-dir=/var/smokeping/cache.file \
             --shared-secret=/var/smokeping/secret.txt
reVolt1984 commented 1 year ago

Hello Strykar,

thanks for your reply - I know that is due to my missing knowledge in newer linux distributions. I just didn’t know where to state my question.

I can start smokeping manually and it works with the master - my problem is to get the service running in slave mode so that I don’t need to run the command every few minutes. Is there any easy way for me?

thank you in advance!

Jens

Strykar commented 1 year ago

Post the logs asked above.

reVolt1984 commented 1 year ago

Hello,

that is intersting. When I start it with your command I get the following error:

WARNING Master said 500 No Host option provided ERROR: we did not get config from the master. Maybe we are not configured as a slave for any of the targets on the master ?

When I start it with

sudo smokeping --slave-name=xxx --master-url=http://xxxx/smokeping/smokeping.cgi --shared-secret=/etc/smokeping/slave_secret --debug --cache-dir=/var/smokeping/

it runs fine. Can you help me out? It is not the slave name option, I tried to add it.

Thank you in advance!

Strykar commented 1 year ago

Try using this as the slave service unit file:

[Unit]
Description=SmokePing Slave
After=network-online.target
Wants=network-online.target

[Service]
User=smokeping

ExecStart=/usr/bin/smokeping --nodaemon --slave-name=xxx --master-url=http://xxxx/smokeping/smokeping.cgi --shared-secret=/etc/smokeping/slave_secret --cache-dir=/var/smokeping/

ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
reVolt1984 commented 1 year ago

Thank you, but unfortunately the issue persists:

Failed to start smokeping.service: Unit smokeping.service has a bad unit file setting.

Feb 20 14:26:42 xxxx systemd[1]: smokeping.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.

reVolt1984 commented 1 year ago

Finally it is working as intended. Needed to install smokeping manually - the version from the debian sources won´t do in my case. Thank you for your help.

reVolt1984 commented 1 year ago

I got the communication between master and slave up and running.

my problem is now: the slave runs the process defined in /etc/systemd/system/smokeping.service once and exits with

(code=exited, status=0/SUCCESS). smokeping.service: Deactivated successfully.

The process is dead after one run and won't start again.

I could fix this with a timer - but then the process will do every probe again. I got some speedtest probes active which are used to run once every hour. When my timer restarts the process every 5 minutes for the other probes the speediest will be executed every single time which causes much traffic.

Is there any way to get this slave process to stay alive?

Thank you in advance!

TheMoves commented 1 year ago

I'm also running into this as well, dang thing won't stay alive. It grabs the probes from the master and then exits out

      - name: smokeping
        image: linuxserver/smokeping:2.7.3-r9-ls27
        args:
          - "smokeping"
          - "--debug"
          - "--master-url=http://hub.local/smokeping/smokeping.cgi"
          - "--slave-name=spoke.local"
          - "--cache-dir=/var/smokeping/"
          - "--shared-secret=/var/smokeping/secret.txt"

Final output:

Sent data to Server. Server said OK
Got TERM signal, terminating child processes.
got TERM signal, terminating.
got TERM signal, terminating.
got TERM signal, terminating.
All child processes successfully terminated, exiting.
Stream closed EOF for smokeping-spoke/smokeping-6479d689bd-8762s (smokeping)
github-actions[bot] commented 1 year ago

This issue has become stale and will be closed automatically within 7 days. Comment on the issue to keep it alive.