oetiker/SmokePing

slaves not updating targets

louishot opened this issue · 7 comments

Hi guys,

I checked the code as I know smokeping slave will update targets when the slave send data to master.
https://github.com/oetiker/SmokePing/blob/2.8.2/lib/Smokeping.pm#L4841
but Not performing as expected in my environment. when update targets on master with reload, the slave never updating targets
When I restart smokeping on slave will updating targets immediately

I checked all slaves send data to master got Sent data to Server. Server said OK even if the master's target has been updated still can't see Sent data to Server and got new config in response on the slave

Any ideas please

Thank you

Still troubleshooting, I'm not sure if it's a $config_time error or $cfg->{__last}

if ($config_time < $cfg->{__last}){

I added warn "Test: slave $config_time master $cfg->{__last}"; for troubleshooting got Test: slave 1594418419 master 1594418419 at /usr/share/perl5/Smokeping/Master.pm line 304
why the $config_time always equals $cfg->{__last} Even though the master configuration has been updated

I added warn "Test: slave $config_time master $cfg->{__last}"; for troubleshooting got Test: slave 1594418419 master 1594418419 at /usr/share/perl5/Smokeping/Master.pm line 304 why the $config_time always equals $cfg->{__last} Even though the master configuration has been updated

Very interesting
1594418419 is Friday, July 10, 2020 10:00:19 PM
My smokeping master was installed just a few days ago
I'll take a look how $cfg->{__last} works

$cfg->{__last} = $cfmod;
my $cfmod = (stat $cfgfile)[9] || die "ERROR: loading smokeping configuration file $cfgfile: $!\n";
my $cfgfile = $cfg->{__cfgfile};
my $cfg = (shift @ARGV) || "$FindBin::Bin/../etc/config";

as code tracking I can see
$cfg->{__last} equal (stat "/etc/smokeping/config")[9]

I make a test for $cfg->{__last}

#!/usr/bin/perl
use warnings;
use File::stat;
my $sb = stat("/etc/smokeping/config");
print $sb->mtime;

perl test
**1594418419**root@smokeping:~#  **This is exactly the same as the timestamp above**

So $cfg->{__last} is only updated when /etc/smokeping/config changes, excluding import@ file in /etc/smokeping/config . I think it might be a bug.

As a temporary fix, you can refresh the last modified time of /etc/smokeping/config every time you update the config

touch /etc/smokeping/config

This command will set last modified time for the file to the current system time

logs on master:
Test: slave 1594418419 master 1652591251
logs on slave:
smokeping[11828]: Sent data to Server and got new config in response

I can see working fine now

May 15 05:10:44 CN-HongKong-Leaseweb smokeping[11828]: Sent data to Server and got new config in response. May 15 05:10:47 CN-HongKong-Leaseweb smokeping[11839]: Sent data to Server and got new config in response. May 15 05:12:23 CN-HongKong-Leaseweb smokeping[11840]: Sent data to Server and got new config in response
Another problem is that the slave shows "Sent data to Server and got new config in response" always
It's not a big deal though, and I didn't continue troubleshooting

another problem, the slave got two times kill HUP then dead

server has new config for me
ay 15 06:18:56 TW-Taipei-HiNet smokeping[6853]: Sent data to Server and got new config in response.
May 15 06:18:56 TW-Taipei-HiNet smokeping[6853]: server has new config for me ... HUPing the parent
May 15 06:18:58 TW-Taipei-HiNet smokeping[6852]: Sent data to Server and got new config in response.
May 15 06:18:58 TW-Taipei-HiNet systemd[1]: smokeping.service: Main process exited, code=exited, status=17/n/a
May 15 06:18:58 TW-Taipei-HiNet systemd[1]: smokeping.service: Failed with result 'exit-code'.
May 15 06:18:58 TW-Taipei-HiNet systemd[1]: smokeping.service: Consumed 1.262s CPU time.

[Sun May 15 13:29:12 2022] smokeping.cgi [client x.x.x.15]: Test: slave 1652620232 master 1652621109 at /usr/share/perl5/Smokeping/Master.pm line 304.
[pid: 3836611|app: -1|req: -1/2] x.x.x.15 () {40 vars in 537 bytes} [Sun May 15 13:29:10 2022] POST / => generated 64011 bytes in 2694 msecs (HTTP/1.1 200) 3 headers in 115 bytes (0 switches on core 1)
[Sun May 15 13:29:15 2022] smokeping.cgi [client x.x.x.15]: Test: slave 0 master 1652621109 at /usr/share/perl5/Smokeping/Master.pm line 304.
[pid: 3836611|app: -1|req: -1/3] x.x.x.15 () {40 vars in 533 bytes} [Sun May 15 13:29:13 2022] POST / => generated 64011 bytes in 1619 msecs (HTTP/1.1 200) 3 headers in 115 bytes (0 switches on core 0)

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