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

Users/users group administration

Votes:

0

Hi Paessler,

I'm working on monthly report that is required to know how many users are in a specific user group in prtg. Just wondering if there's a way to automate this via API without logging on and manually check on prtg - system administration?

Thanks and regards, Terry

system-administration user user-group

Created on Jan 11, 2017 4:02:03 AM



12 Replies

Accepted Answer

Votes:

0

Hm, not via API, the following URL contains a report on users and groups: <your-prtg-url>/config_report_users.htm

Or do you need a numerical evaluation of the user / group configuration?

Created on Jan 11, 2017 8:07:02 AM by  Stephan Linke [Paessler Support]



Votes:

0

Hi Stephan, Sorry I'm not able to check the link right now but I'm after number of users per group, for example, I have a user group call ReadOnly which only have read access to our PRTG and I want to check the number of users in that group every month.

Thanks and regards Terry

Created on Jan 11, 2017 9:39:14 AM



Votes:

0

I may have something at hand, I'll post it tomorrow :)

Created on Jan 11, 2017 1:56:34 PM by  Stephan Linke [Paessler Support]



Votes:

0

Hi Stephan,

Just tested the link, I could write up a script to count the users/group from that. Just wondering if we can have csv version of this, that would be great?

Created on Jan 11, 2017 10:40:51 PM



Votes:

0

No CSV link for that I'm afraid :/ Does that work for you anyway?

Created on Jan 12, 2017 8:01:45 AM by  Stephan Linke [Paessler Support]



Votes:

0

Yes, I just need to write a script to count the users, should be all good, thanks Stephan

Created on Jan 12, 2017 9:18:12 AM



Votes:

0

Okay cool :) Feel free to post the working script here and I'll promote it as best answer; then other users can find it better and make use of your work as well :)

Created on Jan 12, 2017 9:27:26 AM by  Stephan Linke [Paessler Support]



Votes:

0

Hi Stephan,

I ran into another problem. I tried to download the report page via powershell but it would then redirected me to prtg login page. I tried both web-request method and create an ie object, but neither of them work. Is there a way I can get the report without manually logon and download it?

web-request method:

$R = Invoke-WebRequest $prtglink -SessionVariable test
$test
$Form = $R.Forms[0]
$Form | Format-List

$Form.fields

$Form.Fields["loginusername"] = "$username"
$Form.Fields["loginpassword"] = "$password"

$R = Invoke-WebRequest -Uri ("$prtglink" + $Form.Action) -WebSession $test -Method POST -Body $Form.Fields

$R.Content
#R.content showing login page

create an ie object:

$reportlink = "$prtglink/config_report_users.htm"
$ie = new-object -com "InternetExplorer.Application"
$ie.Visible = $true
$ie.Navigate("$reportlink")
While ($ie.Busy) {
Sleep 2
}
$doc = $ie.Document
#$doc return null

Created on Jan 13, 2017 12:11:03 AM

Last change on Jan 13, 2017 6:13:11 AM by  Stephan Linke [Paessler Support]



Votes:

0

You could simply call the URL with username and passhash GET parameters and you won't have to deal with the actual login: http://<your-prtg-url>/config_report_users.htm?username=prtgadmin&passhash=12345678

Created on Jan 13, 2017 6:14:28 AM by  Stephan Linke [Paessler Support]



Votes:

0

Okie cool, I thought that wasn't available. Thanks Stephan, will try it on Monday

Created on Jan 13, 2017 6:27:28 AM



Votes:

0

Hi Stephan,

Thank you for your help. I'm able to get my script working now. Please see below for details:

$reportlink = $UserDetails.UserDetails.PRTG2+"/config_report_users.htm?username=$username&passhash=$passhash"
$report = Invoke-WebRequest $reportlink
$report = $report.Content
$groupID = "123456789" #group id
$grouptag = ($report -split "id=`"$groupID`"")[-1]
$grouptag = ($grouptag -split "</tr>")[0]

#"class=`"col-primarygroup`"" count primary users of the group
#"class=`"col-members`"" count members of the group
# in my case I only need primary users
$PrimeUsers = ($grouptag -split "class=`"col-primarygroup`"")[-1]
$PrimeUsers = $PrimeUsers.split(",")
$usersCount = $PrimeUsers.Length

Regards

Created on Jan 17, 2017 11:51:15 PM



Votes:

0

Nice work :)

Created on Jan 18, 2017 8:13:40 AM by  Stephan Linke [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.