This is more something that perhaps other people can use too. PRTG is very good for monitoring value's from SNMP, I use it a lot for my Cisco's, harddisk usage etc. But now I wanted PRTG to generate an error (red button) when the temperature from one of our environment sensors reached a certain value.
So this is how I did that.
1. Installed Simple SNMP Query Tool (http://www.digigrupp.com/ssnmpq/)
2. Build a Powershell script that take parameters and uses the above program :
param([string]$OID,[string]$COMMUNITY,[string]$SHOST,[int]$TVALUE) $OID = "/o:$OID" # For a little debugging from my side, can be removed write-host $OID $COMMUNITY $SHOST $TVALUE # Get SNMP values cd "C:\Program Files\ssnmpq" $waarde=./ssnmpq.exe /h:$SHOST /c:$COMMUNITY $OID|Select-String Value # Remove some spaces and stuff $waarde = $waarde -replace " ","" $waarde = $waarde -replace "'","" [int]$waardeg = [int]$waarde.Substring(6) if ($waardeg -ge $TVALUE) { write-host $waardeg":NOK" exit 2 } else { write-host $waardeg":OK" exit 0 }
3. Created a custom sensor in PRTG which uses (for example) these parameters:
"1.3.6.1.4.1.9.9.13.1.3.1.3.1005" "public" "192.168.1.1" 40
Mind you, I am no programmer so feel free to shoot on this, perhaps I can learn something from it, too :)
Add comment