python-diamond / Diamond

Diamond is a python daemon that collects system metrics and publishes them to Graphite (and others). It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.
http://diamond.readthedocs.org/
MIT License
1.74k stars 601 forks source link

patch for fixing systemd service restart problem #639

Closed sideffect0 closed 2 years ago

sideffect0 commented 7 years ago

This fixes start problem when using systemctl restart

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 24.667% when pulling 958917f7a470cd1307bf139c836b6834c25c5316 on sideffect0:fix-systemd-service into b9845430f8ee244b5c7e2bddc4f1f0dd659643a9 on python-diamond:master.

shortdudey123 commented 7 years ago

Can you link to which specific issue you are solving for reference? or provide a lot more context on what you are seeing?

sideffect0 commented 7 years ago

On restart ing the service with
systemctl restart diamond
The command will fail with error because, diamond.service: Start request repeated too quickly.
with recent version of systemd in ubuntu or debian distros.

shortdudey123 commented 7 years ago

Can you create an issue with full info to go along with this PR then? I have yet to see that message and i use centos7 exclusively

sideffect0 commented 7 years ago

Created the issue https://github.com/python-diamond/Diamond/issues/640

trinitronx commented 4 years ago

Note: using sleep can introduce race conditions here... especially with SystemD which likes to spawn as many services in parallel as possible.

If any other service uses Wants=diamond.service, or Requires=diamond.service, expecting that Diamond is running... this guarantee can not be met and you will encounter problems with race conditions on service startup ordering during system boot.

Better to use Type=notify, and patch Diamond to work directly with SystemD and play nicely with it. That will avoid all types of race condition problems!

shortdudey123 commented 2 years ago

See #640