Nagios Exchange Nagios Exchange
  • Home
  • Directory
  • Library
  • Support
  • About

Advanced Search

Build precise queries to find exactly what you need

Search Logic

Select compatible versions

Press ESC to close

Sign In Sign Up
  • Home
  • Directory
  • Library
  • Support
  • About
Plugins4387Themes and Skins11Add-ons734Documentation283Graphics and Logos36View All Categories
LinuxSecuritySNMPFile SystemCloud
New Listings Recently Updated Listings Most Favored Listings Most Popular Listings Most Rated Listings Most Reviewed Listings
Random Project
Reporting and Graphing Series Nagios XI – Reporting & Graphing – NNA Reports in XI
0.0 (0)
4.9K
RSS Feed
Newest Listings Updated Listings
Top Contributors
Julien DESMAREST (6)LAMY (6)Davide Lemma (4)deskwork_itunes142 (4)Joerg Hoerter (3)
See More
Newest Contributors
Guillaume8723 (1)Salvo (1)SOHA-IT (1)Tsvetomir Tsvetanov (1)Igor Ru (1)
See More

Copyright © 2009-2025 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home > EJO
E

EJO

@ejo1974

User Stats

Member Since: May 8, 2013

Favorites0

Views

Projects0

No Projects Found
Count number of terminal server sessions

Bugfix

Thanks for this code, it is very helpful for monitoring our RDP farm! In the code above I found 2 bugs: Introduced in version 0.6. In this version the checks for WARNING and CRITICAL were turned around. As a result the program is creating a warning when the warning level is reached and exits instead of checking if the critical level is reached. @Napsty: Your addon displays the count again instead of the usernames of the connected users, correct command: ECHO Number of active sessions = %COUNT%^|usersconnected=!USER! New code (based on version 0.6 and added unnumbered addons from lumezit and Napsty) and some personal changes: @ECHO OFF setlocal EnableDelayedExpansion 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 - Version 0.6 - By [email protected] REM - ADD USERNAME LOGGED IN REM ------------------------------------------- REM - Version 0.7 - By [email protected] REM - Bugfix REM - Formatting changes 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 SET USER= FOR /f "TOKENS=1" %%i IN ('query session ^|find "rdp-tcp#"') DO SET /a COUNT+=1 FOR /f "TOKENS=2" %%G IN ('query session ^|find "rdp-tcp#"') DO ( call :subroutine %%G ) 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 ) REM - NOT CRITICAL / WARNING set EX=0 set MS=OK goto end :subroutine SET USER=%USER% %1 GOTO :eof :end ECHO %MS% - Number of active sessions = %COUNT% ^| Logged Users = !USER! EXIT /b %EX%

Reviewed 12 years ago

No Favorites Found

Copyright © 2009-2025 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home Browse Submit Profile