Where do I have do define this check_command? I’ve already tried to enter this check_command in conf.d/commands.conf or conf.d/services.conf Or what else am I missing? Since there’s the following error showing up at validation:
critical/config: Error: Validation failed for object 'xy-server!linux_memory' of type 'Service'; Attribute 'check_command': Object 'linux_memory' of type 'CheckCommand' does not exist.
both endpoints need to be aware of the command: The master in order to resolve the given command argument parameters, and the client to really calculate the command line being executed. The client may use a different local command to ignore certain passed parameters (for security reasons, but it is not general best practice).
Therefore, it is advised to put the CheckCommand into a global zone, namely global-templates which already comes pre-defined in the node wizard setups in recent versions.
mkdir -p /etc/icinga2/zones.d/global-templates
vim /etc/icinga2/zones.d/global-templates/commands.conf
...
systemctl restart icinga2
that’s coming from the plugin’s execution itself. I don’t know which source you did use, nor how the check command itself looks like, nor the executed command line. Please share that
I have noticed that my nagios plugins are in /usr/lib64/nagios/plugins and not in /usr/lib/nagios/plugins, probably because of CentOS…
So it’s might looking in the wrong place?
The plugin is executed already, so it shouldn’t be a location problem. To me, this sounds more like a missing code, wrong indent or interpreter, or whatever else. Time is limited so please provide the requested things
You are absolutely correct! I’ve downloaded the HTTP page
We are one step further now:
Can't locate Nagios/Plugin.pm in @INC (you may need to install the Nagios::Plugin module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/lib/nagios/plugins/check_linux_memory line 28.
BEGIN failed--compilation aborted at /usr/lib/nagios/plugins/check_linux_memory line 28.
I suspect, “perl-Nagios-Plugin” is missing?
The equivalent for debian would be “libnagios-plugin-perl” right?
Side note for Ubuntu 18.04 (and maybe other new debian-based systems):
On Ubuntu 18.04 you can install the package called libmonitoring-plugin-perl.
Downside is you have to change Nagios::Plugin to Monitoring::Plugin in the depending scripts.
For example with vim command line and %s/Nagios::Plugin/Monitoring::Plugin/g
Unfortunately, apt-get install libnagios-plugin-perl does not seem to work on my debian 9 server:
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Paket libnagios-plugin-perl ist nicht verfügbar, wird aber von einem anderen Paket
referenziert. Das kann heißen, dass das Paket fehlt, dass es abgelöst
wurde oder nur aus einer anderen Quelle verfügbar ist.
E: Für Paket »libnagios-plugin-perl« existiert kein Installationskandidat.
I was able to install apt-get install libmonitoring-plugin-perl, but that’s not going to do the trick, right?
Open your script with vim. When the file is open enter a : to enter the command line of vim.
On the command line just paste the command %s/Nagios::Plugin/Monitoring::Plugin/g and hit enter.
Now all occurrences of Nagios::Plugin are replaced by Monitoring::Plugin
Now just enter :x!or :wq to save the file. After this you should be able to run the script.
I’ve edited the check_linux_memory file in /usr/lib/nagios/plugins.
Now I’m not getting an error anymore, but the check is now purple in IcingaWeb2 with the following text:
I commented them out for now. It’s running perfectly without any threshold values.
I’m gonna try a few things and I’ll see if I’ll get it to work with threshold parameters. But thats not too important right now. Thanks very much for your help guys!!