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

Custom arrays

Votes:

0

Hi,

I currently have a Powershell script which returns a custom array of Active Directory users, if their account is locked out and the date when their password is expiring. The list of AD users is read from a text file, easily maintained by IT personel with no PRTG knowledge. The goal of this script is to let us know if a service account's password is expiring soon or is currently locked out. Currently, the Powershell script is outputing to an array (PSCustomObject).

We would like to get this script into PRTG so that PRTG can alert us if :

1. An account's password is expiring in a few days. (Ideally, the limit could be set into PRTG and not hardcoded in the script.) 2. If an account is locked out.

I'm trying to get my head into how to integrate this into PRTG and keep it as dynamic as possible. Ideally, if we would like to add or remove a user from the list, we could just edit the text file and PRTG would read the new JSON/XML file that is generated with the modified users. If that is even possible in PRTG.

Currently the output arrays contains the following values :

Username DisplayName PwdNeverExpires LockedOut PasswordExpiryDate DaysBeforeExpiration

PRTG needs only the Username, LockedOut and DaysBeforeExpiration (the script uses a TimeSpan to calculate the number of days before the password expires).

Can I create all of this within 1 sensor (multiple users with their own value) ?

Right now, I can't think of any other options than to create 1 sensor per user (pass the username in paramter to the script) and each sensor has 2 channels :

- LockedOut which would trigger an alarm if True is read - DaysBeforeExpiration which would trigger based on a limit in PRTG

But, creating 1 sensor per user defeats the purpose of having a simple text file to add/remove users easily. I understand this might not be possible, and this is why I decided to ask around here to see if I'm trying to do the impossible in PRTG :)

Thanks !

Neo.

active-directory custom-script-exe custom-sensor json powershell prtg xml

Created on Aug 31, 2020 7:36:22 PM



1 Reply

Votes:

0

Hello Guillaume,

As you do not want to create one sensor for each user, this would need to be resolved outside of PRTG. I could think of sorting the users by expiring date and then only return the username and expiration date of the user for who the password expires the earliest. Based on that, you can define a limit for the days in PRTG and return the name in the sensor message.


Kind regards,
Felix Saure, Tech Support Team

Created on Sep 1, 2020 4:56:59 AM by  Felix Saure [Paessler Support]




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.