File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 6969 print ('Notification Channel ID ' + str (channel_id ) + ' referenced in Alert "' + a ['name' ] + '" does not exist.\n Restoring without this ID.' )
7070 a ['notificationChannelIds' ].remove (channel_id )
7171
72- # JSON Alerts from the list_alerts.py example are in epoch time, but ones
73- # downloaded using the "Export JSON" button of the web interface are ISO
74- # timestamps in string form. If we see these fields as strings, assume
75- # they came from the web UI and convert them to epoch.
72+ # The Create/Update APIs will validate but actually ignore these fields;
73+ # to avoid problems, don't submit in the API request
7674 for timefield in ['createdOn' , 'modifiedOn' ]:
77- if isinstance (a .get (timefield ), str ):
78- a [timefield ] = calendar .timegm (datetime .datetime .strptime (a [timefield ], '%Y-%m-%dT%H:%M:%S.%fZ' ).timetuple ())
75+ del a [timefield ]
7976
77+ # NOTE: when exporting alerts that contain deprecated metrics you will
78+ # need to remove them from the source json
79+ # (see https://sysdigdocs.atlassian.net/wiki/spaces/Monitor/pages/205684810/Metrics#Metrics-HeuristicandDeprecatedMetrics)
8080 if a ['name' ] in existing_alerts :
8181 a ['id' ] = existing_alerts [a ['name' ]]['id' ]
8282 a ['version' ] = existing_alerts [a ['name' ]]['version' ]
You can’t perform that action at this time.
0 commit comments