Is there a way to create a template to carry out service check once every 4 seconds with changing check_interval in /usr/local/nagios/etc/nagios.cfg
Code: Select all
define service{
name check_api_service ; The 'name' of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
is_volatile 0 ; The service is not volatile
check_period 24x7 ; The service can be checked at any time of the day
max_check_attempts 3 ; Re-check the service up to 4 times in order to determine its final (hard) state
check_interval 15 ; Check the service once in every 24 hours under normal conditions
retry_interval 3 ; Re-check the service once in every 6 hours until a hard state can be determined
contact_groups admins ; Notifications get sent out to everyone in the 'admins' group
notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events
notification_interval 0 ; Re-notify about service problems every hour
notification_period 24x7 ; Notifications can be sent out at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
My nagios nrpe client plugin
Code: Select all
#!/bin/bash
str1=$(/usr/lib/nagios/plugins/check_http -H 'api.example.com' -S -k 'Host: api.example.com' -p 8443 -j GET -a 'username:password' -u '/services/customer/customerdata/getoperator/v5?domain=B2B&lob=Mobility&consumerTransactionId=Monitoring&consumerName=appuser&programmeName=OperatorInfo&id=9729471303&type=MSISDN&action=OperatorInfo' -e 'HTTP/1.1 200 OK' -f follow | awk '{sub(/:/,"",$2);print $2}')
if [ "$str1" == "OK" ]
then
echo "OK"
exit 0
else
echo "CRITICAL"
exit 2
fi
Best Regards,
Kaushal