Jump to content
Sign in to follow this  
DevinSysAdmin

SQL Query to pull agent count by Client

Recommended Posts

Hi all,

 

Just sharing with the community something Gavsto helped out with.

 

SELECT ClientName, COUNT(*) AS AgentCount, (SELECT COUNT(*) FROM v_xr_computers WHERE v_xr_computers.clientid = v.clientid AND v_xr_computers.computerisserver = 1) AS ServerCount, (SELECT COUNT(*) FROM v_xr_computers WHERE v_xr_computers.clientid = v.clientid AND v_xr_computers.computerisserver = 0) AS WorkstationCount FROM v_xr_computers v
GROUP BY ClientName

 

This will format the table as 

 

Client|AgentCount|WorkstationCount|ServerCount

Share this post


Link to post
Share on other sites

Turns out I have some non-binary agents:

image.png.ed9b34141312470cacc23c1c38852959.png

They're a mix of XP, agents that never fully checked in, and duplicate agents.  I don't see anything common among them.

Share this post


Link to post
Share on other sites

Love this! Is there a way to have this put into a report format at all? Would be awesome to get this to email the team once a month!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×