0.4.00.4.10.4.2
|
Last change
on this file since fe9cc46 was
f0607c4,
checked in by Michael Medin <michael@…>, 3 years ago
|
|
Added some missing files from 0.3.8 rel.
|
-
Property mode set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | @echo off
|
|---|
| 2 | SET RDP_PORT=%1
|
|---|
| 3 | SET NAGIOSHOST1=%2
|
|---|
| 4 | SET NAGIOSHOST2=%3
|
|---|
| 5 | SET NAGIOSHOST3=%4
|
|---|
| 6 | IF NOT DEFINED RDP_PORT GOTO :defsettings
|
|---|
| 7 | IF %RDP_PORT% EQU "-h" GOTO :usage
|
|---|
| 8 | GOTO check
|
|---|
| 9 |
|
|---|
| 10 | :defsettings
|
|---|
| 11 | set RDP_PORT=3389
|
|---|
| 12 |
|
|---|
| 13 | :check
|
|---|
| 14 | netstat -a -n | find "%RDP_PORT%" | find "LISTENING" > NUL
|
|---|
| 15 | IF %ERRORLEVEL% NEQ 0 goto portnotfound
|
|---|
| 16 |
|
|---|
| 17 | :connection_check
|
|---|
| 18 | IF NOT DEFINED NAGIOSHOST1 GOTO check_s0
|
|---|
| 19 | IF NOT DEFINED NAGIOSHOST2 GOTO check_s1
|
|---|
| 20 | IF NOT DEFINED NAGIOSHOST3 GOTO check_s12
|
|---|
| 21 | GOTO check_s123
|
|---|
| 22 |
|
|---|
| 23 | :check_s0
|
|---|
| 24 | netstat -a -n | find "%RDP_PORT%" | find "ESTABLISHED"
|
|---|
| 25 | IF %ERRORLEVEL% NEQ 0 goto noconnections
|
|---|
| 26 | exit /b 2
|
|---|
| 27 |
|
|---|
| 28 | :check_s1
|
|---|
| 29 | netstat -a -n | find "%RDP_PORT%" | find "ESTABLISHED" | find /V "%NAGIOSHOST1%"
|
|---|
| 30 | IF %ERRORLEVEL% NEQ 0 goto noconnections
|
|---|
| 31 | exit /b 2
|
|---|
| 32 |
|
|---|
| 33 | :check_s12
|
|---|
| 34 | netstat -a -n | find "%RDP_PORT%" | find "ESTABLISHED" | find /V "%NAGIOSHOST1%" | find /V "%NAGIOSHOST2%"
|
|---|
| 35 | IF %ERRORLEVEL% NEQ 0 goto noconnections
|
|---|
| 36 | exit /b 2
|
|---|
| 37 |
|
|---|
| 38 | :check_s123
|
|---|
| 39 | netstat -a -n | find "%RDP_PORT%" | find "ESTABLISHED" | find /V "%NAGIOSHOST1%" | find /V "%NAGIOSHOST2%" | find /V "%NAGIOSHOST3%"
|
|---|
| 40 | IF %ERRORLEVEL% NEQ 0 goto noconnections
|
|---|
| 41 | exit /b 2
|
|---|
| 42 |
|
|---|
| 43 | :portnotfound
|
|---|
| 44 | echo RDP not listening! Is port %RDP_PORT% (still) correct?
|
|---|
| 45 | exit /b 2
|
|---|
| 46 |
|
|---|
| 47 | :usage
|
|---|
| 48 | echo Usage: check_rdp.bat PORT HOST1 HOST2 HOST3
|
|---|
| 49 | exit /b 3
|
|---|
| 50 |
|
|---|
| 51 | :noconnections
|
|---|
| 52 | echo OK: No connections.
|
|---|
| 53 | exit /b 0
|
|---|
Note: See
TracBrowser
for help on using the repository browser.