How to get Endpoint Agent lists and statuses from CLI [KATA/KEDRE]
This works an all KATA CN versions from 3.6.1 to 5.1
You can execute the queries below with Curl to get the text representation of agent status. SSO login and password must be used, limit of 200 entries is used in the example query.
JSONs with agent status
curl -s --output /dev/ null -c ./cookie -k -X POST -H 'Content-Type: application/json' -d '{"username":"SSO","password":"MYPASSWORD","local":false}' https: //KATACN:8443/apt/api/userLogin && curl -s -b ./cookie -k -X POST -H 'Content-Type: application/json' -H 'Referer: https://KATACN:8443/katap/' -d '{"limit":200,"offset":0}' https://KATACN:8443/apt/api/hostsAgentActivity | python -m json.tool
|
This query can be customized further to get lists of hostnames, IPs etc:
List of unique agents hostnames
curl -s --output /dev/ null -c ./cookie -k -X POST -H 'Content-Type: application/json' -d '{"username":"SSO","password":"MYPASSWORD","local":false}' https: //KATACN:8443/apt/api/userLogin && curl -s -b ./cookie -k -X POST -H 'Content-Type: application/json' -H 'Referer: https://KATACN:8443/katap/' -d '{"limit":200,"offset":0}' https://KATACN:8443/apt/api/hostsAgentActivity | python -m json.tool | grep hostname | awk -F\" '{print $4}' | sort | uniq
|
List of unique agents hostnames
curl -s --output /dev/ null -c ./cookie -k -X POST -H 'Content-Type: application/json' -d '{"username":"SSO","password":"MYPASSWORD","local":false}' https: //KATACN:8443/apt/api/userLogin && curl -s -b ./cookie -k -X POST -H 'Content-Type: application/json' -H 'Referer: https://KATACN:8443/katap/' -d '{"limit":200,"offset":0}' https://KATACN:8443/apt/api/hostsAgentActivity | python -m json.tool | grep \"ip\" | awk -F\" '{print $4}' | sort -n | uniq
|
0 Comments
Recommended Comments
There are no comments to display.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now