The problem of sending a ping status
Re: The problem of sending a ping status
I'm having a hard time understanding what you want. Which script has been disabled?
Former Nagios employee
-
rumarcin11
- Posts: 36
- Joined: Thu Feb 25, 2016 7:42 am
Re: The problem of sending a ping status
Does anyone know the resp
-
rumarcin11
- Posts: 36
- Joined: Thu Feb 25, 2016 7:42 am
Re: The problem of sending a ping status
Does anyone know the resp
Re: The problem of sending a ping status
Then you have two basic options: A custom check or Nagios Reactor. First, a little bit about how Nagios works (in general):rumarcin11 wrote:This configuration only sends a status change, yet I would like to have it sends status as approximately every hour
Nagios schedules checks internally. When it is time to run a check, it executes an external command called a plugin. These are things like /usr/local/nagios/libexec/check_http and /usr/local/nagios/libexec/check_ping. The plugin does the work and exits with a Unix status code of 0, 1, or 2. These mean OK, WARNING, or CRITICAL. If it returns with any other exit code, it will be interpreted as UNKNOWN. The last line of output printed by the plugin will also be captured as additional information to be displayed on the service check within Nagios.
Normally, Nagios only tells you if a state changes from OK to CRITICAL or from WARNING to OK. It is not designed to tell you that something is OK now when it was also OK the last time it checked. The idea is that you only want to know about problems and solutions to problems, not that you want to always know that something is working correctly. The assumption is that it is always working correctly and Nagios notifies you if it is not.
To accomplish what you want, you must do something Nagios is not designed for. So you must either write a custom plugin that checks what you want and notifies directly (so that Nagios itself does not have to) or you have to use an event handler and/or Nagios Reactor to do the notification for you (and maybe also the check, in the case of Reactor). You can also just use cron to execute the check and pipe the output to /bin/mail and send it to yourself without Nagios. It's all up to you. But in the end, you need to remember that you are trying to accomplish something that Nagios is not expecting to do - notify on every OK.
I hope that gives you some ideas. They have all been discussed in previous notes, but here's a quick plugin that would do what you want:
Code: Select all
#!/bin/sh
host="$1"
warning="$2"
critical="$3"
sendTo="$4"
status=3
statusText="UNKNOWN"
output=`/usr/local/nagios/libexec/check_ping -H "$host" -w "$warning" -c "$critical"`
case "$?" in
0) status=0; statusText="OK";;
1) status=1; statusText="WARNING";;
2) status=2; statusText="CRITICAL";;
esac
echo "$output"
echo "$output" | /bin/mail -s "Nagios ping result for $host: $statusText" "$sendTo"
exit $status
EDIT: You'll need to pass hostname, warning, critical, and email address as parameters, in that order.
Last edited by eloyd on Mon Feb 29, 2016 10:59 am, edited 1 time in total.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: The problem of sending a ping status
Thanks @eloyd! That script should work well with CRON.
Let us know if you have any further questions @rumarcin11.
Let us know if you have any further questions @rumarcin11.
Former Nagios Employee
-
rumarcin11
- Posts: 36
- Joined: Thu Feb 25, 2016 7:42 am
Re: The problem of sending a ping status
One more thing I have to do to get email updates inf about nagios with the Works
-
rumarcin11
- Posts: 36
- Joined: Thu Feb 25, 2016 7:42 am
Re: The problem of sending a ping status
somehow I do not go out, and do not know how it is and how to send ping polling about the script. and yet, please explain how this skrytp, if you will all hosts send email as ping OK or separate
Re: The problem of sending a ping status
What eloyd has provided you is a cron script which will use one of the nagios plugs to check if a host is up and then send an e-mail, this is not going to use nagios to do the checks, there is some assumption that you understand how to setup jobs to run via cron
if that is confusing (which I would suspect it would be to most people) you should use nagios reactor
Nagios reactor is free and is able to do what you have requested
nagios core is not able to do what you want, it is not designed to send notifications for things which are working fine.
if that is confusing (which I would suspect it would be to most people) you should use nagios reactor
Nagios reactor is free and is able to do what you have requested
nagios core is not able to do what you want, it is not designed to send notifications for things which are working fine.
Looking forward to seeing you all at #NagiosCon2019?
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
Re: The problem of sending a ping status
A final suggestion is that if cron is beyond your skill level at this time, then you may want to consider outsourcing your Nagios configuration and management to a company more familiar with Nagios. If you are interested, PM me and we can discuss.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: The problem of sending a ping status
Thanks @eloyd and @nozlaf!
OP - let us know if you need any further help with Nagios.
OP - let us know if you need any further help with Nagios.
Former Nagios Employee