New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Users/users group administration

Votes:

0

Your Vote:

Up

Down

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 by  Terry Duong (0) 1



12 Replies

Accepted Answer

Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Terry Duong (0) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Terry Duong (0) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Terry Duong (0) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  Terry Duong (0) 1

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



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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

Created on Jan 13, 2017 6:27:28 AM by  Terry Duong (0) 1



Votes:

0

Your Vote:

Up

Down

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 by  Terry Duong (0) 1



Votes:

0

Your Vote:

Up

Down

Nice work :)

Created on Jan 18, 2017 8:13:40 AM by  Stephan Linke [Paessler Support]



Please log in or register to enter your reply.


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.