Hello
I have Nagios core running and I want to run a command on a remote host and the result of this command produces some info
and to alert Nagios if some of this information is missing with the message that this particular information is missing
it is probably a plugin
checking for certain parameters in a command
Re: checking for certain parameters in a command
Hi @DOkuwa,
The best way to run a command on a remote host would be to download our NRPE agent.
https://support.nagios.com/kb/article.php?id=515
I don't know what check you want to run or what information you want Nagios to be alerted from.
Our Nagios plugins usually allow you to pass warning and critical thresholds, thus this output will be sent to Nagios and let you know if the check command on the remote host is OK, Warning, Critical
Let us know if this helps!
The best way to run a command on a remote host would be to download our NRPE agent.
https://support.nagios.com/kb/article.php?id=515
I don't know what check you want to run or what information you want Nagios to be alerted from.
Our Nagios plugins usually allow you to pass warning and critical thresholds, thus this output will be sent to Nagios and let you know if the check command on the remote host is OK, Warning, Critical
Let us know if this helps!
Re: checking for certain parameters in a command
Hi @DOkuwa,
@kyang is right. However,can you please give an example of the kind of information you want nagios to check.
@kyang is right. However,can you please give an example of the kind of information you want nagios to check.
Re: checking for certain parameters in a command
on a remote server I run this command as a root
brcontrol at the command prompt and get the following result below
if there is some missing information( all the information below is not complete) create a warning alarm describing what is missing , if the information is complete there is an alarm saying it is ok
please guide me .
and if the broker is not working at all create a critical alarm
Broker is located at: 10.241.10.41:426 Started: Nov 5 17:58:38 2015
Domain Host Name Port PID State Last Change Time
---------------------- --------------------------------------- ------ ------- ------- --------------------
INCHARGE-SA-PRES sam-pres-01 19500 2118 RUNNING Sep 20 15:05:15 2017
xxx-apm-01 apm-01 19510 29889 RUNNING Jun 17 23:00:28 2017
xxx-apm-02 apm-01 19514 30117 RUNNING Jun 17 22:59:58 2017
xxx-apm-03 apm-01 19512 30355 RUNNING Jun 17 23:00:27 2017
xxx-apm-04 apm-01 19511 30594 RUNNING Jun 17 23:00:06 2017
xxx-apm-05 apm-02 19510 37029 RUNNING Jun 17 22:41:18 2017
xxx-apm-06 apm-02 19515 36796 RUNNING Jun 17 22:41:13 2017
brcontrol at the command prompt and get the following result below
if there is some missing information( all the information below is not complete) create a warning alarm describing what is missing , if the information is complete there is an alarm saying it is ok
please guide me .
and if the broker is not working at all create a critical alarm
Broker is located at: 10.241.10.41:426 Started: Nov 5 17:58:38 2015
Domain Host Name Port PID State Last Change Time
---------------------- --------------------------------------- ------ ------- ------- --------------------
INCHARGE-SA-PRES sam-pres-01 19500 2118 RUNNING Sep 20 15:05:15 2017
xxx-apm-01 apm-01 19510 29889 RUNNING Jun 17 23:00:28 2017
xxx-apm-02 apm-01 19514 30117 RUNNING Jun 17 22:59:58 2017
xxx-apm-03 apm-01 19512 30355 RUNNING Jun 17 23:00:27 2017
xxx-apm-04 apm-01 19511 30594 RUNNING Jun 17 23:00:06 2017
xxx-apm-05 apm-02 19510 37029 RUNNING Jun 17 22:41:18 2017
xxx-apm-06 apm-02 19515 36796 RUNNING Jun 17 22:41:13 2017
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: checking for certain parameters in a command
You will likely need to write a nagios plugin which is a script that runs the command you want, parses the information returned from the command and then outputs that information and the appropriate exit code.
https://nagios-plugins.org/doc/guidelines.html
Then you would use the link @kyang gave above to call the script.
One thing to point out is that if the script needs to call somethis as root, you will need to ad a line like this with visudo
https://nagios-plugins.org/doc/guidelines.html
Then you would use the link @kyang gave above to call the script.
One thing to point out is that if the script needs to call somethis as root, you will need to ad a line like this with visudo
Code: Select all
Defaults:nagios !requiretty
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/your-script-name.sh
Re: checking for certain parameters in a command
Thanks @scottwilkerson
I am looking also on the internet for some examples to follow
Please point if you have seen one
Just a basic one
I am looking also on the internet for some examples to follow
Please point if you have seen one
Just a basic one
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: checking for certain parameters in a command
This is really going to depend on what the expected output is and what you want to alert on.DOkuwa wrote:Thanks @scottwilkerson
I am looking also on the internet for some examples to follow
Please point if you have seen one
Just a basic one
Re: checking for certain parameters in a command
like I said
just to run the command and then parses the info and then create a notification or warning alert if any of the e.g any of the ports are missing and another critical notification/alert if the command does not run
Thanks
just to run the command and then parses the info and then create a notification or warning alert if any of the e.g any of the ports are missing and another critical notification/alert if the command does not run
Thanks
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: checking for certain parameters in a command
Ok, then you would want to follow these guidelines in the programming language of your choice as long as it can run on your Nagios sevver.DOkuwa wrote:like I said
just to run the command and then parses the info and then create a notification or warning alert if any of the e.g any of the ports are missing and another critical notification/alert if the command does not run
Thanks
https://nagios-plugins.org/doc/guidelines.html
Good luck on your first Nagios plugin!