Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

centengine service don't start on boot #394

Open
1 task done
vhsantos opened this issue Jul 23, 2020 · 2 comments
Open
1 task done

centengine service don't start on boot #394

vhsantos opened this issue Jul 23, 2020 · 2 comments

Comments

@vhsantos
Copy link

BUG REPORT INFORMATION

Prerequisites

The opened issue, must be code related. GitHub is not meant for support. Feel free to check the CONTRIBUTING section for more details.

Versions
20.04.4

Operating System

Ubuntu/Debian

How the the component has been installed and versions

  • From sources

Description

After install the centengine in a remote poller, the service not start on boot (but work well if you start it manually), that is because the systemd script depends of centreon and cbd services to be started before. But in this case (a remote poller), the server don't have this services installed, only the centengine.

Steps to Reproduce

Please describe precisely the steps to reproduce the encountered issue.

  1. clone the centengine repo
  2. compile and install it
  3. export the configuration from central poller
  4. check that centengine is working in the remote poller
  5. reboot the server
  6. centengine wont be running.

Describe the received result

sudo journalctl -u centengine
systemd[1]: centengine.service: Unit cannot be reloaded because it is inactive.

Describe the expected result

sudo journalctl -u centengine
-- Reboot --
systemd[1]: Started Centreon Engine.
Reading main configuration file '/etc/centreon-engine/centengine.cfg'.
Processing object config file '/etc/centreon-engine/hostTemplates.cfg'
Processing object config file '/etc/centreon-engine/hosts.cfg'
Processing object config file '/etc/centreon-engine/serviceTemplates.cfg'
Processing object config file '/etc/centreon-engine/services.cfg'
Processing object config file '/etc/centreon-engine/commands.cfg'
Processing object config file '/etc/centreon-engine/contactgroups.cfg'
Processing object config file '/etc/centreon-engine/contacts.cfg'
Processing object config file '/etc/centreon-engine/hostgroups.cfg'
Processing object config file '/etc/centreon-engine/servicegroups.cfg'
Processing object config file '/etc/centreon-engine/timeperiods.cfg'
Processing object config file '/etc/centreon-engine/escalations.cfg'
Processing object config file '/etc/centreon-engine/dependencies.cfg'
Processing object config file '/etc/centreon-engine/connectors.cfg'
Processing object config file '/etc/centreon-engine/meta_commands.cfg'
Processing object config file '/etc/centreon-engine/meta_timeperiod.cfg'
Processing object config file '/etc/centreon-engine/meta_host.cfg'
Processing object config file '/etc/centreon-engine/meta_services.cfg'
Reading resource file '/etc/centreon-engine/resource.cfg'

Workaround

Changing the systemd script (centengine.service) will work, but maybe it will generate problems in a server with centreon/cbd/centengine services. Perhaps an alternative should be to create a specific systemd script to be used when the installation are "remote poller only".

--- /lib/systemd/system/centengine.service-old
+++ /lib/systemd/system/centengine.service-new
@@ -18,10 +18,7 @@
 
 [Unit]
 Description=Centreon Engine
-PartOf=centreon.service
-After=centreon.service
-ReloadPropagatedFrom=centreon.service
-After=cbd.service
+After=network.target
 
 
 [Service]
@@ -31,5 +28,5 @@
 User=centreon-engine
 
 [Install]
-WantedBy=centreon.service
+WantedBy=multi-user.target


@UrBnW
Copy link
Contributor

UrBnW commented Sep 14, 2020

After does not mean Wants, so After=cbd.service will have no impact if you don't have cbd service on your system.
This specific cbd rule has been added thanks to #172.

@vhsantos
Copy link
Author

Hi @UrBnW ,

you are correct about that "After" don't create a service dependency, my idea in this case was to create a clear systemd script to be used in a centreon-engine only.

Anyway, to avoid to have 02 different files:

  • one to centreon-engine standalone
  • and other to centreon-engine + centreon
    a better solution is only to add this lines in the actual systemd script:
[Unit]
[...]
After=network.target

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

the first is only a good practice, but the second is necessary if we want to enable the centreon-engine service at boot.

attentive.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants