You are not logged in.
Hi forumers,
I've a problem that hangs a suspend order: popup stays on screen, mouse frozen, pushing the power button twice solves it but no suspend is possible.
This comes from Netdada trying to read FS data when FS is already suspended.
So is there a possibility to execute a pre-command script (stop Netdata) when suspending, and a post-command when restoring (start Netdata)?
Offline
Hello and welcome.
If you are using systemd, then have a look at sleep hooks.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
welcome
Thanks.
If you are using systemd, then have a look at sleep hooks.
Unfortunately, yes (by constraint) - this seems to be able to do the job, thank Toz ; once running, I'll post the bash script.
Offline
Let's gooo !
After testing your suggestion, it failed 'cos these scripts are called AFTER network's down
I tried to create other scripts into /etc/network/if-up.d & /etc/network/if-down.d, but forgot that this laptop uses network manager, so nothing's executed there.
Finally, I found an answer digging search engines, which involve 2 new scripts for shitstemd:
.
IMPORTANT: As I use Network-Manager on my laptop, the first "Before" line in the sleep script is VERY IMPORTANT - my problem was NetData trying to read something in a FUSE FS when these devices ere already down - so, as NM is ruling almost everything, is is mandatory to stop ND before it.
.
/etc/systemd/system/netdata-sleep.service :
[Unit]
Description=NETDATA Real time performance monitoring SUSPEND/HIBERNATE/HYBRID-SLEEP
Before=suspend.target
Before=hibernate.target
Before=hybrid-sleep.target
[Service]
Type=oneshot
ExecStart=/bin/systemctl stop netdata.service
# saving a big db on slow disks may need some time
TimeoutStartSec=60
[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target
and
/etc/systemd/system/netdata-resume.service :
[Unit]
Description=NETDATA Real time performance monitoring RESUME
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target
[Service]
# At the exception of the creation of /var/lib/netdata, it is the same block as in the original netdata.service
Type=simple
User=netdata
Group=netdata
RuntimeDirectory=netdata
RuntimeDirectoryMode=0775
ExecStart=/usr/sbin/netdata -P /run/netdata/netdata.pid -D
PermissionsStartOnly=true
# saving a big db on slow disks may need some time
TimeoutStopSec=60
# restart netdata if it crashes
Restart=on-failure
RestartSec=30
[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target
and last, but not the least :
systemctl enable netdata-sleep.service
systemctl enable netdata-resume.service
now, it is working ferpectly
EDIT 2018-06-20 @ 01:56 (+2) : First version of these scripts was lame (no tested enough, random success, etc), the new version is now fully tested and validated.
NB: I use netdata wirh "memory mode = ram" (scripts NOT tested with the default mode: save.)
CAUTION: AFTER A SLEEP/RESUME, YOU CANNOT DO A restart, YOU MUST stop THEN start - otherwise, you'll launch another instance of netdata !
Last edited by Niff (2018-06-20 00:07:37)
Offline
Thanks for posting back the solution. Looks like your a systemd pro now
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
I hope it'll crash and burn in horrid suffering before that… (or just come back to reason, hence KISS principle, log in clear, no multiple security holes, a real good internal structure, etc, but looking at it's developer "mind", chances are almost non-existing.)
Offline
Unfortunately, my 2nd shitstemd solution was also lame: it works, but forbids any netdata restart or even stop then start, as these orders launches another instance - I spent the whole day on it but couldn't find better (Note: if it was with sysV, it would have taken 2 minutes to definitely solve the issue.)
Costa, the netdata dev solved it by forbidding any stats taken from FUSE FS into /etc/netdata/netdata.conf:
[plugin:proc:diskspace]
exclude space metrics on filesystems = fuse*
which, in my case, isn't a problem.
Anyway, thanks, I learned a bit much about XFCE and other stuffs.
Offline
[ Generated in 0.009 seconds, 8 queries executed - Memory usage: 547.41 KiB (Peak: 548.25 KiB) ]