How do I fix Failed to parse link in report "File System" errors in the Python Log?
The error "Failed to parse link in report "File System"" has started appearing in the Python Log for some customers.
The error: 2023/09/29 10:16:55 | 27753 | ssReporting.ReportConfigs | WARNING | Failed to parse link in report "File System" is caused by the crtool not correctly processing a report on a version upgrade.
The command:
jq . /home/statseeker/nim/etc/system_reports/nim-custom-report-DeviceStatusFileSystem.cfg |grep '\"val\"'
Shows the following:
"data_type": "val",
"val": "File__System__Graphs"
"val": "type",
"val": "type",
"val": "File__System__Graphs"
"val": "type",
"val": "File__System__Graphs"
"val": "type",
"val": "File__System__Graphs"
A bad cfg file will have File__System__Graphs in the "val" field 4 times (as per above), this is not correct, "val" should be a number, e.g. "341"
To find out what the number is that should be used, run the "base-ega get report" command:
base-ega get report | grep 'File System Graphs'
'341' 'C00:Device Health Custom Reports: File System Graphs'
In this case the number is 341.
To fix the file, change to the directory, copy the file to a backup, and edit the file and replace the File__System__Graphs string with the report number.
cd /home/statseeker/nim/etc/system_reports
cp -p nim-custom-report-DeviceStatusFileSystem.cfg nim-custom-report-DeviceStatusFileSystem.cfg.bkup
Check the report file is backed up
ls -l nim-custom-report-DeviceStatusFileSystem.cfg*
Then edit the file to correct it
vi nim-custom-report-DeviceStatusFileSystem.cfg
Use the :%!jq . -S string to format the file in vi from all on one line to a readable JSON format
Use the :%s/\"File__System__Graphs\"/\"341\"/ string with the appropriate number from above to find and replace the "File__System__Graphs" string
Create a test file to check that only the desired lines have changed and compare this with the new config file
jq . -S nim-custom-report-DeviceStatusFileSystem.cfg.bkup > nim-custom-report-DeviceStatusFileSystem.cfg.test
diff nim-custom-report-DeviceStatusFileSystem.cfg nim-custom-report-DeviceStatusFileSystem.cfg.test
Remove the test file interactively
rm -i nim-custom-report-DeviceStatusFileSystem.cfg.test