Build precise queries to find exactly what you need
Press ESC to close
You will find below this improving version with Critical and Warning status:
@ECHO OFF REM ——————————————- REM – Version 0.4 – By [email protected] REM – Original Version REM ——————————————- REM – Version 0.5 – By [email protected] REM – ADD CRITICAL AND WARNING STATUS REM ——————————————- REM USAGE: check_user_count warn crit REM warn: Number of session before warning REM crit: Number of session before Critical REM Example: check_user_count 2 4 REM ——————————————- REM CALLING SEQUENCE: REM command[nrpe_nt_check_users]=c:nrpe_ntpluginscheck_user_count.bat $ARG1$ $ARG2$ REM ——————————————-
set EX=0 set MS=OK SET /a COUNT=0 FOR /f “TOKENS=1 DELIMS= ” %%G IN (‘query session ^|find “rdp-tcp#”‘) DO SET /a COUNT+=1
REM – CRITICAL (COUNT => $2) if %COUNT% GEQ %2 ( set EX=2 && set MS=CRITICAL && goto end ) REM – WARNING (COUNT => $1) if %COUNT% GEQ %1 ( set EX=1 && set MS=WARNING && goto end )
:end ECHO %MS% Number of active sessions = %COUNT% EXIT /b %EX%
Enjoy
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!