Page 3 of 5

Re: how can monitor MQ with nagios

Posted: Fri Feb 05, 2016 3:14 pm
by rkennedy
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.

Re: how can monitor MQ with nagios

Posted: Sat Feb 06, 2016 9:27 am
by baber
t

Re: how can monitor MQ with nagios

Posted: Sun Feb 07, 2016 8:19 pm
by Box293
See this here in your nsclient.ini file:

Code: Select all

[/settings/external scripts/scripts]
check_msmq = cscript.exe //T:30 //NoLogo scripts\\check_msmq.vbs $ARG1$
Instead of "C:\Program Files\NSClient++\scripts\check_mqstatuschannel.vbs" all you need is scripts\\check_msmq.vbs and pay special attention to the double \\

See this here:
check_msmq =

Thats the name of the command you are calling. You could code in all eight commands separately:

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.CMSRES
Then restart the NSClient++ service.

Make your command this:

Code: Select all

define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 30 -c $ARG1$
}
Make your services this:

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
} 
Then restart Nagios.

Re: how can monitor MQ with nagios

Posted: Mon Feb 08, 2016 12:39 am
by baber
so thanks from you i will be check and say result

now i want to know if i want change the time of chk service in nagios for example if i want to say nagios every 3min chk my MQ service status

i found a template.cfg file with this contains

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!
        }


now

1 - if i want to say nagios chk my MQ service every 3min what do i have to do ?
2- how can add a dashbord for example when login with user1 just see MQ ( chakavak) status ?

Best regards
Babak

Re: how can monitor MQ with nagios

Posted: Mon Feb 08, 2016 11:03 am
by rkennedy
Change the normal_check_interval from 10 to 3. This will have it check every 3 minutes.

Re: how can monitor MQ with nagios

Posted: Mon Feb 08, 2016 12:35 pm
by baber
thanks

but i want just say Chakavak chk every 3min other service chk 10min

and the other question

how can send sms nagios alaram (when one of my service down) ? can nagios do this ?

i have a sms server how can i say nagios send my alarm to sms server (from a tcp port) and sms server send alaram to my mobile

Re: how can monitor MQ with nagios

Posted: Mon Feb 08, 2016 12:40 pm
by rkennedy
but i want just say Chakavak chk every 3min other service chk 10min
Can you please clarify on this?
how can send sms nagios alaram (when one of my service down) ? can nagios do this ?
Does your SMS server have an API that you can build a script to work with?

Re: how can monitor MQ with nagios

Posted: Mon Feb 08, 2016 12:41 pm
by hsmith
baber wrote:but i want just say Chakavak chk every 3min other service chk 10min
You can specify it on the individual services.
baber wrote:how can send sms nagios alaram (when one of my service down) ? can nagios do this ?
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: (from a tcp port) and sms server
How do you send messages to your server normally? What kind of server is it?

Re: how can monitor MQ with nagios

Posted: Mon Feb 08, 2016 12:56 pm
by baber
forget sms

i want nagios send my notification such as txt string to a server with define tcp socket

Best regards
Babak

Re: how can monitor MQ with nagios

Posted: Mon Feb 08, 2016 4:27 pm
by rkennedy
So you do not want SMS alerts anymore? Generally, notifications are what core will send out.

You should be able to create a script, and define a custom command for it. You can reference the variables similar to how our notify-host-by-email command goes out.

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$
}
So, for your command definition you would need to create something similar to this -

Code: Select all

define command {
       command_name                             notify-host-by-tcp
       command_line                             /usr/local/nagios/libexec/yourscript $NOTIFICATIONTYPE$ $HOSTNAME$ $HOSTSTATE$ $HOSTADDRESS$ $HOSTOUTPUT$ $LONGDATETIME$
}
This should push that information as an input to yourscript. From there, you can send the data however you'd like.