Monitor Exchange

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
aajewole
Posts: 40
Joined: Fri Aug 12, 2016 11:14 am

Monitor Exchange

Post by aajewole »

I have search the forum and could not find this. I want to monitor our exchange queue. Seem easy but hard. The plugins I found will not work or not sure how to make the ps1 file work.

https://exchange.nagios.org/directory/P ... s1/details (Getting check_nrpe Could not complete SSL handshake)

Anyone monitoring their exchange queue can help with the plugin/setup/check_command they are using please?

Nagios - 4.3.1
Microsoft Exchange server 2010 and 2016. Just need to alert on queue.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Monitor Exchange

Post by mcapra »

Which version of NSClient++ is your remote Windows machine using?

Can you also share your NSClient++ configuration file as well as the Nagios Core command/service definition you are using?
Former Nagios employee
https://www.mcapra.com/
aajewole
Posts: 40
Joined: Fri Aug 12, 2016 11:14 am

Re: Monitor Exchange

Post by aajewole »

These is the check command from the libexec directory
/check_nrpe -H cwwapp1017 -t 60 -c alias_check_queue

NSClient 0.4.4.15

Found this in NSclient log
2017-03-10 22:21:02: error:c:\source\nscp\include\nrpe/server/protocol.hpp:80: Rejected connection from: 10.104.71.77
2017-04-10 15:50:27: error:c:\source\nscp\include\socket/connection.hpp:240: Seems we cant agree on SSL: no shared cipher
2017-04-10 15:50:27: error:c:\source\nscp\include\socket/connection.hpp:241: PLease review the legacy as well as ssl options in settings.
2017-04-10 15:52:01: error:c:\source\nscp\include\socket/connection.hpp:240: Seems we cant agree on SSL: no shared cipher
2017-04-10 15:52:01: error:c:\source\nscp\include\socket/connection.hpp:241: PLease review the legacy as well as ssl options in settings.
Attachments
nsclient.txt
(1.17 KiB) Downloaded 340 times
aajewole
Posts: 40
Joined: Fri Aug 12, 2016 11:14 am

Re: Monitor Exchange

Post by aajewole »

I got pass that now. I changed the nsclient.ini ssl part to this
; Undocumented key
ssl options =

; Undocumented key
verify mode = none

; Undocumented key
insecure = true

Now, I have other errors running the check.
$ ./check_nrpe -H cwwapp -t 60 -c alias_check_queue
^C$ ./check_nrpe -H cwwapp -t 60 -c alias_check_queue -a cwwapp 1 2
Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).
$ ./check_nrpe -H cwwapp -t 60 -c alias_check_queue -a 1 2
Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).


I am following this
https://exchange.nagios.org/directory/P ... s1/details
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Monitor Exchange

Post by dwhitfield »

At the very least, you need to allow arguments in the NRPE section per http://docs.nsclient.org/howto/external_scripts/

Try that and then post the new output.
aajewole
Posts: 40
Joined: Fri Aug 12, 2016 11:14 am

Re: Monitor Exchange

Post by aajewole »

I add this line to the nsclient
[/settings/external scripts]
allow arguments = true


[/settings/external scripts/wrapped scripts]
"alias_check_queue =cmd /c echo C:scriptsNagiosNagiosMonitoring_Exchange-queue.ps1 $ARG1$ $ARG2$ $ARG3$; exit($lastexitcode) | powershell.exe -noprofile -nologo -command -"

Now if I run below command according to the plugin site
./check_nrpe -H cwwapp -t 60 -c alias_check_queue -a cwwapp 4 10

i get
Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).

If I do
./check_nrpe -H cwwapp -t 60 -c alias_check_queue

i get
Get-Queue : Exchange server "$" wasn't found. Please make sure you typed the
name correctly.
At C:\Program Files\NSClient++\scripts\NagiosMonitoring_Exchange-queue.ps1:70
char:19
+ ForEach ($Type in Get-Queue -Server $server )
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-Queue], LocalizedExcep
tion
+ FullyQualifiedErrorId : [Server=CWWAPP,RequestId=bb46d17e-e869-4118-
bb3c-ffc2b6f720b6,TimeStamp=4/11/2017 12:15:44 PM] [FailureCategory=Cmdlet
-LocalizedException] 90E70639,Microsoft.Exchange.Management.QueueViewerTas
ks.GetQueueInfo

OK: all e-mail are gone!
aajewole
Posts: 40
Joined: Fri Aug 12, 2016 11:14 am

Re: Monitor Exchange

Post by aajewole »

; Undocumented section
[/settings/NRPE/server]
allow arguments = true

[/settings/external scripts]
allow arguments = true


[/settings/external scripts/wrapped scripts]
alias_check_queue =cmd /c echo C:scriptsNagiosNagiosMonitoring_Exchange-queue.ps1 "--argument" $ARG1$ $ARG2$ $ARG3$; exit($lastexitcode) | powershell.exe -noprofile -nologo -command -

Add the first one, now I get
./check_nrpe -H cwwapp -t 60 -c alias_check_queue -a cwwapp 2 10
Failed to execute alias_check_queue: 87: The parameter is incorrect.
aajewole
Posts: 40
Joined: Fri Aug 12, 2016 11:14 am

Re: Monitor Exchange

Post by aajewole »

Finally got it to work. Just need to put it inside check command now.
[/settings/external scripts/wrappings]
ps1 = cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -

[/settings/external scripts]
allow arguments = true

[/settings/external scripts/wrapped scripts]
alias_check_queue =NagiosMonitoring_Exchange-queue.ps1 $ARG1$ $ARG2$ $ARG3$

$ ./check_nrpe -H cwwapp -t 60 -c alias_check_queue -a cwwapp 10 2
WARNING: CWWAPP\Shadow\3 = 8
aajewole
Posts: 40
Joined: Fri Aug 12, 2016 11:14 am

Re: Monitor Exchange

Post by aajewole »

It is only showing warning, why wont the critical work. Please help
/usr/local/nagios/libexec/check_nrpe -H cwwapp -t 60 -c alias_check_queue -a cwwapp 2 1
WARNING: CWWAPP1017\Shadow\3 = 30, CWWAPP1017\Shadow\3 = 30

[/settings/external scripts/wrapped scripts]
alias_check_queue =NagiosMonitoring_Exchange-queue.ps1 $ARG1$ $ARG2$ $ARG3$

define command{
command_name check_nrpe_exchangequeue
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 60 -c alias_check_queue -a $ARG1$ $ARG2$ $ARG3$
}

define service{
use generic-service
hostgroup_name ds-exchangequeue
service_description Check Exchange Queues
check_command check_nrpe_exchangequeue!$HOSTNAME$!"2"!1
}

I intentionally set critical to low figure so I can test it out.
aajewole
Posts: 40
Joined: Fri Aug 12, 2016 11:14 am

Re: Monitor Exchange

Post by aajewole »

Finally got it to work like I wanted but the alert is different from others. Because my boss wanted it to alert few people, I have the following setup,

define service{
use generic-service
hostgroup_name ds-exchangequeue
service_description Check Exchange Queues
check_command check_nrpe_exchangequeue!$HOSTNAME$!"6"!1
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
is_volatile 0
check_period 24x7
max_check_attempts 7
normal_check_interval 5
retry_check_interval 1
contacts user, usersms
contact_groups CSEXC
notification_options w,u,c,r
notification_interval 8
notification_period 24x7
}


but the email shows different with no body and no sms even though nagios log shows it sent one out.
Attachments
NagiosError.PNG
Locked