How to add custom plugin and display it in IcingaWeb2?

Hello. First of all, sorry, if I created this topic in wrong category, but for me it seems to be the best. Anyway, I have two Ubuntu 16.04 machines, one is master setup and one satellite, where I installed Icinga2 and also IcingaWeb2 on master machine. To do so, I followed these tutorials:

  1. https://www.digitalocean.com/community/tutorials/how-to-install-icinga-and-icinga-web-on-ubuntu-16-04
  2. https://www.digitalocean.com/community/tutorials/how-to-monitor-hosts-and-services-with-icinga-on-ubuntu-16-04

Now I would like to add plugin called “check_logfiles” (couldn’t post more than 2 links, but it seems to be pretty popular plugin, so you should know which one I mean) and display its output in the IcingaWeb2. How to do it? I tried to search for different tutorials and guides, but there seems to be very little Icinga2 tutorials in the Web…

What I tried to do, is copying check_logfiles plugin to /usr/lib/nagios/plugins, then created check_logfiles.cfg in /etc/nagios-plugins/config and defined command for it, then added it to my services.conf for satellite server, but when I run “icinga2 daemon - C” to see if everything works properly, I am facing “Error: Validation failed for object ‘satellite!check_logfiles’ of type ‘Service’; Attribute ‘check_command’: Object ‘check_logfiles’ of type ‘CheckCommand’ does not exist.”.

Any guide on how to add plugin to both master and satellite servers and making it visible in IcingaWeb2 is welcomed.

Hello
The path you used is all nice and good if you use Nagios, however Icinga does not reas the /etc/nagios-plugins directory, it has it’s own ITL (Icinga Template Library) where the “built-in” commands and plugins are defined.
You can always define a new command & matching plugins in the configuration file, but it needs to end in *.conf.
To understand how to define a plugin, take a look at the documentation
https://icinga.com/docs/icinga2/latest/doc/09-object-types/#checkcommand

The issue of display is not something you need to worry about, really.
Any check performed by Icinga is written the the database and the Web reads the data from that source and then presents it.

Regards

Hi,

I’ve revamped the service monitoring chapter with many new details on adding custom plugins into your monitoring for 2.11.

Skip the parts with check-logfils.cfg into nagios-plugins, that is the old 1.x world and won’t work with Icinga. The guide you’re linking is wrong, better follow along in the official docs.

The cool thing here - the Icinga Template Library already provides the CheckCommand logfiles for your convenience. You just need to install the plugin into PluginDir, and create your service object definition.

Cheers,
Michael

Hi,

i would really appreciate a hint/link how to include this check with Icinga2 director
everything is ok as log as i use the command from the command line
within Icinaga2 the only mssage i get back is:

Plugin-Ausgabe

Icinga 2 has been running for 5 minutes and 23 seconds. Version: r2.12.3-1

and even that is wrong, Icinga is running for 10 minutes…

Hi and welcome.
Instead of “digging up the dead” :wink: , please open a new thread and explain your problem as detailed as possible.
Post info about your os, version of icinga and it’s components and used modules, provide screenshots and/or config snippets (use markdown formatting)

1 Like