I was reading along, was interested in having something similar.
Nagios Exchange has a bat file you can download: Check connect from windows host. - Nagios Exchange
It needs a free to download file called PortQry.exe from Microsoft: https://www.microsoft.com/en-us/download/details.aspx?id=17148
Documentation of PortQry.exe, so you know what bat file does: Using the PortQry command-line tool - Windows Server | Microsoft Learn
You need to change the line in check_connect.bat where PortQry.exe is stored.
Output of bat will be something like:
C:\portqry> .\check_connect.bat google.com tcp 80
OK: tcp port 80 on google.com LISTENING.
C:\portqry> .\check_connect.bat google.com tcp 555
CRITICAL: tcp port 555 on google.com NOT LISTENING!
I haven’t implemented it as mrpe in checkmk yet.
Weekend soon, and need to finish some other stuff first. (-;
EDIT: implemented above as mrpe, but don’t get it to work yet.
change of the check_mk.user.yml
mrpe:
enabled: yes
timeout: 60
config:
- check = google.com 'C:\ProgramData\checkmk\agent\mrpe\check_connect.bat google.com tcp 80'
I don’t get a new undecided service in service configuration. Not sure what is missing to make it work. Running bat from powershell prompt works fine.
PS C:\ProgramData\checkmk\agent\mrpe> .\check_connect.bat google.com tcp 80
OK: tcp port 80 on google.com LISTENING.
The only thing I can think of are the missing warning & critical options, but bat doesn’t produce a metric, just a state.
EDIT2: Was checking agent log filled with errors, which seem unrelated. But still, need dig deeper, but not now. Commented out config changes. Something to look at for another time …