Closed BNWEIN closed 2 months ago
I have actually downloaded the latest version. This time the errors are different, but still getting errors
Traceback (most recent call last):
File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 960, in
I have actually downloaded the latest version. This time the errors are different, but still getting errors
Traceback (most recent call last): File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 960, in total_machines = get_all_computers(sub_estate['id'], File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 205, in get_all_computers get_all_alerts(sub_estate_token, alerts_url, sub_estate_name) File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 854, in get_all_alerts for alerts in alerts_json['items']: KeyError: 'items'
Can you please show me the Extra fields section of the config file so I can try and replicate it? I think this might be in the alerts reporting. If you are using alerts reporting could try and turn that off for me please?
I have left the extra fields as default. So the same as when i downloaded the script. Interestingly, i have just noticed its failing on the same customer each time. That customer left us long ago, and is not showing in our Sophos Partner portal!
[EXTRA_FIELDS]
MAC_Address:0 Versions:0 Windows_Build_Version:1 Cloud_Servers:1 Include_Alerts:1 Full_Services_List:0 SplitEDBReports:0 IncludeSubEstateID:0
Have tried changing the extra fields to turn alerts off. Still the same issue
[EXTRA_FIELDS]
MAC_Address:0 Versions:0 Windows_Build_Version:1 Cloud_Servers:1 Include_Alerts:0 Full_Services_List:0 SplitEDBReports:0 IncludeSubEstateID:0
Actually with alerts off, it goes back to the original error
Total Number Of Machines: 3942
Traceback (most recent call last):
File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 982, in
Actually with alerts off, it goes back to the original error
Total Number Of Machines: 3942 Traceback (most recent call last): File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 982, in print_report() File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 942, in print_report dict_writer.writerows(computer_list) File "C:\Users\BWeinberg\AppData\Local\Programs\Python\Python310\lib\csv.py", line 157, in writerows return self.writer.writerows(map(self._dict_to_list, rowdicts)) File "C:\Users\BWeinberg\AppData\Local\Programs\Python\Python310\lib\csv.py", line 149, in _dict_to_list raise ValueError("dict contains fields not in fieldnames: " ValueError: dict contains fields not in fieldnames: 'xdr'
If you look at lines 600-696 and 698-794 you will see all the columns listed. Can you add 'xdr', to the end of both the lists and re-run it
Excellent work sir!
With alerts disable that does indeed fix the issue!!
However with alerts enabled, i am still hitting the same stumbling block on a customer who has left us and is not showing in our Sophos Portal.
Odd that when i run it with alerts disabled, that same thing doesnt happen. Again the error with alerts enabled is:
Traceback (most recent call last):
File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 962, in
Excellent work sir!
With alerts disable that does indeed fix the issue!!
However with alerts enabled, i am still hitting the same stumbling block on a customer who has left us and is not showing in our Sophos Portal.
Odd that when i run it with alerts disabled, that same thing doesnt happen. Again the error with alerts enabled is:
Traceback (most recent call last): File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 962, in total_machines = get_all_computers(sub_estate['id'], File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 205, in get_all_computers get_all_alerts(sub_estate_token, alerts_url, sub_estate_name) File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Latest\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 856, in get_all_alerts for alerts in alerts_json['items']: KeyError: 'items'
Version 2.40 has been publish. This should correct the issue. Please let me know
It fixes one issue, but not the other i am afraid.
I believe this is fixed in v2.41.
Hi. Been using this script for months and its been working perfectly. Im guessing something has changed somewhere as today i have tried to run the script but after it goes through all the partner tenants i get an error
"Traceback (most recent call last): File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 672, in
print_report()
File "C:\Users\BWeinberg\Prime and Modern Ltd\Management - Documents\Sophos API Scripts\Machine_Health-main\Machine_Health-main\Sophos_Central_Health.py", line 636, in print_report
dict_writer.writerows(computer_list)
File "C:\Users\BWeinberg\AppData\Local\Programs\Python\Python310\lib\csv.py", line 157, in writerows
return self.writer.writerows(map(self._dict_to_list, rowdicts))
File "C:\Users\BWeinberg\AppData\Local\Programs\Python\Python310\lib\csv.py", line 149, in _dict_to_list
raise ValueError("dict contains fields not in fieldnames: "
ValueError: dict contains fields not in fieldnames: 'xdr'"
Any help fixing this would be appreciated!