Director new comand

hello,

I’m planning to add check_systemd_service plugin to my checks. Copied check_systemd_service file in to /usr/lib64/nagios/plugins on to client machine. I’m using Icinga Agent there, checks defined in ITL are working fine.

The question is how to add/define this check using the director.

Right now I got “Check command ‘check_systemd_service’ does not exist”

Probably I’m missing a lot in configuration…
image

Hi @hayt

Looks like you added the definitions to the master zone. If you want them to be synced to the endpoints, you have to put it into a global zone.

Kind regards

critical/config: Error: Validation failed for object ‘client_hostname!systemd_lx’ of type ‘Service’; Attribute ‘command_endpoint’: Command endpoint must be in zone ‘global-templates’ or in a direct child zone thereof.

I got this error when changed zone on global

hello @ritzgu
it’s ok, I figured it out but tell me what is best practice when it comes to configuring lots of systemd services?
How and where to add an argument with the service name. Are you able to provide a screenshot of how it should be configured?

Glad you figured it out. Do you mind sharing what the problem was? In case others have the same problem.

Depends on what you want to check. If you want to check all systemd services for failed units, you could also use the check_systemd plugin which checks all services at once.
If you only want to monitor single services I would use an apply for rule. Here is an example.

hello @ritzgu generally right now i have a problem reproducing the working state of this check ^^

there was a time when version check worked. …

image

Looks like you created a new command check_systemd_service_2. Can you show us the resolved configs for host, service and command (via Object → Preview → Show Resolved)?
grafik

hello @ritzgu

host

service
image

command
image

from the inspect

What about the command defintions for “check_systemd_service” and “check_systemd_service2” you showed earlier. Which services reference them? I can only see a command defintion for “systemd_service”. (That would explain why the checks can’t find them)

Maybe I can help you out with a possible example how to create the command from scratch:

Command Definition
Command Tab
grafik

Arguments Tab (example for the service_name parameter)

Fields Tab (adding the previously added field)

Service Definition (Apply Rule)

Note: the imported template ‘agent-service’ is a service template which has ‘run on agent’ set to ‘Yes’.
grafik

This check will then apply to all hosts with ‘debian’ in their host.name. Note that i did not set the zone anywhere.

Kind regards and a wonderful weekend :slight_smile:

@ritzgu
Cheers:) done and working.
Any advice for the future? :slight_smile:

Depends on what you want to do. :slight_smile: The docs are a good starting point.