It is rather hard to get valuable alarm monitoring from an APC InRow air conditioning unit. The APC A/C’s are a real pain when it comes to this, it might even be that this same principle applies to APC UPS units, but I did not have yet time to test this out.
What I really wanted is a way to monitor alerts that the unit reports. Doing so seemed to be fine with a simple SNMP sensor in PRTG but the real challenge was getting the alert text. Now, there are SNMP channels but they are only available when an alert is ongoing, meaning when there is no alert status the whole OID fails.
To compensate this, I ended up writing a simple PowerShell script that interprets the SNMP OID results, even ignores a certain failure cause I didn’t care about it, and reports back the results as a total error count (set the channel to ErrorLimit = 0 in PRTG) and if there are Errors it will write them to the text.
This is an Advanced EXE script that needs to reside in the following path:
1 | C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML |
It expects the parameters for community and IP-Address
1 | public %host |
The results of the script will always hold the top 4 error messages, but it will exclude the phrase “No Backup Units Available Alarm” from the error count – cause in certain setups like hours there are multiple units but they are not necessarily clustered – this is not a full alarm rather then a warning in my case. Feel free to adjust this in the script if you want to raise the error. You could simply remove / remark the following line:
1 | $TotalErrors.Data = $TotalErrors.Data - $SubstractError |
Here a picture of a real world alarm respective issue with the APC InRow A/C in PRTG generated by the script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | Param( $Community, $IP ) $TotalErrors = Get-SnmpData -IP $IP -Community $Community -OID 1.3.6.1.4.1.318.1.1.13.4.3.1.0 $Error1 = Get-SnmpData -IP $IP -Community $Community -OID 1.3.6.1.4.1.318.1.1.13.4.3.2.1.3.1 $Error2 = Get-SnmpData -IP $IP -Community $Community -OID 1.3.6.1.4.1.318.1.1.13.4.3.2.1.3.2 $Error3 = Get-SnmpData -IP $IP -Community $Community -OID 1.3.6.1.4.1.318.1.1.13.4.3.2.1.3.3 $Error4 = Get-SnmpData -IP $IP -Community $Community -OID 1.3.6.1.4.1.318.1.1.13.4.3.2.1.3.4 $SubstractError = 0 if ($Error1.Data.length -gt 0) { if ($Error1.Data -ne "NoSuchInstance") { if ($Error1.Data -eq "No Backup Units Available Alarm") { $SubstractError += 1 } $ErrorText = $Error1.Data } } if ($Error2.Data.length -gt 0) { if ($Error2.Data -ne "NoSuchInstance") { if ($Error2.Data -eq "No Backup Units Available Alarm") { $SubstractError += 1 } $ErrorText += " - " + $Error2.Data } } if ($Error3.Data.length -gt 0) { if ($Error3.Data -ne "NoSuchInstance") { if ($Error3.Data -eq "No Backup Units Available Alarm") { $SubstractError += 1 } $ErrorText += " - " + $Error3.Data } } if ($Error4.Data.length -gt 0) { if ($Error4.Data -ne "NoSuchInstance") { if ($Error4.Data -eq "No Backup Units Available Alarm") { $SubstractError += 1 } $ErrorText += " - " + $Error4.Data } } $TotalErrors.Data = $TotalErrors.Data - $SubstractError $XML = "<prtg>" $XML += "<result><channel>Total Errors</channel><value>" + $TotalErrors.Data + "</value><unit>Count</unit></result>" $XML += "<text>$ErrorText</text>" $XML += "</prtg>" Function WriteXmlToScreen ([xml]$xml) { $StringWriter = New-Object System.IO.StringWriter; $XmlWriter = New-Object System.Xml.XmlTextWriter $StringWriter; $XmlWriter.Formatting = "indented"; $xml.WriteTo($XmlWriter); $XmlWriter.Flush(); $StringWriter.Flush(); Write-Output $StringWriter.ToString(); } WriteXmlToScreen $XML |