|
1 | | -# Nagios Plugins (Checks) |
| 1 | +# check_rdsdevicecals.ps1 |
2 | 2 |
|
3 | | -Some of my nagios plugins (checks) which might be helpful for some of you. |
| 3 | +Nagios/Centreon plugin to check your available rds device cals with usage in percent. |
4 | 4 |
|
5 | | -## Checks |
| 5 | +## Description |
6 | 6 |
|
7 | | -### Windows NRPE / NSClient++ |
| 7 | +Check your available remote desktop services (rds) device cals with usage in percent using NRPE/NSClient++. |
8 | 8 |
|
9 | | -| Check | Description | Help | |
10 | | -| :--- | :--- | :---: | |
11 | | -| [check_rds_device_cals.ps1](Scripts/Windows_NRPE/check_rds_device_cals.ps1) | Check your available rds device cals with usage in percent | [:book:](Documentation/Scripts/Windows_NRPE/check_rds_device_cals.README.md) | |
| 9 | +Could be useful for: |
| 10 | +* Windows-/Citrix-Terminalserver |
12 | 11 |
|
13 | | -## Help |
| 12 | +## Syntax |
14 | 13 |
|
15 | | - * [Windows NRPE / NSClient++ debug mode](Documentation/Windows_NRPE_debug_mode.README.md) |
16 | | - * [Nagios return codes](Documentation/Nagios_return_codes.README.md) |
| 14 | +```powershell |
| 15 | +.\check_rdsdevicecals.ps1 [-Warning] <Int32> [-Critical] <Int32> [[-KeyPackTypes] <Int32[]>] [[-ProductVersionID] <Int32[]>] [[-ComputerName] <String>] [<CommonParameters>] |
| 16 | +``` |
| 17 | + |
| 18 | +## Example |
| 19 | + |
| 20 | +```powershell |
| 21 | +PS> .\check_rdsdevicecals.ps1 -Warning 25 -Critical 10 -KeyPackTypes 2 -ProductVersionID 2,3 |
| 22 | +``` |
| 23 | + |
| 24 | +## Example return codes / output |
| 25 | + |
| 26 | +* `OK - 26 rds device cals available from 550 (95.27% usage)` |
| 27 | +* `Warning - 21 rds device cals available from 550 (96.18% usage)` |
| 28 | +* `Critical - 5 rds device cals available from 550 (99.09% usage)` |
| 29 | +* `Invalid class "Win32_TSLicenseKeyPack"` - If WMI class is not available |
| 30 | + |
| 31 | +## Install Guide |
| 32 | + |
| 33 | +### Add script to NSClient++ |
| 34 | + |
| 35 | +* Copy `check_rdsdevicecals.ps1` to `NSClient++\Scripts\` |
| 36 | +* Open up a PowerShell as an admin and set the execution policy: `Set-ExecutionPolicy RemoteSigned` |
| 37 | +* Edit `NSC.ini`, add row: |
| 38 | +``` |
| 39 | +check_rds_device_cals = cmd /c echo scripts/check_rds_device_cals.ps1 $ARG1$ $ARG2$ $ARG3$ $ARG4$; exit($lastexitcode) | powershell.exe -command - |
| 40 | +``` |
| 41 | +* Restart service NSClient++ |
| 42 | + |
| 43 | +### Create a Nagios / Centreon command |
| 44 | + |
| 45 | +* Command Name: `check_nrpe_rdsdevicecals` |
| 46 | +* Command Line: `$USER1$/plugins_app/check_nrpe -H $HOSTADDRESS$ -t 60 -c check_rdsdevicecals -a $ARG1$ $ARG2$ $ARG3$ $ARG4$` |
| 47 | +* Argument Description: |
| 48 | +``` |
| 49 | +ARG1 : Warning |
| 50 | +ARG2 : Critical |
| 51 | +ARG3 : KeyPackType |
| 52 | +ARG4 : ProductVersionID |
| 53 | +``` |
| 54 | +### Create a Host Service |
| 55 | + |
| 56 | +* Description: `rds_device_cals` |
| 57 | +* Service Template: `generic-service` |
| 58 | +* Check Command: `check_nrpe_rdsdevicecals` |
| 59 | +* Args: |
| 60 | +``` |
| 61 | +25 |
| 62 | +10 |
| 63 | +2 |
| 64 | +2,3 |
| 65 | +``` |
| 66 | +* Link the hosts you want to check |
| 67 | + |
| 68 | +## Further information |
| 69 | + |
| 70 | +### KeyPackType |
| 71 | + |
| 72 | +Select which license packs you want to check |
| 73 | + |
| 74 | +``` |
| 75 | +0 - The Remote Desktop Services license key pack type is unknown. |
| 76 | +1 - The Remote Desktop Services license key pack type is a retail purchase. |
| 77 | +2 - The Remote Desktop Services license key pack type is a volume purchase. |
| 78 | +3 - The Remote Desktop Services license key pack type is a concurrent license. |
| 79 | +4 - The Remote Desktop Services license key pack type is temporary. |
| 80 | +5 - The Remote Desktop Services license key pack type is an open license. |
| 81 | +6 - Not supported. |
| 82 | +``` |
| 83 | + |
| 84 | +More details under: [Microsoft Technet - Win32_TSLicenseKeyPack](https://msdn.microsoft.com/en-us/library/windows/desktop/aa383803%28v=vs.85%29.aspx) |
| 85 | + |
| 86 | +### ProductVersionID |
| 87 | + |
| 88 | +Select which product version (Windows Server version) you want to check |
| 89 | + |
| 90 | +``` |
| 91 | +0 - Not supported. |
| 92 | +1 - Not supported. |
| 93 | +2 - Windows Server 2008 |
| 94 | +3 - Windows Server 2008 R2 |
| 95 | +4 - Windows Server 2012 |
| 96 | +``` |
| 97 | + |
| 98 | +More details under: [Microsoft Technet - Win32_TSLicenseKeyPack](https://msdn.microsoft.com/en-us/library/windows/desktop/aa383803%28v=vs.85%29.aspx) |
0 commit comments