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

Commit

Permalink
fix: moved indexes from config yaml to args (#73)
Browse files Browse the repository at this point in the history
* fix: fixed bug in passing aargs to format_value_for_mib_server()

* fix: move index from cconfig yaml to args
  • Loading branch information
lingy1028 committed May 19, 2021
1 parent 4c5a841 commit 54a4a70
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion splunk_connect_for_snmp_traps/manager/hec_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def configure_thread_pool(self):
user_suggested_working_threads = self._args.hec_threads
max_workers = max_allowed_working_threads(user_suggested_working_threads)
logger.debug(f"Configured a thread-pool with {max_workers} concurrent threads")
logger.debug(f"Configured Splunk index for SNMP traps: {self._args.index}")
return concurrent.futures.ThreadPoolExecutor(max_workers=max_workers)

def get_session(self):
Expand All @@ -37,7 +38,7 @@ def post_data_to_thread_pool(self, host, variables_binds):
"time": time.time(),
"sourcetype": "sc4snmp:traps",
"host": host,
"index": self._server_config["splunk"]["index"],
"index": self._args.index,
"event": variables_binds,
}

Expand Down
2 changes: 1 addition & 1 deletion splunk_connect_for_snmp_traps/manager/mib_server_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_translation(var_binds, mib_server_url):
var_bind = {
"oid": str(name),
"oid_type": name.__class__.__name__,
"val": format_value_for_mib_server(val),
"val": format_value_for_mib_server(val, val.__class__.__name__),
"val_type": val.__class__.__name__,
}
var_binds_list.append(var_bind)
Expand Down
4 changes: 4 additions & 0 deletions splunk_connect_for_snmp_traps/snmp_trap_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def main():
)
parser.add_argument("-c", "--config", default="config.yaml", help="Config File")

parser.add_argument(
"-i", "--index", default="##EVENTS_INDEX##", help="Index for traps"
)

args = parser.parse_args()

log_level = args.loglevel.upper()
Expand Down

0 comments on commit 54a4a70

Please sign in to comment.