vbscriptmonitoringprtg

Returning strings from a PRTG custom sensor


I'm trying to develop a custom VBScript sensor for the PRTG monitoring tool and the interface seems fairly simple, returning just a 32-bit integral value and a status string such as with:

WScript.echo "0:January 23, 2015"

However, only the integer appears on the front screen, you have to go into the sensor detail screen itself to get the descriptive text.

Now I think you can generate textual data to be displayed as the result (rather than the descriptive text) since the SSL security check sensor displays Only Strong Protocols Possible:

enter image description here

I tried returning the date as an integer along the lines of 20150123 but that has two problems:

So, my question is: how do you create and code up a custom sensor that can return a string rather than just an integer, float or counter, which seem to be the only three options available?


Solution

  • You should look at the SSH sensor and see if you can do something similar with the sensor you are trying to use. For the SSH sensor you return data in the format of returncode:value:message. Return code 0 is OK, 1-4 are errors, value is a 64-bit integer, and message can be a string. Take a look at this PRTG forum post

    Since the value you are returning is a date, lookups won't help you much but I'm going to mention them anyways because if you look at some of the built-in sensor types that is how they get string messages. Specifically the SSL Security Rating channel. If you click on the gear for a Value channel one of the fields is Value Lookup. There are lots of preconfigured lookups, but you can also create your own. Here's a relevant PRTG forum post