Page 1 of 2
Nagios needed server checks - advices are welcome
Posted: Mon Nov 06, 2017 8:39 am
by Shwele
Hello guys,
I need advice and help for setting up mysql checks, SSH maybe and so, for hosts that I want to check. Wizard for creating Linux host over SNMP had only these:
Code: Select all
/ Disk Usage
apache2 <-- added it
CPU Usage
Memory Usage
Ping
Swap Usage
When I added service and it gives output
Please select a mode
And SSH shows socket timeout.
I've used check_xi_mysql_health and check_xi_status_ssh .
Also I am opened for advice what should I implement to check on servers that I plan to add on nagios.
Also if there is something I missed during installation wizard, let me know.
Update:
Found this as possible solution, dunno if anyone used it?
https://labs.consol.de/nagios/check_mysql_health/
Also if this part of documentation has needed checks, let me know if there is some of those I should add:
https://support.nagios.com/kb/article/n ... ource.html
For example I need check for shiny server or at least check app on certain port.
Re: Nagios needed server checks - advices are welcome
Posted: Mon Nov 06, 2017 10:53 am
by Shwele
Update:
I managed to add mysql process with success! I just needed to run mysql wizard and select same host, create valid user and all.
SSH still having issues with socket timeout. - need help with this
I am highly interested in AR server integrations, because colleague of mine would benefit to check if his app is working or not.
Re: Nagios needed server checks - advices are welcome
Posted: Mon Nov 06, 2017 4:38 pm
by dwasswa
Hi
@Shwele,
I want to clarify a few things:
What plugin are you using to monitor by
SSH?
Please post how you have your command defined.
Are you trying to monitor your
AR server by
SSH?
How did you set up ssh monitoring on your
Nagios XI server?
Have you looked at the following kb article....
Monitoring_Hosts_Using_SSH ?
Re: Nagios needed server checks - advices are welcome
Posted: Tue Nov 07, 2017 6:27 am
by Shwele
Hi
@dwasswa,
Thanks for asking, sometimes I fail to relay the point I want to make
I have used documentation as you provided, using check_ssh . So far I'm getting nowhere with this output:
Code: Select all
Remote command execution failed: sh: 1: /usr/local/nagios/libexec/check_procs: not found
Are you trying to monitor your AR server by SSH?
No, sorry, I meant that I am asking for advice on how to monitor AR server in general. Be it SSH or SNMP or any other possible way, cause I am in need of advice.
NRPE is out of the question due that servers are up and running already for some time and wouldn't want to break server with it.
Re: Nagios needed server checks - advices are welcome
Posted: Tue Nov 07, 2017 2:01 pm
by kyang
Are you trying to pass check_procs using check_ssh to the remote server?
If so, check_by_ssh would be the one to use. (Here's an example, I don't have ssh keys configured, but if I did it wouldn't ask for a password.) It would just execute.
(The host is my remote host)
Code: Select all
./check_by_ssh -H 192.168.4.125 -C '/usr/local/nagios/libexec/check_procs -w 10 -c 20 --metric=CPU'
[email protected]'s password:
CPU OK: 165 processes | procs=165;;;0; procs_warn=0;;;0; procs_crit=0;;;0;
@dwasswa has passed the documentation to you in a previous post for using this plugin.
SSH is a way if you don't want to have NRPE. Where is your AR server installed on?
Re: Nagios needed server checks - advices are welcome
Posted: Wed Nov 08, 2017 6:24 am
by Shwele
Woah, new website design had me like:
Hello
@kyang,
I used SSH keys and tried to connect to it and it gives me that output. Using ssh nagios@ip works as well.
And yes, I used same syntax, literally copied it from nagiosxi.
Commands are working alright, checked locally if I can get output from nagios server:
Code: Select all
/usr/local/nagios/libexec/check_procs -w 10 -c 20 --metric=CPU
CPU OK: 102 processes | procs=102;;;0; procs_warn=0;;;0; procs_crit=0;;;0;
On the other hand, this gives output:
Code: Select all
/usr/local/nagios/libexec/check_by_ssh -H xxx.xxx.xxx.xxx -C uptime
15:10:45 up 1 day, 5:17, 0 users, load average: 0.11, 0.06, 0.02
So SSH is working correctly, but when you call command in command it fails to read the output?
@dwasswa 's link to documentation was helpful and it did show me correct way to do it (i missed a few steps beforehand).
But even now, when I followed it trough, it doesn't work and gives me that output.
AR server is installed on same server we have website on, we are going to launch it pretty soon so I wondered to add some checks to it. For now I just did basic check for shiny process, whether its running or not.
Re: Nagios needed server checks - advices are welcome
Posted: Wed Nov 08, 2017 12:25 pm
by kyang
Is the new website design a good thing?
So SSH is working correctly, but when you call command in command it fails to read the output?
Just to be sure, something like this doesn't work?
Code: Select all
./check_by_ssh -H 192.168.4.125 -C '/usr/local/nagios/libexec/check_procs -w 10 -c 20 --metric=CPU'
Let's try adding the
-E to see if that will work.
-E, --skip-stderr[=n]
Ignore all or (if specified) first n lines on STDERR [optional]
Code: Select all
./check_by_ssh -H <remotehostIP> -E -C '/usr/local/nagios/libexec/check_procs -w 10 -c 20 --metric=CPU'
Re: Nagios needed server checks - advices are welcome
Posted: Thu Nov 09, 2017 5:17 am
by Shwele
Yeah, I just need to get used to it, cause I lurked mostly when I was on previous job, never made account and got accustomed to it. Also seen similar basic themes on many forums too. It's a nice change.
Yes, this command
Code: Select all
./check_by_ssh -H 192.168.4.125 -C '/usr/local/nagios/libexec/check_procs -w 10 -c 20 --metric=CPU'
Shows this output:
Code: Select all
Remote command execution failed: sh: 1: /usr/local/nagios/libexec/check_procs: not found
And with -E it shows:
Code: Select all
UNKNOWN - check_by_ssh: Remote command '/usr/local/nagios/libexec/check_procs -w 10 -c 20 --metric=CPU' returned status 127
Maybe my SSH configuration on both servers is at fault? Is there something in config for SSH that needs to be added in order to be connected with Nagios?
Added sshd_config in attachment.
Re: Nagios needed server checks - advices are welcome
Posted: Thu Nov 09, 2017 1:22 pm
by dwasswa
Hi
@Shwele,
The error
UNKNOWN - check_by_ssh: Remote command '/usr/local/nagios/libexec/check_procs -w 10 -c 20 --metric=CPU' returned status 127 means you either have the wrong path i.e you have nagios plugins installed in a different directory, or you do not have the plugins installed at all.
When you run the command
./check_by_ssh -H xxx.xxx.x.xx -C '/usr/local/nagios/libexec/check_procs -w 10 -c 20 --metric=CPU' on the Nagios XI sever, the
check_by_ssh connects to your remote host, goes into the
/usr/local/nagios/libexec folder on your remote host and executes
check_procs -w 10 -c 20 --metric=CPU.
The
/usr/local/nagios/libexec is where the nagios plugins are installed on your remote host(server).
Therefore, please clarify for me a few things:
Have you installed the Nagios plugins on your remote host e.g
check_procs etc?
If you haven't yet installed the plugins on your remote host, please read through this kb article...
Installing Nagios Plugins From Source
What Linux version are you running on your remote host?
Re: Nagios needed server checks - advices are welcome
Posted: Fri Nov 10, 2017 6:49 am
by Shwele
Heya
@dwasswa,
Thanks for showing my flaw in my configuration. I wasn't aware that nagios plugins need to be installed on server itself. I was under impression that you call those from nagios server, send the query to it and you receive output from the server.
Never even thought that those plugins were meant for servers you are trying to monitor, I was under impression that those were for nagios server.
Anyhow, everything works now!
Linux 16.04

Now not much relevant but don't wanna leave ya hanging.
I still haven't found any other way to check AR server, other than tracking shiny app if the service is running or not. We have subdomain on what app will be running, that we will integrate into the website as iFrame popup. So my thinking is, we only check that subdomain for app checks via http or is there unique plugin that checks server for AR server... stuff.