Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

feat: enrich data with linked tables #101

Merged
merged 38 commits into from
Aug 23, 2021
Merged

Conversation

omrozowicz-splunk
Copy link
Contributor

This PR contains implementation of "Enrich data with linked tables" Epic:

  1. mechanism for the processing of data provided in enricher, ex.:
    `enricher:
    oidFamily:
    IF-MIB:
    • ifIndex: 'interface_index'
    • ifDescr: 'interface_desc'`
  2. Adding static data extracted from walk operation to Mongo, ex.:
    "MIB-STATIC-DATA" : { "IF-MIB" : [ { "interface_index" : [ "1", "2" ] }, { "interface_desc" : [ "lo", "eth0" ] }
  3. Integration with post_data_to_splunk_hec() function, adding extra fields for both metric and non-metric data.

lstoppa and others added 28 commits July 29, 2021 13:03
- initial commit
- sanitizers (formatting)
- sanitizers (formatting, again)
- sanitizers: json files cannot have comments, however our sanitizer wants our json
  files to have comments. We changed json to jsoncomment in order to add those required
  comments.
- sanitizers: json files cannot have comments, however our sanitizer wants our json
  files to have comments. We changed json to jsoncomment in order to add those required
  comments (part #2)
- sanitizers: json files cannot have comments, however our sanitizer wants our json
  files to have comments. We changed json to jsoncomment in order to add those required
  comments (part #3)
- added integration code: now, we can extract fields, based on the configuration file we have
- some lint sort error
- added support for basic mongo operations and enricher
@codecov-commenter
Copy link

codecov-commenter commented Aug 18, 2021

Codecov Report

Merging #101 (57cc2e0) into develop (123864f) will increase coverage by 2.90%.
The diff coverage is 63.03%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #101      +/-   ##
===========================================
+ Coverage    52.19%   55.10%   +2.90%     
===========================================
  Files           28       29       +1     
  Lines         1071     1254     +183     
===========================================
+ Hits           559      691     +132     
- Misses         512      563      +51     
Impacted Files Coverage Δ
splunk_connect_for_snmp_poller/manager/tasks.py 36.23% <12.50%> (-1.87%) ⬇️
splunk_connect_for_snmp_poller/mongo.py 36.17% <20.00%> (+36.17%) ⬆️
..._connect_for_snmp_poller/manager/task_utilities.py 20.76% <20.27%> (-0.07%) ⬇️
...nnect_for_snmp_poller/manager/mib_server_client.py 28.94% <50.00%> (ø)
...lunk_connect_for_snmp_poller/manager/hec_sender.py 35.48% <69.56%> (+16.43%) ⬆️
..._for_snmp_poller/manager/realtime/interface_mib.py 98.07% <100.00%> (+0.11%) ⬆️
...poller/manager/static/interface_mib_utililities.py 100.00% <100.00%> (ø)
...ect_for_snmp_poller/manager/static/mib_enricher.py 94.11% <100.00%> (+4.37%) ⬆️
tests/test_hec_sender.py 100.00% <100.00%> (ø)
tests/test_mib_enricher.py 100.00% <100.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 123864f...57cc2e0. Read the comment docs.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-eye has totally checked 217 files.

Valid Invalid Ignored Fixed
40 4 173 0
Click to see the invalid file list
  • tests/mib_walk_data/if_mib_walk.json
  • tests/mib_walk_data/if_mib_walk_invalid_indexes.json
  • tests/mib_walk_data/if_mib_walk_invalid_networks.json
  • tests/test_mib_enricher.py

tests/test_mib_enricher.py Outdated Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…r-snmp-poller into feature/integrate-mongo

� Conflicts:
�	splunk_connect_for_snmp_poller/manager/realtime/interface_mib.py
�	splunk_connect_for_snmp_poller/manager/static/interface_mib_utililities.py
�	splunk_connect_for_snmp_poller/manager/static/mib_enricher.py
�	splunk_connect_for_snmp_poller/mongo.py
�	tests/test_mib_enricher.py
�	tests/test_static_config_data_for_network_interfaces.py
mib_enricher.process_one(metric_result)
for field_name in mib_enricher.dimensions_fields:
if field_name in metric_result:
non_metric_result += f'{field_name}="{metric_result[field_name]}" '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to have field names separated by space we append it at the end of each iteration and rely on variables_binds["non_metric"] to have trailing space (most probbably added by MIB server). When there are no dimensions_fields we will have trailing space on the output. Not sure if this is a problem though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default way text data is being returned from mib server. I'm not sure if it's correct, but after this PR nothing will be changed.

@github-actions
Copy link
Contributor

Expected release notes (by @omrozowicz-splunk)

features:
update the scenario when enricher part was deleted form the config file (57cc2e0)
fix getBulk scenario (da51112)
add dataformatic after false metric varbind (1f197b5)
refactor some function and attributes names (8722d3f)
change translation client to match new mib server (3aa919a)
refactor IF_MIB_METRIC_SUFFIX (c36a219)
extract enricher data from config (#97) (123864f)
cleanup (b05d1bd)
cleanup (f5d7828)
add unit test and reformat code (16a6043)
add integration for bulk and get operations (9aba508)
add integration for bulk and get operations (d4f494d)
add integration for bulk and get operations (c6c54eb)
add integration for bulk and get operations (17f61d0)
stable version with working mongo saving data from walk and adding additional dimensions to walk data (e984835)
redesign logic of non metric data processing (f5a86a8)
redesign logic of non metric data processing (14315e2)
redesign logic of non metric data processing (94c83cf)
ADD mongo integration and sending data to HEC (27539ce)
ADD mongo integration and sending data to HEC (dfba10e)
ADD mongo integration and sending data to HEC (ed2eb31)
ADD mongo integration and sending data to HEC (55cd6a8)
ADD mongo integration and sending data to HEC (9073c8f)
ADD mongo integration and sending data to HEC (bbfe329)
ADD mongo integration and sending data to HEC (d59174a)
ADD mongo integration and sending data to HEC (98b1220)
extract IF-MIB data from an SNMPWALK (#96) (7699591)
support polling the same IP address using multiple profiles (#92) (a6320ca)

fixes:
lint (ADDON-39581) - added support for basic mongo operations and enricher (b2ef85c)
lint (ADDON-39580) - some lint sort error (23e75b4)
lint (ADDON-39580) - added integration code: now, we can extract fields, based on the configuration file we have (ae3647e)
lint (ADDON-39580) - sanitizers: json files cannot have comments, however our sanitizer wants our json files to have comments. We changed json to jsoncomment in order to add those required comments (part #3) (220f7e8)
lint (ADDON-39580) - sanitizers: json files cannot have comments, however our sanitizer wants our json files to have comments. We changed json to jsoncomment in order to add those required comments (part #2) (41a4c39)
lint (ADDON-39580) - sanitizers: json files cannot have comments, however our sanitizer wants our json files to have comments. We changed json to jsoncomment in order to add those required comments. (f1abfb7)
lint (ADDON-39580) - sanitizers (formatting, again) (9285510)
lint (ADDON-39580) - sanitizers (formatting) (1c921ba)
lint (ADDON-39580) - initial commit (f92aa4f)
forced commit for creating new release (f3081c1)

others (will not be included in Semantic-Release notes):
2ead372 Update tests/test_mib_enricher.py
33acbbf feat: Replace multiple SNMP walks with one SNMP Bulk (#100)
ebe3ebf Feature/redo walk (#95)
d5879c5 Stubs for lint
9cff184 Stubs for lint
adddbea Stubs for lint
5dc1549 Stubs for lint
2c5a5c3 Feat/multiple profiles2 (#93)

  • I hereby acknowledge these release notes are 🥙 AWESOME 🥙

@weliasz weliasz merged commit 75bdb13 into develop Aug 23, 2021
@weliasz weliasz deleted the feature/integrate-mongo branch August 23, 2021 06:19
@github-actions github-actions bot locked and limited conversation to collaborators Aug 23, 2021
@ryanfaircloth
Copy link
Contributor

🎉 This PR is included in version 1.5.0-develop.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants