Technical Tip: How to Remove Decommissioned Windows Agents from CMDB when Encountering an Error
| Description | This article describes how to remove decommissioned Windows Agents from the CMDB when attempting to delete the device(s) results in the following error: 'Error TransactionRolledbackLocalException: Client's transaction aborted.' It also addresses situations where duplicate entries exist. |
| Scope | FortiSIEM v7.x+. |
| Solution | Before performing the actions:
Follow these steps to remove the affected devices:
psql -U phoenix phoenixdb -c "SELECT * FROM ph_device;" --csv > /tmp/log/ph_device.csv psql -U phoenix phoenixdb -c "SELECT * FROM ph_windows_agent_status;" --csv > /tmp/log/ph_windows_agent_status.csv
Note: The --csv > /tmp/log/ option is optional and can be omitted if not needed. Identify the device_id or id (for ph_device) of the target device. This article will use below as an example:
device_id = 12345678910 Hostname = duplicate01
psql -U phoenix phoenixdb -c "SELECT * FROM ph_incident2device;" --csv > /tmp/log/ph_incident2device.csv psql -U phoenix phoenixdb -c "SELECT * FROM ph_installed_software;" --csv > /tmp/log/ph_installed_software.csv
psql -U phoenix -d phoenixdb
SELECT * FROM ph_incident2device WHERE device_id = 12345678910 AND host_ip = 'duplicate01';
Query all rows in ph_incident2device for device_id = 12345678910:
SELECT * FROM ph_incident2device WHERE device_id = 12345678910;
Inspect the entry in ph_device where id = 12345678910:
SELECT id, name, access_ip, win_machine_guid FROM ph_device WHERE id = 12345678910;
UPDATE ph_incident2device SET device_id = 0 WHERE device_id = 12345678910;
DELETE FROM ph_installed_software WHERE device_id = 12345678910;
DELETE FROM ph_device WHERE id = 12345678910;
|
