Re: how can monitor MQ with nagios
Posted: Fri Feb 05, 2016 3:14 pm
I believe what @hsmith was talking about, is to run the vb script on windows over command prompt to make sure this is the result you're looking for.
Support for Nagios products and services
https://support.nagios.com/forum/
Code: Select all
[/settings/external scripts/scripts]
check_msmq = cscript.exe //T:30 //NoLogo scripts\\check_msmq.vbs $ARG1$Code: Select all
[/settings/external scripts/scripts]
check_msmq_1 = cscript.exe //T:30 //NoLogo scripts\\check_msmq.vbs KBID.REQUEST.MANAGER CHKBID.INTERNALS
check_msmq_2 = cscript.exe //T:30 //NoLogo scripts\\check_msmq.vbs KBID.REQUEST.MANAGER CMSREQ.TO.KBID
check_msmq_3 = cscript.exe //T:30 //NoLogo scripts\\check_msmq.vbs KBID.REQUEST.MANAGER KBID.REQUEST.CHL
check_msmq_4 = cscript.exe //T:30 //NoLogo scripts\\check_msmq.vbs KBID.REQUEST.MANAGER KBID.TO.CMSREQ
check_msmq_5 = cscript.exe //T:30 //NoLogo scripts\\check_msmq.vbs KBID.RESPONSE.MANAGER CHKBID.INTERNALS
check_msmq_6 = cscript.exe //T:30 //NoLogo scripts\\check_msmq.vbs KBID.RESPONSE.MANAGER CMSRES.TO.KBID
check_msmq_7 = cscript.exe //T:30 //NoLogo scripts\\check_msmq.vbs KBID.RESPONSE.MANAGER KBID.RESPONSE.CHL
check_msmq_8 = cscript.exe //T:30 //NoLogo scripts\\check_msmq.vbs KBID.RESPONSE.MANAGER KBID.TO.CMSRESCode: Select all
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 30 -c $ARG1$
}Code: Select all
define service{
use generic-service
host_name Chakavak
service_description KBID.REQUEST.MANAGER CHKBID.INTERNALS
process_perf_data 1
check_command check_nrpe!check_msmq_1
}
define service{
use generic-service
host_name Chakavak
service_description KBID.REQUEST.MANAGER CMSREQ.TO.KBID
process_perf_data 1
check_command check_nrpe!check_msmq_2
}
define service{
use generic-service
host_name Chakavak
service_description KBID.REQUEST.MANAGER KBID.REQUEST.CHL
process_perf_data 1
check_command check_nrpe!check_msmq_3
}
define service{
use generic-service
host_name Chakavak
service_description KBID.REQUEST.MANAGER KBID.TO.CMSREQ
process_perf_data 1
check_command check_nrpe!check_msmq_4
}
define service{
use generic-service
host_name Chakavak
service_description KBID.RESPONSE.MANAGER CHKBID.INTERNALS
process_perf_data 1
check_command check_nrpe!check_msmq_5
}
define service{
use generic-service
host_name Chakavak
service_description KBID.RESPONSE.MANAGER CMSRES.TO.KBID
process_perf_data 1
check_command check_nrpe!check_msmq_6
}
define service{
use generic-service
host_name Chakavak
service_description KBID.RESPONSE.MANAGER KBID.RESPONSE.CHL
process_perf_data 1
check_command check_nrpe!check_msmq_7
}
define service{
use generic-service
host_name Chakavak
service_description KBID.RESPONSE.MANAGER KBID.TO.CMSRES
process_perf_data 1
check_command check_nrpe!check_msmq_8
} Code: Select all
# Generic service definition template - This is NOT a real service, just a template!
define service{
name generic-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 3 times in order to determine its final (hard) state
normal_check_interval 10 ; Check the service every 10 minutes under normal conditions
retry_check_interval 2 ; Re-check the service every two minutes 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 60 ; 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!
}
# Local service definition template - This is NOT a real service, just a template!
define service{
name local-service ; The name of this service template
use generic-service ; Inherit default values from the generic-service definition
max_check_attempts 4 ; Re-check the service up to 4 times in order to determine its final (hard) state
normal_check_interval 5 ; Check the service every 5 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until a hard state can be determined
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
Can you please clarify on this?but i want just say Chakavak chk every 3min other service chk 10min
Does your SMS server have an API that you can build a script to work with?how can send sms nagios alaram (when one of my service down) ? can nagios do this ?
You can specify it on the individual services.baber wrote:but i want just say Chakavak chk every 3min other service chk 10min
Yes, you can write a command that sends it to your SMS server. Here's a good example: http://www.unixmen.com/send-nagios-aler ... using-sms/baber wrote:how can send sms nagios alaram (when one of my service down) ? can nagios do this ?
How do you send messages to your server normally? What kind of server is it?baber wrote: (from a tcp port) and sms server
Code: Select all
define command {
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
Code: Select all
define command {
command_name notify-host-by-tcp
command_line /usr/local/nagios/libexec/yourscript $NOTIFICATIONTYPE$ $HOSTNAME$ $HOSTSTATE$ $HOSTADDRESS$ $HOSTOUTPUT$ $LONGDATETIME$
}