Skip to content

Commit c5e5e63

Browse files
fix #26
1 parent d761f64 commit c5e5e63

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

input_module_intersight.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ def get_checkpoint(type):
6060
f"{account_name}_last_{type}_record")
6161
helper.log_debug(
6262
f"{s} | Checkpoint value for {type} records is {state}")
63+
if (state == None or state == "None"):
64+
raise Exception("State is none")
6365
return state
6466
except:
6567
# set the state if it's not set
@@ -215,7 +217,9 @@ def write_splunk(index, source, sourcetype, data):
215217
state = get_checkpoint('audit')
216218
# get the audit records
217219
RESPONSE = r_intersight(
218-
f"{endpoint}?$orderby=ModTime%20asc&$filter=ModTime%20gt%20{state}")
220+
f"{endpoint}?$inlinecount=allpages&$orderby=ModTime%20asc&$filter=ModTime%20gt%20{state}")
221+
helper.log_info(
222+
f"{s} | Found {RESPONSE.json()['Count']} audit records to retrieve")
219223
# process the audit records
220224
for data in RESPONSE.json()['Results']:
221225
# pop things we don't need
@@ -252,8 +256,9 @@ def write_splunk(index, source, sourcetype, data):
252256
state = get_checkpoint('alarm')
253257
# Let's get the alarm records
254258
RESPONSE = r_intersight(
255-
f"{endpoint}?$orderby=ModTime%20asc&$filter=ModTime%20gt%20{state}")
256-
259+
f"{endpoint}?$inlinecount=allpages&$orderby=ModTime%20asc&$filter=ModTime%20gt%20{state}")
260+
helper.log_info(
261+
f"{s} | Found {RESPONSE.json()['Count']} alarm records to retrieve")
257262
# Process the alarm records
258263
for data in RESPONSE.json()['Results']:
259264
data = pop(['AffectedMo', 'Ancestors', 'Owners', 'PermissionResources',

splunk_em.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import input_module_intersight
88

9-
load_dotenv('_example.env')
9+
load_dotenv('_richfield.env')
1010

1111
# This code allows us to execute the input for testing without needing additional code from splunk
1212
# by providing a minimal sub-out of the two classes that splunk passes to the input
@@ -24,7 +24,7 @@ def get_arg(self, arg_name):
2424
if arg_name == 'validate_ssl':
2525
return True
2626
if arg_name == 'enable_aaa_audit_records':
27-
return False
27+
return True
2828
if arg_name == 'enable_alarms':
2929
return True
3030
if arg_name == 'inventory_interval':
@@ -36,7 +36,7 @@ def get_arg(self, arg_name):
3636
basic = {'advisories', 'compute', 'contract', 'network', 'target', 'license'}
3737
hyperflex = {'compute', 'hyperflex'}
3838
thirdpartystorage = {'pure', 'netapp', 'hitachi'}
39-
return all
39+
return none
4040

4141
# this function provides the input name
4242
def get_input_stanza(self):

0 commit comments

Comments
 (0)