Today I created a new sensor to monitor the health of the storage array on a Cisco UCS C Series Server. This came about because I was updating the firmware on a C3160 and noticed that the Storage Array was in a degraded state. The IS Operations team hadn’t received any sort of alert so I checked the available PRTG sensors for Cisco UCS hardware and couldn’t find anything suitable. After doing some reading on the Cisco XML API I was able to modify a script I have used previously (which was inspired by Markus Kraus from My Cloud-(R)evolution) to fetch the health status of the Storage Array through the XML API interface and trigger a PRTG Error if the status was anything but Good.
The first step is to create a local Read Only user on the CIMC of the Server through the web interface.
Next we need to encrypt the password for use in the script.
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.
This particular PRTG instance was 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 Cisco UCS CIMC Read Only User"
$Password | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File c:\temp\encrypted.txt
Use the contents of c:\temp\encrypted.txt for the $EncryptedPassword variable in the script.
You will need to update the values for the Username and UCSCIMC variables in the script.
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.