Cannot edit agent.cfg when setting up Asset Discovery Agent
Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When trying to set up Asset Discovery Agent according to Set up Assets Discovery Agent and edit agent.cfg, the agent.cfg file can't not be successfully modified. It keeps going back to the default file upon saving.
Diagnosis
Below are 3 example agent.cfg files:
- Default agent.cfg: <?xml version="1.0" encoding="utf-8"?><Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ScanLogLevel>Normal</ScanLogLevel><NextScanDate>2024-11-29T01:24:37.1020042+00:00</NextScanDate><ScanInterval>24</ScanInterval><AgentPort>51337</AgentPort><UseAllNetworkInterfaces>false</UseAllNetworkInterfaces><UseIPMatching /><DeleteLogsAfter>7</DeleteLogsAfter><DisableTCPListener>false</DisableTCPListener><DirectCopyPath /><SFTPSettings><TransferReties>5</TransferReties><TranserRetryInterval>30</TranserRetryInterval></SFTPSettings><SaveTimeStamp>2024-11-28T01:37:19.0493681+00:00</SaveTimeStamp></Settings>
- Successful agent.cfg: <?xml version="1.0" encoding="utf-8"?><Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ScanLogLevel>Normal</ScanLogLevel><NextScanDate>2024-11-29T01:34:27.8013765+00:00</NextScanDate><ScanInterval>24</ScanInterval><AgentPort>51337</AgentPort><UseAllNetworkInterfaces>false</UseAllNetworkInterfaces><UseIPMatching /><DeleteLogsAfter>7</DeleteLogsAfter><DisableTCPListener>false</DisableTCPListener><DirectCopyPath>\\10.229.128.193\JiraShared</DirectCopyPath><SFTPSettings><TransferReties>5</TransferReties><TranserRetryInterval>30</TranserRetryInterval></SFTPSettings><SaveTimeStamp>2024-11-28T01:34:27.8024711+00:00</SaveTimeStamp></Settings>
- Unsuccessful agent.cfg: <?xml version="1.0" encoding="utf-8"?><Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ScanLogLevel>Normal</ScanLogLevel><NextScanDate>2024-11-29T01:24:37.1020042+00:00</NextScanDate><ScanInterval>24</ScanInterval><AgentPort>51337</AgentPort><UseAllNetworkInterfaces>false</UseAllNetworkInterfaces><UseIPMatching /><DeleteLogsAfter>7</DeleteLogsAfter><DisableTCPListener>false</DisableTCPListener><DirectCopyPath /><SFTPSettings><TransferReties>5</TransferReties><TranserRetryInterval>30</TranserRetryInterval></SFTPSettings><SaveTimeStamp>2024-11-28T01:37:19.0493681+00:00</SaveTimeStamp></Settings><DirectCopyPath>\\10.229.128.193\JiraShared</DirectCopyPath>
Cause
The modification of agent.cfg is unsuccessful due to invalid format. In the examples above, it is because of the duplicated </DirectCopyPath> flags: the default agent.cfg already has the <DirectCopyPath /> flag, and its recommended to add the values in-place instead of creating duplicated flags at the end of the file.
Solution
Double-check the agent.cfg to see whether there are duplicated flags or invalid flags.