@@ -102,7 +102,11 @@ def strptime(i_time):
102102 def pop (pop , data ):
103103 try :
104104 for thepop in pop :
105- data .pop (thepop )
105+ try :
106+ data .pop (thepop )
107+ except :
108+ helper .log_debug (
109+ f"{ s } | Failed to pop { thepop } " )
106110 return data
107111 except :
108112 return data
@@ -216,7 +220,7 @@ def write_splunk(index, source, sourcetype, data):
216220 for data in RESPONSE .json ()['Results' ]:
217221 # pop things we don't need
218222 data = pop (['Account' , 'Ancestors' ,
219- 'PermissionResources' , 'Owners' , 'User' ], data )
223+ 'PermissionResources' , 'Owners' , 'User' , 'ClassId' , 'DomainGroupMoid' , 'ObjectType' , 'Sessions' , 'SharedScope' ], data )
220224 # Splunk default doesn't allow events over 10k characters by default
221225 if len (json .dumps (data )) > 9999 :
222226 # we're truncating the Request value if it's larger than that
@@ -252,8 +256,8 @@ def write_splunk(index, source, sourcetype, data):
252256
253257 # Process the alarm records
254258 for data in RESPONSE .json ()['Results' ]:
255- data = pop (['AffectedMo' , 'Ancestors' , 'Owners' ,
256- 'PermissionResources ' , 'RegisteredDevice ' ], data )
259+ data = pop (['AffectedMo' , 'Ancestors' , 'Owners' , 'PermissionResources' ,
260+ 'RegisteredDevice ' , 'ClassId' , 'DomainGroupMoid' , 'ObjectType' , 'SharedScope ' ], data )
257261 write_splunk (index , account_name ,
258262 'cisco:intersight:condAlarms' , data )
259263 state = larger_datetime (data ['ModTime' ], state )
@@ -314,9 +318,9 @@ def write_splunk(index, source, sourcetype, data):
314318 f"{ endpoint } ?$expand=Advisory&$top={ results_per_page } &$skip={ str (i )} " )
315319 for data in RESPONSE .json ()['Results' ]:
316320 data = pop (['Ancestors' , 'AffectedObject' ,
317- 'PermissionResources' , 'Owners' , 'DeviceRegistration' ], data )
318- data ['Advisory' ] = pop (['Ancestors' , 'Actions' , 'ApiDataSources' , 'Organization' ,
319- 'Owners' , 'PermissionResources' , 'Recommendation' ], data ['Advisory' ])
321+ 'PermissionResources' , 'Owners' , 'DeviceRegistration' , 'ClassId' , 'DomainGroupMoid' , 'ObjectType' , 'SharedScope' ], data )
322+ data ['Advisory' ] = pop (['AccountMoid' , ' Ancestors' , 'Actions' , 'ApiDataSources' , 'Organization' ,
323+ 'Owners' , 'PermissionResources' , 'Recommendation' , 'DomainGroupMoid' , 'ObjectType' , 'SharedScope' ], data ['Advisory' ])
320324 write_splunk (index , account_name ,
321325 'cisco:intersight:tamAdvisoryInstances' , data )
322326
@@ -343,9 +347,11 @@ def write_splunk(index, source, sourcetype, data):
343347 f"{ endpoint } ?$expand=RegisteredDevice($select=ClaimedByUserName,ClaimedTime,ConnectionStatusLastChangeTime,ConnectionStatus,CreateTime,ReadOnly)&$top={ results_per_page } &$skip={ str (i )} " )
344348 for data in RESPONSE .json ()['Results' ]:
345349 data = pop (
346- ['Ancestors' , 'PermissionResources' , 'Owners' ], data )
350+ ['Ancestors' , 'PermissionResources' , 'Owners' , 'DomainGroupMoid' , 'ClassId' , 'FaultSummary' , 'EquipmentChassis' , 'InventoryDeviceInfo' , 'KvmVendor' , 'ObjectType' , 'ScaledMode' , 'Rn' , 'SharedScope' ], data )
347351 data ['RegisteredDevice' ] = pop (
348352 ['ClassId' , 'ObjectType' ], data ['RegisteredDevice' ])
353+ data ['AlarmSummary' ] = pop (
354+ ['ClassId' , 'ObjectType' ], data ['AlarmSummary' ])
349355 write_splunk (index , account_name ,
350356 'cisco:intersight:computePhysicalSummaries' , data )
351357 # try to get HCL data also
@@ -390,7 +396,7 @@ def write_splunk(index, source, sourcetype, data):
390396 f"{ endpoint } ?$top={ results_per_page } &$skip={ str (i )} " )
391397 for data in RESPONSE .json ()['Results' ]:
392398 data = pop (['Ancestors' , 'Contract' , 'EndCustomer' , 'EndUserGlobalUltimate' , 'Owners' ,
393- 'PermissionResources' , 'Product' , 'RegisteredDevice' , 'ResellerGlobalUltimate' ], data )
399+ 'PermissionResources' , 'Product' , 'RegisteredDevice' , 'ResellerGlobalUltimate' , 'ClassId' , 'ObjectType' , 'SharedScope' ], data )
394400 data ['Source' ] = pop (['ClassId' , 'link' ], data ['Source' ])
395401 write_splunk (
396402 index , account_name , 'cisco:intersight:assetDeviceContractInformations' , data )
@@ -418,9 +424,11 @@ def write_splunk(index, source, sourcetype, data):
418424 f"{ endpoint } ?$expand=RegisteredDevice($select=ClaimedByUserName,ClaimedTime,ConnectionStatusLastChangeTime,ConnectionStatus,CreateTime,ReadOnly)&$top={ results_per_page } &$skip={ str (i )} " )
419425 for data in RESPONSE .json ()['Results' ]:
420426 data = pop (['Ancestors' , 'PermissionResources' ,
421- 'Owners' ], data )
427+ 'Owners' , 'FaultSummary' , 'ClassId' , 'ObjectType' , 'SharedScope' ], data )
422428 data ['RegisteredDevice' ] = pop (
423429 ['ClassId' , 'ObjectType' ], data ['RegisteredDevice' ])
430+ data ['AlarmSummary' ] = pop (
431+ ['ClassId' , 'ObjectType' ], data ['AlarmSummary' ])
424432 write_splunk (
425433 index , account_name , 'cisco:intersight:networkElementSummaries' , data = data )
426434
@@ -446,8 +454,8 @@ def write_splunk(index, source, sourcetype, data):
446454 RESPONSE = r_intersight (
447455 f"{ endpoint } ?$top={ results_per_page } &$skip={ str (i )} " )
448456 for data in RESPONSE .json ()['Results' ]:
449- data = pop (['Account' , 'Ancestors' , 'Connections' ,
450- 'PermissionResources' , 'Owners' , 'RegisteredDevice' ], data )
457+ data = pop (['Account' , 'Ancestors' , 'Connections' , 'Parent' , 'DomainGroupMoid' ,
458+ 'PermissionResources' , 'Owners' , 'RegisteredDevice' , 'SharedScope' , 'ClassId' , 'ObjectType' ], data )
451459 write_splunk (
452460 index , account_name , 'cisco:intersight:assetTargets' , data = data )
453461
@@ -475,14 +483,16 @@ def write_splunk(index, source, sourcetype, data):
475483 RESPONSE = r_intersight (
476484 f"{ endpoint } ?$expand=Encryption($select=State),License,RegisteredDevice($select=ClaimedByUserName,ClaimedTime,ConnectionStatusLastChangeTime,ConnectionStatus,CreateTime,ReadOnly)&$top={ results_per_page } &$skip={ str (i )} " )
477485 for data in RESPONSE .json ()['Results' ]:
478- data = pop (['Alarm' , 'Ancestors' , 'ChildClusters' , 'Owners' , 'PermissionResources' ,
479- 'StorageContainers' , 'Nodes' , 'Health' , 'ParentCluster' , 'Volumes' ], data )
486+ data = pop (['Alarm' , 'Ancestors' , 'ChildClusters' , 'DomainGroupMoid' , 'ClassId' , ' Owners' , 'ObjectType ' , 'PermissionResources' ,
487+ 'StorageContainers' , 'SharedScope' , ' Nodes' , 'Health' , 'ParentCluster' , 'Volumes' ], data )
480488 data ['License' ] = pop (
481- ['Ancestors' , 'Cluster' , 'Owners' , 'PermissionResources' , 'RegisteredDevice' ], data ['License' ])
489+ ['Ancestors' , 'Cluster' , 'Owners' , 'DomainGroupMoid' , ' PermissionResources' , 'RegisteredDevice' ], data ['License' ])
482490 data ['RegisteredDevice' ] = pop (
483491 ['ClassId' , 'ObjectType' ], data ['RegisteredDevice' ])
484492 data ['Encryption' ] = pop (
485493 ['ClassId' , 'ObjectType' , 'Moid' ], data ['Encryption' ])
494+ data ['AlarmSummary' ] = pop (
495+ ['ClassId' , 'ObjectType' ], data ['AlarmSummary' ])
486496 write_splunk (index , account_name ,
487497 'cisco:intersight:hyperflexClusters' , data )
488498
@@ -502,8 +512,8 @@ def write_splunk(index, source, sourcetype, data):
502512 RESPONSE = r_intersight (
503513 f"{ endpoint } ?$expand=Drives&$top={ results_per_page } &$skip={ str (i )} " )
504514 for data in RESPONSE .json ()['Results' ]:
505- data = pop (['Ancestors' , 'ClusterMember' , 'Identity' ,
506- 'Owners ' , 'Parent ' , 'PermissionResources ' ], data )
515+ data = pop (['Ancestors' , 'ClusterMember' , 'Identity' , 'Owners' ,
516+ 'Parent ' , 'PermissionResources ' , 'SharedScope' , 'DomainGroupMoid' , 'ClassId' , 'ObjectType' , 'NodeUuid ' ], data )
507517 data ['Cluster' ] = pop (['ClassId' , 'link' ], data ['Cluster' ])
508518 data ['PhysicalServer' ] = pop (
509519 ['ClassId' , 'link' ], data ['PhysicalServer' ])
@@ -513,7 +523,7 @@ def write_splunk(index, source, sourcetype, data):
513523 else :
514524 for i in range (0 , len (data ['Drives' ])):
515525 data ['Drives' ][i ] = pop (
516- ['AccountMoid' , 'Ancestors' , 'ClassId' , 'NodeUuid' , 'Uuid' , 'SharedScope' , 'ObjectType' , 'Moid' , 'HostName' , 'Tags' , 'DomainGroupMoid' , 'LocatorLed' , 'Node' , 'Owners' , 'Parent' , 'PermissionResources' ], data ['Drives' ][i ])
526+ ['AccountMoid' , 'Ancestors' , 'ClassId' , 'NodeUuid' , 'Uuid' , 'SharedScope' , 'ObjectType' , 'Moid' , 'HostName' , 'Tags' , 'DomainGroupMoid' , 'LocatorLed' , 'Node' , 'Owners' , 'Parent' , 'PermissionResources' , 'HostUuid' ], data ['Drives' ][i ])
517527 write_splunk (index , account_name ,
518528 'cisco:intersight:hyperflexNodes' , data )
519529
0 commit comments