cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

Get List of offline Agents of all system profiles

john_j
Inactive

Hi,

Is there any way to get list
of disconnected agents other than incident mails in 6.3 ?.While using rest
interfaces,

i am getting all agents with
various indices.Can any one please help on this?.

Thanks,

John

5 REPLIES 5

john_rath
Dynatrace Guide
Dynatrace Guide

Hey John,

I worked on a similiar issue recently. As I'm sure you know, offline or disconnected agents will only stay visible for 72 hours, so you have roughly 3 days after the agent goes offline to gather the data that it is offline.

I would recommend creating a script to query a dashboard (open the Agent Overview dashlet and save it as a new dashboard) on some regular, fixed interval. This way you won't miss an agent 'falling off' if it has been offline for over 72 hours. You can then manipulate that agent data in whatever way makes sense.

In my own example, I ended up parsing the results and storing it into a MySQL database. We used this data to monitor inactive/active profiles across a large environment.

I hope this helps. If you have any questions about my methods or implementation, please let me know.

Thanks,

John

Srikar_Mohan2
Helper

If the intent is to get a list of hosts that have agents (but may be not in use/offline/app is not up) then you can create a chart by adding any of the host metrics (ex: cpu total time) split by agent host then setting the time frame to desired value (ex 180 days) and then look at the table view to get the list of hosts. Any time an agent is present on a host it would collect host metrics so its one of the definite ways to retrieve list of hosts that ever had an agent. Further by changing the structure of the table to 'Records' you can see when the agent stopped collecting metrics from that host (one of possible reason is that agent was offline).

john_j
Inactive

Hi John,

Can you please tell me,how you stored in a database?.

It will make my task simple.

Thanks,

John

Hi John,

I wrote my script in python, and I'll copy the relevant DB portion here. I'm by no means a python developer, so keep that in mind as you look at my code :). In my case, we needed to store 5 variables. You might not need that many, so customize as you see fit.

All this is doing is storing the data directly into the MySQL DB from a List object in Python. Im using the MySQLLdb library for Python 3.5.

#Setup Cursor
cursor = db.cursor()
time = time.strftime("%Y-%m-%d %H:%M:%S")
#Create INSERT string, execute SQL, interate over list
for a_params in agentlist:
sql = """INSERT INTO test VALUES ('{0}', '{1}', '{2}', '{3}', '{4}')"""
name = a_params[0]
system = a_params[1]
started = a_params[2]
completed = a_params[3]

try:
cursor.execute(sql.format(name, system, started, 1, time))
db.commit()
except MySQLdb.Error as e:
db.rollback()
print(e)

john_j
Inactive

Hi John,

Can you please tell me,how you stored in a database?.

It will make my task simple.

Thanks,

John