Hello Scott,
I do not have access to view that post.
viewtopic.php?f=16&t=6659&p=30341&hilit=send_nsca#p30341
Please advise.
--Darryn
Alerting Utilizing NSCA from Core to XI
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Alerting Utilizing NSCA from Core to XI
I'm sorry, didn't notice that was on the customer only forum, I'll post it below for completeness
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Alerting Utilizing NSCA from Core to XI
Here's an example using NSCA
The major goal of the noncentral server is to distribute the results of all service checks to the central server. The noncentral
Nagios machines must use OCSP and OCHP in order to send the proper updates to the central server.
The default nagios.cfg has these settings.
Change the nagios.cfg settings to those below. The timeout prevents your Nagios server from spending too much time
on one command.
You will need to create two scripts in the /usr/local/nagios/libexec/eventhandlers (RPM repository
/usr/lib/nagios/plugins/eventhandlers/) directory.
service_check
host_check
Create a file called misccommands.cfg in the /usr/local/nagios/etc/objects (RPM repository /etc/nagios/objects)
directory so you can add the new commands.
Be sure to add this line to your nagios.cfg file.
The major goal of the noncentral server is to distribute the results of all service checks to the central server. The noncentral
Nagios machines must use OCSP and OCHP in order to send the proper updates to the central server.
The default nagios.cfg has these settings.
Code: Select all
obsess_over_services=0
#ocsp_command=somecommand
obsess_over_hosts=0
#ochp_command=somecommandon one command.
Code: Select all
obsess_over_services=1
ocsp_command=service_check
ocsp_timeout=5
obsess_over_hosts=1
ochp_command=host_check
ochp_timeout=5/usr/lib/nagios/plugins/eventhandlers/) directory.
service_check
Code: Select all
#!/bin/bash
# Service Check
cmd="/usr/local/nagios/bin/send_nsca"
cfg="/usr/local/nagios/etc/send_nsca.cfg"
host=$1
srv=$2
result=$3
output=$4
/bin/echo -e
"$host\t$srv\t$result\t$output\n" | $cmd -h <CENTRAL_NAGIOS_IP> -c $cfgCode: Select all
#!/bin/bash
# Host Check
cmd="/usr/local/nagios/bin/send_nsca"
cfg="/usr/local/nagios/etc/send_nsca.cfg"
host=$1
result=$2
output=$3
/bin/echo -e
"$host\t$result\t$output\n" | $cmd -h <CENTRAL_NAGIOS_IP> -c $cfgCode: Select all
chmod 755 service_check
chmod 755 host_check
chown nagios:nagios *directory so you can add the new commands.
Code: Select all
define command{
command_name service_check
command_line $USER1$/eventhandlers/service_check $HOSTNAME$ '$SERVICEDESC$' $SERVICESTATEID$ '$SERVICEOUTPUT$'
}
define command{
command_name host_check
command_line $USER1$/eventhandlers/host_check $HOSTNAME$ $SERVICESTATEID$ '$SERVICEOUTPUT$'
}Code: Select all
cfg_file=/usr/local/nagios/etc/objects/misccommands.cfgRe: Alerting Utilizing NSCA from Core to XI
I will give this a try.
Thanks!
Thanks!
Re: Alerting Utilizing NSCA from Core to XI
Let us know how this works for you
Former Nagios employee