Skip to content

Commit 345f7b5

Browse files
Merge pull request #13 from jerewill-cisco/pre-release
Release for 1.2.7
2 parents 4d8df7e + 5ba69fb commit 345f7b5

File tree

2 files changed

+38
-21
lines changed

2 files changed

+38
-21
lines changed

input_module_intersight.py

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,15 @@ def collect_events(helper, ew):
184184
helper.log_debug(stanza_name + ' | ' +
185185
"Creating event for Moid "+data['Moid'])
186186
# Here we check to see if the latest event is newer than our checkpoint, if so we update it.
187-
if datetime.datetime.strptime(state, "%Y-%m-%dT%H:%M:%S.%f%z") < datetime.datetime.strptime(data['ModTime'], "%Y-%m-%dT%H:%M:%S.%f%z"):
188-
state = data['ModTime']
187+
try:
188+
if datetime.datetime.strptime(state, "%Y-%m-%dT%H:%M:%S.%f%z") < datetime.datetime.strptime(data['ModTime'], "%Y-%m-%dT%H:%M:%S.%f%z"):
189+
state = data['ModTime']
190+
helper.log_debug(
191+
stanza_name + ' | ' + "Checkpoint key for audit records was updated to " + state)
192+
except (ValueError):
189193
helper.log_debug(
190-
stanza_name + ' | ' + "Checkpoint key for audit records was updated to " + state)
194+
stanza_name + ' | ' + "Checkpoint key for audit records was unable to be updated")
195+
pass
191196
# Persist our checkpoint at the end of the audit records
192197
helper.save_check_point(account_name+'_last_audit_record', state)
193198

@@ -257,10 +262,15 @@ def collect_events(helper, ew):
257262
helper.log_debug(stanza_name + ' | ' +
258263
"Creating event for Moid "+data['Moid'])
259264
# Here we check to see if the latest event is newer than our checkpoint, if so we update it.
260-
if datetime.datetime.strptime(state, "%Y-%m-%dT%H:%M:%S.%f%z") < datetime.datetime.strptime(data['ModTime'], "%Y-%m-%dT%H:%M:%S.%f%z"):
261-
state = data['ModTime']
265+
try:
266+
if datetime.datetime.strptime(state, "%Y-%m-%dT%H:%M:%S.%f%z") < datetime.datetime.strptime(data['ModTime'], "%Y-%m-%dT%H:%M:%S.%f%z"):
267+
state = data['ModTime']
268+
helper.log_debug(
269+
stanza_name + ' | ' + "Checkpoint key for alarm records was updated to " + state)
270+
except:
262271
helper.log_debug(
263-
stanza_name + ' | ' + "Checkpoint key for alarm records was updated to " + state)
272+
stanza_name + ' | ' + "Checkpoint key for alarm records was unable to be updated")
273+
pass
264274
# Persist our checkpoint at the end of the audit records
265275
helper.save_check_point(account_name+'_last_alarm_record', state)
266276

@@ -471,7 +481,7 @@ def collect_events(helper, ew):
471481
count = RESPONSE.json()['Count']
472482
helper.log_debug(stanza_name + ' | ' + "Found " +
473483
str(count) + " inventory records to retrieve...")
474-
results_per_page = 10 # adjust the number of results we pull per API call
484+
results_per_page = 1 # adjust the number of results we pull per API call
475485
for i in range(0, count, results_per_page):
476486
RESPONSE = requests.request(
477487
method='GET',
@@ -482,22 +492,23 @@ def collect_events(helper, ew):
482492
verify=opt_validate_ssl,
483493
proxies=r_proxy
484494
)
485-
486-
for data in RESPONSE.json()['Results']:
487-
try:
495+
try:
496+
for data in RESPONSE.json()['Results']:
497+
try:
488498
# remove things that just aren't helpful in splunk
489-
for thepop in ['Ancestors', 'Details', 'Owners', 'PermissionResources', 'RegisteredDevice']:
490-
data.pop(thepop)
491-
for thepop in ['ClassId', 'link']:
492-
data['ManagedObject'].pop(thepop)
493-
except:
494-
pass
495-
event = helper.new_event(
496-
source=account_name, index=index, sourcetype='cisco:intersight:condHclStatuses', data=json.dumps(data))
497-
ew.write_event(event)
498-
helper.log_debug(stanza_name + ' | ' +
499+
for thepop in ['Ancestors', 'Details', 'Owners', 'PermissionResources', 'RegisteredDevice']:
500+
data.pop(thepop)
501+
for thepop in ['ClassId', 'link']:
502+
data['ManagedObject'].pop(thepop)
503+
except:
504+
pass
505+
event = helper.new_event(
506+
source=account_name, index=index, sourcetype='cisco:intersight:condHclStatuses', data=json.dumps(data))
507+
ew.write_event(event)
508+
helper.log_debug(stanza_name + ' | ' +
499509
"Creating inventory for Moid "+data['Moid'])
500-
510+
except:
511+
helper.log_debug(stanza_name + ' | ' + "HCL failed with code " + RESPONSE.json()['code'])
501512
else:
502513
helper.log_debug(stanza_name + ' | ' + "Skipping compute HCL status.")
503514

splunkbase/releasenotes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ Proxy support is configured at the Add-on level and not per-Input. Click the `C
2424
Fixed an issue that could cause the add-on to fail if the Intersight SaaS account did not have any servers licensed at Essentials or higher when either the Compute inventory (because of the HCL feature) or Advisories Inventory items were selected.
2525

2626
Fixed an issue that would cause the add-on to fail if Hyperflex inventory was selected and no Hyperflex clusters were present.
27+
28+
## 1.2.7
29+
30+
Worked around an issue that could cause the addon to fail if an Alarm or Audit Log event happen exactly at the second boundary and didn't leave any fraction of a second. A more mathematically correct fix will have to wait for a future update.
31+
32+
Worked around an issue that could cause the add-on to fail if the compute HCL query encountered a record that was associated with a server that's no longer licensed for the HCL feature. This, too, will get a more thorough fix at some point in the future.

0 commit comments

Comments
 (0)