diff --git a/pandora_plugins/message_app_connectors/.vscode/settings.json b/pandora_plugins/message_app_connectors/.vscode/settings.json deleted file mode 100644 index cf160325ad..0000000000 --- a/pandora_plugins/message_app_connectors/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.pythonPath": "slack/venv/bin/python" -} diff --git a/pandora_plugins/message_app_connectors/discord/pandora_discord_cli.py b/pandora_plugins/message_app_connectors/discord/pandora_discord_cli.py index 5a278a0e6b..522f5fb75e 100644 --- a/pandora_plugins/message_app_connectors/discord/pandora_discord_cli.py +++ b/pandora_plugins/message_app_connectors/discord/pandora_discord_cli.py @@ -21,7 +21,7 @@ parser.add_argument('--author_icon_url', help='Alert custom author icon url ', d parser.add_argument('--thumb', help='Custom thumbnail url', default='') parser.add_argument('--api_conf', help='Api configuration parameters in coma separate keypairs. EX "user=admin,pass=pandora,api_pass=1234,api_url=http://test.artica.es/pandora_console/include/api.php"') parser.add_argument('--module_graph', help='Uses pandora API to generate a module graph and attach it to the alert needs module_id and interval parameters in coma separate keypairs. EX "module_id=55,interval=3600"') -parser.add_argument('--tmp_dir', help='Temporary path to store grph images', default='/tmp') +parser.add_argument('--tmp_dir', help='Temporary path to store graph images', default='/tmp') args = parser.parse_args() @@ -50,15 +50,15 @@ def parse_api_conf(cConf): apid = parse_dic(cConf) if apid.get("user") is None: - print ("Error no user defined in api_conf keypairs, skiping graph generation.") + print ("Error no user defined in api_conf keypairs, skipping graph generation.") return if apid.get("pass") is None: - print ("Error no password defined in api_conf keypairs, skiping graph generation.") + print ("Error no password defined in api_conf keypairs, skipping graph generation.") return if apid.get("api_pass") is None: - print ("Error no Api pass defined in api_conf keypairs, skiping graph generation.") + print ("Error no Api pass defined in api_conf keypairs, skipping graph generation.") return if apid.get("api_url") is None: @@ -78,7 +78,7 @@ def parse_graph_conf(cGraph): # Parse Api config graphd = parse_dic(cGraph) if graphd.get("module_id") is None: - print ("error no module_id defined in module_graph keypairs, skiping graph generation.") + print ("error no module_id defined in module_graph keypairs, skipping graph generation.") return if graphd.get("interval") is None: @@ -91,19 +91,19 @@ def parse_graph_conf(cGraph): def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterval) : sep="url_encode_separator_%7C" try: - url = f"{baseUrl}?op=get&op2=module_graph&id={moduleId}&other={graphInterval}%7C1&other_mode={sep}C&apipass={apiPass}&api=1&user={pUser}&pass={pPass}" + url = f"{baseUrl}?op=get&op2=module_graph&id={moduleId}&other={graphInterval}%7C1&other_mode={sep}&apipass={apiPass}&api=1&user={pUser}&pass={pPass}" graph = requests.get(url) if graph.status_code != 200: - print (f"Error requested api url, status code: {graph.status_code}. Skiping graph generation") + print (f"Error requested api url, status code: {graph.status_code}. skipping graph generation") return None if graph.text == "auth error": - print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation") + print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation") return None if graph.text == "Id does not exist in database.": - print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation") + print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation") return None except: - print("Error requested api url. Skiping graph generation") + print("Error requested api url. skipping graph generation") return None return graph diff --git a/pandora_plugins/message_app_connectors/gchat/pandora-gchat-cli.py b/pandora_plugins/message_app_connectors/gchat/pandora-gchat-cli.py index 5e2a47b3f8..4584768ec7 100644 --- a/pandora_plugins/message_app_connectors/gchat/pandora-gchat-cli.py +++ b/pandora_plugins/message_app_connectors/gchat/pandora-gchat-cli.py @@ -88,9 +88,9 @@ def sendMessage(url, message): header = {'Content-Type': 'application/json; charset: UTF-8'} response = requests.post(url, headers=header, data=message) - print(f"Mesage sent succefuly: {response.status_code}") + print(f"Message sent successfully: {response.status_code}") except: - print("Error requested api url. Skiping graph generation") + print("Error requested api url. skipping graph generation") return None return response diff --git a/pandora_plugins/message_app_connectors/slack/pandora-slack-cli.py b/pandora_plugins/message_app_connectors/slack/pandora-slack-cli.py index 31cfa97811..b09938b885 100644 --- a/pandora_plugins/message_app_connectors/slack/pandora-slack-cli.py +++ b/pandora_plugins/message_app_connectors/slack/pandora-slack-cli.py @@ -21,7 +21,7 @@ parser.add_argument('-D', '--desc', help='Slack description message', default='' parser.add_argument('-F','--footer', help='Custom footer, default: PandoraFMS', default='PandoraFMS') parser.add_argument('--api_conf', help='Api configuration parameters in coma separate keypairs. EX "user=admin,pass=pandora,api_pass=1234,api_url=http://test.artica.es/pandora_console/include/api.php"') parser.add_argument('--module_graph', help='Uses pandora API to generate a module graph and attach it to the alert needs module_id and interval parameters in coma separate keypairs. EX "module_id=55,interval=3600"') -parser.add_argument('--tmp_dir', help='Temporary path to store grph images', default='/tmp') +parser.add_argument('--tmp_dir', help='Temporary path to store graph images', default='/tmp') args = parser.parse_args() filename = None @@ -49,22 +49,22 @@ def compose_message (values, tittle, emoji, message, footer): return m def parse_api_conf(cConf): - """Check apiconfiguration parameters """ + """Check api configuration parameters """ if args.api_conf : # Parse Api config print ("Api config enable") apid = parse_dic(cConf) if apid.get("user") is None: - print ("Warning. no user defined in api_conf keypairs, skiping graph generation.") + print ("Warning. no user defined in api_conf keypairs, skipping graph generation.") return None if apid.get("pass") is None: - print ("Warning. no password defined in api_conf keypairs, skiping graph generation.") + print ("Warning. no password defined in api_conf keypairs, skipping graph generation.") return None if apid.get("api_pass") is None: - print ("Warning. no api pass defined in api_conf keypairs, skiping graph generation.") + print ("Warning. no api pass defined in api_conf keypairs, skipping graph generation.") return None if apid.get("api_url") is None: @@ -81,7 +81,7 @@ def parse_graph_conf(cGraph): # Parse Api config graphd = parse_dic(cGraph) if graphd.get("module_id") is None: - print ("Warning. no module_id defined in module_graph keypairs, skiping graph generation.") + print ("Warning. no module_id defined in module_graph keypairs, skipping graph generation.") return if graphd.get("interval") is None: @@ -89,26 +89,26 @@ def parse_graph_conf(cGraph): return graphd else: - print("Warning. no module_graph keypairs defined, skiping graph generation") + print("Warning. no module_graph keypairs defined, skipping graph generation") return None def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterval, sep="url_encode_separator_%7C") : """Call Pandorafms api to get graph""" try: - url = f"{baseUrl}?op=get&op2=module_graph&id={moduleId}&other={graphInterval}%7C1&other_mode={sep}C&apipass={apiPass}&api=1&user={pUser}&pass={pPass}" + url = f"{baseUrl}?op=get&op2=module_graph&id={moduleId}&other={graphInterval}%7C1&other_mode={sep}&apipass={apiPass}&api=1&user={pUser}&pass={pPass}" graph = requests.get(url) if graph.status_code != 200: - print (f"Error requested api url, status code: {graph.status_code}. Skiping graph generation") + print (f"Error requested api url, status code: {graph.status_code}. skipping graph generation") return None if graph.text == "auth error": - print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation") + print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation") return None if graph.text == "Id does not exist in database.": - print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation") + print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation") return None except: - print("Error requested api url. Skiping graph generation") + print("Error requested api url. skipping graph generation") return None return graph @@ -166,7 +166,7 @@ if args.api_conf : else: filename = None # Send message -send_message(messageString, args.channel, client, "> Mesage sent succefuly") +send_message(messageString, args.channel, client, "> Message sent successfully") if filename is not None: if os.path.isfile(filename): send_image(filename, args.channel, client) if args.footer: send_message(args.footer, args.channel, client)