Page 1 of 1

SMTP - state ok when unavailable

Posted: Fri Jan 03, 2020 5:55 am
by Wojtek
I would like to monitor one of smtp servers with windows and iis and check status of smtp service.
I use a wizard for this - the TCP/UDP Port Wizard. Everything looks good but I must check that server is not woring (it is test server for DEV).
How I can check and send alert when tcp port 25 will be available?

Re: SMTP - state ok when unavailable

Posted: Fri Jan 03, 2020 11:31 am
by mbellerue
Just to make sure I understand correctly, you want to check port 25 on a Windows host, and if port 25 is open, Nagios should return critical. Is that correct?

If so, you will have to build a new command for this. We can clone an existing command to make this easier, however. Go to Configure -> Core Config Manager -> Commands, and search for tcp. You will want to create a copy of check_tcp, and edit it.

Let's call the command check_tcp_negate, and we will use this as the command line,

Code: Select all

$USER1$/negate  --ok=CRITICAL --critical=OK --substitute $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
Then save the new command.

If you already have a host for this server defined, then create a new service that uses this command. Provide 25 as $ARG1$, and if port 25 is closed, the check will return OK.

Re: SMTP - state ok when unavailable

Posted: Wed Jan 08, 2020 6:17 am
by Wojtek
It works :)

Thank you for your help.

Re: SMTP - state ok when unavailable

Posted: Wed Jan 08, 2020 9:41 am
by lmiltchev
I am glad to hear that your issue has been resolved! I am closing this topic now. If you have any further questions/issues, please start a new thread. Thanks!