Hi,
Following the example from this topic, I have created a sensor to count the number of locked out Active Directory accounts.
The XML output looks like this:
<prtg>
<result>
<channel>Locked Out Users</channel>
<value>5</value>
</result>
<text>training, boydco, grossth, berberoy, test</text>
</prtg>
On this Locked Out Users channel, I have set an Upper Error Limit of 0, so the Sensor goes Down, resulting in the expected message:
5 # (Locked Out Users) is above the error limit of 0 #
... but the <text>
contents is not shown anywhere.
If I remove the Upper Error Limit, the message turns into:
training, boydco, grossth, berberoy, test
... but the Sensor status is Up
Is there a 'best of both worlds', where the sensor goes down, but still shows me the <text> message with the locked out accounts?
Thanks, Wim
Article Comments
Hi Konstantin,
Unfortunately, this only results in a static Error Limit Message training, boydco, grossth, berberoy, test in this Channel.
Another approach I was thinking of: using <text> and <error>, while including the number of locked out accounts in the <text> message.
Unfortunately this approach ignores the <result> contents, so there is no data in the Channels and no graphs...
So I assume there is no 'best of both worlds' solution?
Thank you, Wim
Nov, 2013 - Permalink
Hi Wim,
unfortunately these both ways are the only one possible, sorry. What you could do is updating the comments tab via API call to have the locked users there. The contents then can be sent out with a notification. An example API call would be
http(s)://YOUR_PRTG_SERVER/api/setobjectproperty.htm?id=SENSOR_ID&name=comments&value=Name of Users
You just might add a little more logic to the script and trigger the above API call when the number of locked users is higher than 0. The comments field can be sent via notification by using the placeholder %comments.
Nov, 2013 - Permalink
Hi Konstantin,
The API call provides a nice and flexible solution indeed. Finally, I have decided to go for...
http(s)://YOUR_PRTG_SERVER/api/rename.htm?id=...&value=...&username=...&passhash=..."
... where 'value' is dynamically generated by my PowerShell script. This way, the locked out accounts are clearly visible in notifications, maps, etc.
Thank you for pointing me in the right direction!
Wim
Jan, 2014 - Permalink
Hi,
in your specific case you might just set the desired limits in the sensor directly. When proceeding this way you are also able to provide custom message for error and warning limits. So instead of using your XML:
Please try using the following:
In case of error this should return the usernames in the error message.
Best regards
Nov, 2013 - Permalink