Once logged into postgresql, run the following command:
\Copy (with ata_collect as (select * from automation_task_activity as ata, automation_task as at, agent_task_item as ati where ata.task_id = at.id and at.name = 'Collect endpoint updates' and ati.id = ata.agent_task_item_id order by ati.vm_id), ata_last_collect as ( select distinct on (atac.vm_id) * from ata_collect as atac order by vm_id, agent_task_item_id desc) select es.name, es.ip, es.guest_os_fullname, atalc.output from ata_last_collect as atalc, endpoint_server es where es.id = atalc.vm_id and atalc.exit_code = 13) To '/tmp/test.csv' With CSV DELIMITER ',';
Comments
0 comments
Please sign in to leave a comment.