How to install check_mem and use it in director module (icingaweb2) on Ubuntu?

Hi I placed the check_mem module in /usr/lib/nagios/plugins but icinga2 web tells me there is no such file or directory. The file exists.

2023-02-27 17_14_44-Window

i copied the file into the right directory and gave it permissions, changed to root user and group.

What to do? How do i install nagios plugins the right way?

This is what icingaweb2 tells me:
2023-02-27 17_19_06-Window

Greetings Samuel

Hi Samuel

If I get this message, I normally try to run it on the wrong host.

What is your check source?

2 Likes

Hi Dominik,

So I have an Icinga 2 server with the web module and have deployed a host (ubuntu 18) with the director module.

I would like to monitor the memory, but I always get the same error message as above. When the check command is run should it be installed on the master as on the agent? In this the plugin check_mem.pl is only installed on the master and the agent connects to the master. I suppose check_mem.pl plugin should also be in the agent’s plugin directory, is this correct?

This is a screenshot from the webinterface of icinga 2. Where does the mem check command look for the file check_mem.pl because it is on both the Master and the agent.

Plugin directory agent:
image

plugin directory Master:
image

This is the plugin i try to use on a host:

As this plugin doesn’t look like it can do remote access it will need to exist on all devices, you want to check with it.

Still, what is the check_source?

What do you mean by what is the check_source? Sorry i am new to this :slight_smile:

Edit:

Do you mean this?

image

This is the hostname of Master server.

I am on a LAN, not monitoring over WAN.

Yes this is what I meant.
The check needs to exist on that host and I hope this is also the host, that this service is attached to as check_mem is a local check.

Hi Dominik,

Ok we are one step further.
Now it gives me this message. Do i have to give arguments or something with this plugin?

Maybe or you need to remove -h. You can check with inspect, what are the actually arguments Icinga used to call check_mem.pl with.

I see no -h in the mem config. Anything you can see that could be wrong?

Edit:

It gives me the message “has not been rendered for director”.

I didn’t meant the Object inspection of the CheckCommand but the Service.
I open them directly form the service in the Montioring module of Icingaweb2 and it looks like this:


as you can see, it’s super helpful as it shows exactly the used arguments.

image
I can see that there are no arguments given.

How to fix this? :slight_smile:

PS: thanks for all the help!

I do it by configuring the fields in the director definition of the service template and/or command.

Do i first have to create custom data fields? And then choose them in the dropdown menu of the service template?

Edit:

I am doing it on command level.

Edit:

Than on service level i can pick custom properties:

I dont realy understand how to fil this field?

I did it with tcp check and i just put in the port, but with mem i don’t get the logic…

Dominik,

i think i fixed it.


These are the fields i configured on the service:

1 Like

I think you got it.

The field are connected to the variables defined in the arguments of the command.

Dominik,

Thank u very much!

Last question, if a check like the ping4 is performed on the Master server to see if a host is online, how does it do this to a host that is on another network? Do you then have to do portforwarding to that host on the client’s firewall for example? Isn’t the idea if you work with an agent that regardless of where the host is located comes to log in to the master and all I have to do is do a portforward on my own firewall that points to the master?

this way I don’t have to ask the client to change anything on their firewall but the client comes to our firewall, or am I seeing all this wrong?

Yes, to make ping work, you need functioning routing and firewalls allowing it.
You can change the host check to use the something like “Agent Health”.
In my setup this is a service that runs:

object CheckCommand "cluster-zone" {
    import "plugin-check-command"
    timeout = 1m
    vars.cluster_zone = "$host.name$"
}

I use this on some hosts that I can’t ping.

Dominik,

i foudn a command who runs on the host:


its the hostalive command (check_ping)

Do you run it from a satellite or from the host itself?

If you don’t run it from outside the host, the host can go down and you will not notice or you will get swamped by notifications that check from the outside like SSL/TLS, SMB/CIFS, HTTP and other checks.

Using a satellite would be the preferred method to check hosts in a other network I guess.

Also using ping in stead of a agent health check would be preferred as the host isn’t necessarily down if the icinga service isn’t running.