# How to install check\_mem and use it in director module (icingaweb2) on Ubuntu?

**URL:** <https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515>\
**Category:** Icinga 2\
**Created:** [February 27, 2023, 4:16pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515 "2023-02-27T16:16:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [February 27, 2023, 4:16pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/1 "2023-02-27T16:16:00Z")

</div>

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](https://community.icinga.com/uploads/default/original/2X/9/93a48ed78d7defc0897caab289795254ac2a0bc5.png)

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](https://community.icinga.com/uploads/default/original/2X/5/5fa624b50cb287c55929c9d88e9b0e5f8bca0879.png)

Greetings Samuel

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [February 27, 2023, 4:36pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/2 "2023-02-27T16:36:08Z")

</div>

Hi Samuel

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

What is your check source?

---

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [February 28, 2023, 2:20pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/3 "2023-02-28T14:20:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [February 28, 2023, 2:29pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/4 "2023-02-28T14:29:04Z")

</div>

![image](https://community.icinga.com/uploads/default/original/2X/9/97f9603b5ce58158e8912e8b0a8fcba4836adeb2.png)

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](https://community.icinga.com/uploads/default/original/2X/5/57d9549efdb39d975c3a86deb29fa44eb9ce43da.png)

plugin directory Master:  
 ![image](https://community.icinga.com/uploads/default/original/2X/2/2cdea7cb25a1d5575d58830dc1eff02f172dd74d.png)

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

 ![image](https://community.icinga.com/uploads/default/original/2X/2/2056b30f7ed525016879d1fd14d9a18f8466e9a0.png)

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [February 28, 2023, 3:02pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/5 "2023-02-28T15:02:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [February 28, 2023, 4:22pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/6 "2023-02-28T16:22:50Z")

</div>

What do you mean by what is the check\_source? Sorry i am new to this 🙂

Edit:

Do you mean this?

![image](https://community.icinga.com/uploads/default/original/2X/e/eb0d49575de7067d1a94052b45ec381903482bd1.png)

This is the hostname of Master server.

I am on a LAN, not monitoring over WAN.

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [February 28, 2023, 5:06pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/7 "2023-02-28T17:06:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [March 1, 2023, 9:09am UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/8 "2023-03-01T09:09:10Z")

</div>

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?

 ![image](https://community.icinga.com/uploads/default/original/2X/b/b9831fa942b91bfb9d1dec75cfd0e8c2ce88bae5.png)

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [March 1, 2023, 9:31am UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/9 "2023-03-01T09:31:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [March 1, 2023, 9:40am UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/10 "2023-03-01T09:40:34Z")

</div>

![image](https://community.icinga.com/uploads/default/original/2X/c/c4a9e49d1f52ec357a39257241bd621728cd017f.png)

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”.

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [March 1, 2023, 10:27am UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/11 "2023-03-01T10:27:14Z")

</div>

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:

 ![image](https://community.icinga.com/uploads/default/original/2X/3/363143f768f8d4781653ba46bb0c285289512732.png)  
as you can see, it’s super helpful as it shows exactly the used arguments.

---

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [March 1, 2023, 10:39am UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/12 "2023-03-01T10:39:50Z")

</div>

![image](https://community.icinga.com/uploads/default/original/2X/3/31bb1338de2e7984482466f40c93a2d6b393655a.png)  
I can see that there are no arguments given.

How to fix this? 🙂

PS: thanks for all the help!

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [March 1, 2023, 10:45am UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/13 "2023-03-01T10:45:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [March 1, 2023, 10:54am UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/14 "2023-03-01T10:54:24Z")

</div>

![image](https://community.icinga.com/uploads/default/original/2X/3/345bf6ed894596850cbd9f091b463744c3f3cf89.png)

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.

 ![image](https://community.icinga.com/uploads/default/original/2X/a/a2d074540f38076490fd5e944e264a4e3b3b581f.png)

Edit:

Than on service level i can pick custom properties:

 ![image](https://community.icinga.com/uploads/default/original/2X/9/9111b48a0eb753695002e862b81d5a1e451babd4.png)

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…

---

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [March 1, 2023, 11:31am UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/15 "2023-03-01T11:31:09Z")

</div>

Dominik,

i think i fixed it.

 ![image](https://community.icinga.com/uploads/default/original/2X/5/5b73bf4953a089241db56f5c60b666859da9eec2.png)  
These are the fields i configured on the service:  
 ![image](https://community.icinga.com/uploads/default/original/2X/f/fdb9419a07062e57c77fa359626a42ad7951b833.png)

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [March 1, 2023, 12:02pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/16 "2023-03-01T12:02:09Z")

</div>

I think you got it.

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

---

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [March 1, 2023, 2:10pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/17 "2023-03-01T14:10:59Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [March 1, 2023, 2:24pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/18 "2023-03-01T14:24:45Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![SamuelB](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@SamuelB](https://community.icinga.com/u/SamuelB)\
**Post date:** [March 1, 2023, 2:52pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/19 "2023-03-01T14:52:51Z")

</div>

Dominik,

i foudn a command who runs on the host:

 ![image](https://community.icinga.com/uploads/default/original/2X/0/0f8db5ed7daa99e1315b335a09cbd17eccf8ce3f.png)  
its the hostalive command (check\_ping)

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [March 1, 2023, 3:27pm UTC](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515/20 "2023-03-01T15:27:44Z")

</div>

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.

[Next page](https://community.icinga.com/t/how-to-install-check-mem-and-use-it-in-director-module-icingaweb2-on-ubuntu/11515.md?page=2)
