A site I work with uses the Cisco Voice/Collaboration platform and doesn’t have a good mechanism for monitoring it. They use PRTG so this was a great opportunity for me to build upon my rather basic PowerShell scripting skills and create a useful PRTG sensor.
The script queries the Call Manager Control Center Services SOAP API, enumerates the available services and then returns an error to PRTG if any of the activated services are not in a running state. The first step is to create an Application User on the Call Manager to use for authentication. It is recommended to create an Access Control group, add the Application User and then assign the necessary roles. The roles used were as below.
Now we need to encrypt the password that we will use in the script as it is never a good idea to leave plain text passwords lying about!
We will use Windows in built encryption provider to generate the encrypted password. The encrypted password is tied to the account profile on the Windows instance that it is generated on so you MUST perform the following steps on the PRTG server.
Our PRTG instance is configured to run as the LOCAL SYSTEM account so we need a little help from PsExec by Mark Russinovich.
Download it onto the PRTG server from here. Unzip the PSTools zip file and copy PSExec.exe into a folder in your executable path.
Launch a PowerShell window using the following command.
psexec -s -i powershell.exe
Execute the following commands in your newly opened PowerShell window. If PRTG is running under a different user account (i.e. not LOCAL SYSTEM), you just need to log in as that user and run these commands, you don’t need to use psexec.
$Password = "Password of the Call Manager Application User"
$Password | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File c:\temp\encryptedpassword.txt
Use the contents of c:\temp\encryptedpassword.txt for the $CUCMAPIUserEncryptedPassword variable in the script.
We will also need to populate the $CUCMAPIUser in the script with our Application User username from the Call Manager.
Copy the script to C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML on the PRTG server.
Create a sensor of type EXE/Script Advanced in PRTG. You should be able to select the new script in the drop down list labelled EXE/Script.