Check command 'systemd_service' does not exist

Hello!

I am new to Icinga2 and have a problem configuring a custom plugin/check command.

I downloaded and added the check_systemd_service file and added it on my master to /usr/lib/nagios/plugins. Then i configured the command in Icingaweb2.
The problem now is, that this file is not deployed from the master to the agents, so i get “Check command ‘systemd_service’ does not exist.” as check result.
On one agent i manually added the check_systemd_service file manually to the same path like on the master and the check works fine now. But i expectet, that the file ist distributed automatically to the agents.

Would be great if someone could help me to get this working oder if someone could tell me what would be the best practice to deploy command files automatically.

Thanks in advance!

Give as much information as you can, e.g.

  • Version used (icinga2 --version): r2.13.0-1
  • Operating System and version: Debian 10
  • Enabled features (icinga2 feature list): api checker command ido-mysql influxdb2 livestatus mainlog notification perfdata
  • Icinga Web 2 version and modules (System - About): 2.9.2
  • Config validation (icinga2 daemon -C)
[2021-08-22 20:32:55 +0200] information/cli: Icinga application loader (version: r2.13.0-1)
[2021-08-22 20:32:55 +0200] information/cli: Loading configuration file(s).
[2021-08-22 20:32:56 +0200] information/ConfigItem: Committing config item(s).
[2021-08-22 20:32:56 +0200] information/ApiListener: My API identity: icinga2.home.domain.de
[2021-08-22 20:32:56 +0200] warning/ApplyRule: Apply rule 'notification_host_down' (in /var/lib/icinga2/api/packages/director/68cbdd02-1e4d-4963-be97-6ddde60b8db2/zones.d/master/notification_apply.conf: 1:0-1:50) for type 'Notification' does not match anywhere!
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 IcingaApplication.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 10 Hosts.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 FileLogger.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 CheckerComponent.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 Influxdb2Writer.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 ApiListener.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 IdoMysqlConnection.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 10 Zones.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 ExternalCommandListener.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 8 Endpoints.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 ApiUser.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 245 CheckCommands.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 LivestatusListener.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 NotificationComponent.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 UserGroup.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 User.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 53 Services.
[2021-08-22 20:32:56 +0200] information/ConfigItem: Instantiated 1 PerfdataWriter.
[2021-08-22 20:32:56 +0200] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars'
[2021-08-22 20:32:56 +0200] information/cli: Finished validating the configuration file(s).
  • If you run multiple Icinga 2 instances, the zones.conf file (or icinga2 object list --type Endpoint and icinga2 object list --type Zone) from all affected nodes:
    Master:
/*
 * Generated by Icinga 2 node setup commands
 * on 2021-07-27 12:16:22 +0200
 */

object Endpoint "icinga2.home.domain.de" {
}

object Zone "master" {
        endpoints = [ "icinga2.home.domain.de" ]
}

object Zone "global-templates" {
        global = true
}

object Zone "director-global" {
        global = true
}

Agent:

/*
 * Generated by Icinga 2 node setup commands
 * on 2021-08-20 21:10:16 +0200
 */

object Endpoint "icinga2.home.domain.de" {
        host = "icinga2.home.domain.de"
        port = "5665"
}

object Zone "master" {
        endpoints = [ "icinga2.home.domain.de" ]
}

object Endpoint NodeName {
}

object Zone ZoneName {
        endpoints = [ NodeName ]
        parent = "master"
}

object Zone "global-templates" {
        global = true
}
object Zone "director-global" {
        global = true
}

Hi & welcome,

this is not a job for icinga but for devops candidates e.g. Ansible, Chef, Puppet, Saltstack etc.

BTW: For better readability we always love to see posts formatted according to this guideline.

2 Likes

The CheckCommand can be distributed via Icinga2 (depending on Zone, configurations), but the plugin script itself needs to be deployed by some other means as @rsx stated.

Your error seems to indicate the CheckCommand was missing, as opposed to execvpe (...) failed: No such file or directory which indicates the plugin script defined by the CheckCommand is inaccessible.

You may also want to consider using PluginContribDir (defined in constants.conf) as a prefix and syncing that directory across your hosts by some other means (rpm, config management, etc).

1 Like

Thank you both for your replies!

I already suspected that I would have to distribute the plugin files with ansible or something similar. But I wasn’t sure and wanted to rule out that I had done something wrong with the configuration.

Is there already a playbook for ansible that you can recommend for the task?

Many thanks for your help!