What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

<text> tag in Advanced EXE/Script Sensor

Votes:

0

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

-text- active-directory custom-script-exe custom-sensor

Created on Nov 26, 2013 6:45:23 PM

Last change on Mar 19, 2015 3:51:30 PM by  Martina Wittmann [Paessler Support]



Best Answer

Accepted Answer

Votes:

0

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.

Created on Nov 27, 2013 12:20:26 PM by  Konstantin Wolff [Paessler Support]



4 Replies

Votes:

0

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:

<prtg>
<result>
<channel>Locked Out Users</channel>
<value>5</value>
</result>
<text>training, boydco, grossth, berberoy, test</text>
</prtg>

Please try using the following:

<prtg>
<result>
<channel>Locked Out Users</channel>
<value>5</value>
<LimitMaxError>0</LimitMaxError>
<LimitMode>1</LimitMode>
<LimitErrorMsg>training, boydco, grossth, berberoy, test</LimitErrorMsg>
</result>
</prtg>

In case of error this should return the usernames in the error message.
Best regards

Created on Nov 27, 2013 6:36:01 AM by  Konstantin Wolff [Paessler Support]



Votes:

0

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

Created on Nov 27, 2013 9:30:38 AM



Accepted Answer

Votes:

0

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.

Created on Nov 27, 2013 12:20:26 PM by  Konstantin Wolff [Paessler Support]



Votes:

0

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

Created on Jan 3, 2014 2:00:24 PM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.