Hi,
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
Cheers,
Michael
Hi,
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
Cheers,
Michael
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?
I’ve used the following source:
wget https://github.com/osklil/nagios-misc/blob/master/check_linux_memory/check_linux_memory
Thanks:blush:
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
Cheers,
Michael
Plugin Source:
Service:
// Memory Usage
apply Service “linux_memory” {
import “generic-service”
check_command = “linux_memory”
vars.linux_memory_warning = “20”
vars.linux_memory_critical = “10”
vars.linux_memory_divider = “M”
command_endpoint = host.vars.client_endpoint
assign where host.vars.client_endpoint
}
global-template:
/* Linux Memory Command */
object CheckCommand “linux_memory” {
command = [ PluginDir + “/check_linux_memory” ]
arguments ={
“-w” = “$linux_memory_warning$”
“-c” = “$linux_memory_critical$”
“-d” = “$linux_memory_divider$”
}
}
Ok, and the executed command line on the agent? Once you’ll have it, run the following on the agent:
sudo -u icinga <insert command here>
Cheers,
Michael
I’m not sure if this is what you’re looking for, sorry…
sudo -i /usr/lib/nagios/plugins/check_linux_memory:
/usr/lib/nagios/plugins/check_linux_memory: Zeile 7: Syntaxfehler beim unerwarteten Wort `newline'
/usr/lib/nagios/plugins/check_linux_memory: Zeile 7: `<!DOCTYPE html>'
Ah. Seems you’ve downloaded an HTTP page instead of the actual plugin
Lemme guess, you’re using
wget https://github.com/osklil/nagios-misc/blob/master/check_linux_memory/check_linux_memory
… instead, you’ll need the raw file to download
wget https://raw.githubusercontent.com/osklil/nagios-misc/master/check_linux_memory/check_linux_memory
Cheers,
Michael
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?
Hi,
depending on your distribution, you may either find this packaged already as Perl library, or you’ll manually install Nagios::Plugin from CPAN.
apt-get install libnagios-plugin-perl
yum install perl-Nagios-Plugin
CentOS requires the EPEL repository up front.
yum -y install epel-release
yum makecache
Cheers,
Michael
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
Thank you!
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:
Unknown option: d
How would a manual CLI run of this plugin look like?
./check_linux_memory
check_linux_memory OK - Memory used: 7.8G/15.6G (50%), Swap used: 734M/1.7G (43%) | memused=8389021696B;;;0;16784388096 memused%=50%;;;0;100 swapused=769118208B;;;0;1795153920 swapused%=43%;;;0;100
So the plugin script doesn’t accept any threshold parameters?
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!!
Some thoughts:
mem
command that icinga2 ships inside it template library? (see: https://icinga.com/docs/icinga2/latest/doc/10-icinga-template-library/#mem)