Giter VIP home page Giter VIP logo

oec-scripts's People

Contributors

5nafu avatar abhicr7 avatar ahalac-atlassian avatar ahmetrehaseker avatar aroelo avatar cglrkn avatar crodjer avatar emelkomurcu avatar erenkizilay avatar ertugrulsmz avatar faziletozer avatar github-actions[bot] avatar lr1980 avatar meralbusratekinsen avatar metehanozturk avatar mrgadget avatar ozlemmcokuk avatar prakhar-mudaiya avatar rjain3-og avatar rpratt-atlassian avatar samoxive avatar uraviog avatar vamshikanduri avatar zekihan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oec-scripts's Issues

Acknowledging from OpsGenie to Zabbix not working

Hi.

I'm tryng to configure oec to aknowldge alerts on zabbix as they're aknowledge on opsgenie

my zabbix version is 4.4.4

i'm using the script zabbixActionExecutorForZabbix4.py

and this is my oec config.json

{
  "apiKey": "omitted",
  "baseUrl": "https://api.eu.opsgenie.com",
  "logLevel": "DEBUG",
  "globalFlags": {
    "command_url": "omitted",
    "user": "omitted",
    "password": "omitted"
  },
  "actionMappings": {
    "Acknowledge": {
      "filepath": "/home/opsgenie/oec/zabbixActionExecutorForZabbix4.py",
      "sourceType": "local",
      "stdout": "/home/opsgenie/oec/oec.log"
    }
  },
  "pollerConf": {
    "pollingWaitIntervalInMillis": 100,
    "visibilityTimeoutInSec": 30,
    "maxNumberOfMessages": 10
  },
  "poolConf": {
    "maxNumberOfWorker": 12,
    "minNumberOfWorker": 4,
    "monitoringPeriodInMillis": 15000,
    "keepAliveTimeInMillis": 6000,
    "queueSize": 0
  }
}

And i receive this errror:

Jan 02 16:31:01 zabbix.arezzo.diennea.lan OpsgenieEdgeConnector[92388]: DEBU[2020-01-02T16:31:01.431393742+01:00] Action[Acknowledge] execution of message[b2975768-8c75-4b70-8907-fccd0f9f07c0] with entityId[2e05449f-7831-4be7-9c51-2192ae2187f8-1577979001914] failed: exit status 1 Stderr: Traceback (most recent call last):
Jan 02 16:31:01 zabbix.arezzo.diennea.lan OpsgenieEdgeConnector[92388]: File "/home/opsgenie/oec/zabbixActionExecutorForZabbix4.py", line 139, in <module>
Jan 02 16:31:01 zabbix.arezzo.diennea.lan OpsgenieEdgeConnector[92388]: main()
Jan 02 16:31:01 zabbix.arezzo.diennea.lan OpsgenieEdgeConnector[92388]: File "/home/opsgenie/oec/zabbixActionExecutorForZabbix4.py", line 110, in main
Jan 02 16:31:01 zabbix.arezzo.diennea.lan OpsgenieEdgeConnector[92388]: "eventids": queue_message["alert"]["details"]["eventId"],
Jan 02 16:31:01 zabbix.arezzo.diennea.lan OpsgenieEdgeConnector[92388]: KeyError: 'details'

could you help me please?

Cherwell rest API mapping

I've found an issue with the opsgenie cherwell scripts (against Cherwell 9.5.0 if that makes a difference). I finally was able to get it working. It appears the python code has renamed some attributes (they look correct in the previous Groovy code version of the scripts).

field_id should be fieldId
display_name should be displayName
(ie camelCase)

This results in the REST call to Cherwell including:
{
"dirty": true,
"display_name": "Short Description",
"field_id": "93e8ea93ff67fd95118255419690a50ef2d56f910c",
"name": "ShortDescription",
"value": "logged from opsgenie"
},

Instead of:
{
"dirty": true,
"displayName": "Short Description",
"fieldId": "93e8ea93ff67fd95118255419690a50ef2d56f910c",
"name": "ShortDescription",
"value": "logged from opsgenie"
},

And an error like this in the logs:
ERROR:root:[createIncident] [createIncident] Could not create incident; response: 500 b'{"busObPublicId":null,"busObRecId":null,"cacheKey":null,"fieldValidationErrors":[],"notificationTriggers":[],"errorCode":"GENERALFAILURE","errorMessage":"Object reference not set to an instance of an object.","hasError":true}'

TypeError Nagios actionExecutor.py

We currently get this error when the script tries to get the histogram image, but can't find it.
Reason: Err: exit status 1, Stderr: Traceback (most recent call last): File "/home/opsgenie/oec/scripts/actionExecutor.py", line 418, in <module> main() File "/home/opsgenie/oec/scripts/actionExecutor.py", line 367, in main attach("service") File "/home/opsgenie/oec/scripts/actionExecutor.py", line 262, in attach alert_histogram = get_alert_histogram(entity) File "/home/opsgenie/oec/scripts/actionExecutor.py", line 116, in get_alert_histogram return get_image(url, entity) File "/home/opsgenie/oec/scripts/actionExecutor.py", line 108, in get_image response.status_code) + "Reason: " + content) TypeError: must be str, not bytes

The 'response.content' that is returned is in a binary format, which gives a TypeError when it tries to log/print the warning message that the image can not be found.

I created #99 for a fix

Close Issue not working

When I try to close a Jira Issue this error pops up.

ESC[37mDEBUESC[0m[2019-09-30T09:17:15.926190112Z] Action[resolveIssue] execution of message[6086cc9b-e604-4fdb-97d9-7592a598b312] with alertId[22e461cd-1d27-4335-a22c-da8a14926eba-1569834735313] failed: exit status 1 Stderr: Traceback (most recent call last):
File "/var/opsgenie/oec/jiraActionExecutor.py", line 215, in
main()
File "/var/opsgenie/oec/jiraActionExecutor.py", line 132, in main
"id": get_transition_id(headers, result_url, "Resolved")
TypeError: get_transition_id() takes exactly 4 arguments (3 given)

line 46 of def get_transition_id is causing the error
response = requests.get(jira_url, None, headers=request_headers, auth=token, timeout=timeout)

Debian package doesn't install in Debian

Debian doesn't support the zst compression used to build the package and throws the following error on install:

dpkg-deb: error: archive 'opsgenie-nagios_1.1.4_amd64.deb' uses unknown compression for member 'control.tar.zst', giving up
dpkg: error processing archive opsgenie-nagios_1.1.4_amd64.deb (--install):
dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
opsgenie-nagios_1.1.4_amd64.deb

Tested on Debian 10.12

"Field 'priority' cannot be set. It is not on the appropriate screen, or unknown." while creating a jira ticket from opsgenie

Hello,

we are integrating opsgenie with Jira using OEC ,integration is completed and able to create the ESC jira ticket but Prioiry was not set as part of the ticket creation.

so I have made the changes to the python script to have priority field included but that seems to be not working...Please can you help if i am making any mistakes ?

elif mapped_action == "createIssue":
toLabel = "ogAlias:" + queue_message.get("alias")
content_params = {
"fields": {
"project": {
"key": project_key
},
"issuetype": {
"name": issue_type_name
},
"components": [{
"name": "IS-SRE"
}],
"priority": {
"id": "20000"
},

            "summary": queue_message.get("summary"),
            "description": queue_message.get("description"),
            "labels": [toLabel.replace("\\s", "")]
        }
    }

Please find the complete log output :

INFO:root:Will execute createIssue for alertId 6f987dc8-9304-4bc3-8592-f3e5368d47ab-1597221312739
DEBUG:root:Url: https://XXXXXXX.com
DEBUG:root:Username: XXXXXX
DEBUG:root:Project Key: ESC
DEBUG:root:Issue Type: Eng_ESC
DEBUG:root:Issue Key: None
DEBUG:root:{'fields': {'priority': {'id': '20000'}, 'description': u'The alert has no description.', 'labels': [u'ogAlias:6f987dc8-9304-4bc3-8592-f3e5368d47ab-1597221312739'], 'summary': u'jira test', 'project': {'key': u'ESC'}, 'components': [{'name': 'IS-SRE'}], 'issuetype': {'name': u'Eng_ESC'}}}
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): XXXXXXXX.com
DEBUG:requests.packages.urllib3.connectionpool:"POST /rest/api/2/issue HTTP/1.1" 400 None
WARNING:root:[createIssue] Could not execute at Jira; response: {"errorMessages":[],"errors":{"priority":"Field 'priority' cannot be set. It is not on the appropriate screen, or unknown."}} status code: 400

There are no such field in recieved json as mappedActionV2

While launching OEC integration i got that like json

{
  "action": "Create",
  "alert": {
    "actions": [
      "Create Jira Issue",
      "Restart",
      "AnExampleAction"
    ],
    "addedTags": "OverwriteQuietHours,Critical",
    "alertId": "370fe347-849a-4418-83fc-1557f7a11652-1554384340747",
    "alias": "370fe347-849a-4418-83fc-1557f7a11652-1554384340747",
    "createdAt": 1554384340747,
    "entity": "An example entity",
    "message": "TESTALERT",
    "priority": "P5",
    "recipients": [],
    "source": "XXX",
    "tags": [
      "OverwriteQuietHours",
      "Critical"
    ],
    "teams": [],
    "tinyId": "8861",
    "updatedAt": 1554384341542000000,
    "username": "Alert API"
  },
  "alertId": "370fe347-849a-4418-83fc-1557f7a11652-1554384340747",
  "customerId": "XXXX",
  "integrationId": "d3752135-3a42-4c3e-96c0-435e59bf1b24",
  "integrationName": "OEC-XX",
  "integrationType": "OEC",
  "mappedActionDto": {
    "extraField": "",
    "mappedAction": "postActionToOEC"
  },
  "params": {
    "action": "Create",
    "alert": {
      "actions": [
        "Create Jira Issue",
        "Restart",
        "AnExampleAction"
      ],
      "addedTags": "OverwriteQuietHours,Critical",
      "alertId": "370fe347-849a-4418-83fc-1557f7a11652-1554384340747",
      "alias": "370fe347-849a-4418-83fc-1557f7a11652-1554384340747",
      "createdAt": 1554384340747,
      "entity": "An example entity",
      "message": "TESTALERT",
      "priority": "P5",
      "recipients": [],
      "source": "XXX",
      "tags": [
        "OverwriteQuietHours",
        "Critical"
      ],
      "teams": [],
      "tinyId": "8861",
      "updatedAt": 1554384341542000000,
      "username": "Alert API"
    },
    "alertId": "370fe347-849a-4418-83fc-1557f7a11652-1554384340747",
    "customerId": "XXXX",
    "integrationId": "d3752135-3a42-4c3e-96c0-435e59bf1b24",
    "integrationName": "OEC-XX",
    "integrationType": "OEC",
    "mappedActionDto": {
      "extraField": "",
      "mappedAction": "postActionToOEC"
    },
    "sendViaMarid": false,
    "source": {
      "name": "XXX",
      "type": "API"
    },
    "type": "oec"
  },
  "sendViaMarid": false,
  "source": {
    "name": "XXX",
    "type": "API"
  },
  "type": "oec"
}

as far as i can see there are no such field as referenced in https://github.com/opsgenie/oec-scripts/blob/master/Jira/jiraActionExecutor.py#L77
Am i am have right configuration in oec on opsgenie side ?

Acknowledge action for HOST issue does not work

When attempting to acknowledge a ‘host’ alert, actionExecutor.py is not successfully acknowledging the issue on icigna2. We have identified this as an issue on line 82, where content_map [“type”] is being forced to “Service” although it is being successfully set (to either “Service” or “Host”) in “main()“. Removing line 82 content_map[“type”] = “Service” allows the acknowledging to work for both host and service. That issue was successfully debugged with @lumi-pwhitney.

Thank you in advance.

jiraServiceDeskActionExecutor.py: ability to ignore SSL Certificate/Set local keystore

Due to a SelfSigned certificate and a netscaler stripping certain items we had the issue that the JSD certificate was not trusted.

To set this to a correct local truststore I would suggest to add a parameter in this script to either set the correct store or to disable the verification.

e.g.
response = requests.post(result_url, data=json.dumps(content_params), headers=headers, auth=token, timeout=timeout, verify=False)

broken pipe error when acknowledging alert from opsgenie to jira using OEC

Here is the error that I get, please note that I have altered the script to not enforce certs when making the requests/updates, but that is the only difference.


Executed [addCommentToIssue] action via OEC[integrationId: ****** integrationType: Jira] with errors. Reason: Err: exit status 120, Stderr: --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.6/logging/init.py", line 998, in emit self.flush() File "/usr/lib/python3.6/logging/init.py", line 978, in flush self.stream.flush() BrokenPipeError: [Errno 32] Broken pipe Call stack: File "/home/opsgenie/oec/scripts/actionExecutor.py", line 215, in main() File "/home/opsgenie/oec/scripts/actionExecutor.py", line 93, in main logging.debug("Username: " + str(username)) Message: 'Username: ****' Arguments: () --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.6/logging/init.py", line 998, in emit self.flush() File "/usr/lib/python3.6/logging/init.py", line 978, in flush self.stream.flush() BrokenPipeError: [Errno 32] Broken pipe Call stack: File "/home/opsgenie/oec/scripts/actionExecutor.py", line 215, in main() File "/home/opsgenie/oec/scripts/actionExecutor.py", line 94, in main logging.debug("Project Key: " + str(project_key)) Message: 'Project Key: ' Arguments: () --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.6/logging/init.py", line 998, in emit self.flush() File "/usr/lib/python3.6/logging/init.py", line 978, in flush self.stream.flush() BrokenPipeError: [Errno 32] Broken pipe Call stack: File "/home/opsgenie/oec/scripts/actionExecutor.py", line 215, in main() File "/home/opsgenie/oec/scripts/actionExecutor.py", line 95, in main logging.debug("Issue Type: " + str(issue_type_name)) Message: 'Issue Type: Incident' Arguments: () --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.6/logging/init.py", line 998, in emit self.flush() File "/usr/lib/python3.6/logging/init.py", line 978, in flush self.stream.flush() BrokenPipeError: [Errno 32] Broken pipe Call stack: File "/home/opsgenie/oec/scripts/actionExecutor.py", line 215, in main() File "/home/opsgenie/oec/scripts/actionExecutor.py", line 96, in main logging.debug("Issue Key: " + str(issue_key)) Message: 'Issue Key: *****' Arguments: () --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.6/logging/init.py", line 998, in emit self.flush() File "/usr/lib/python3.6/logging/init.py", line 978, in flush self.stream.flush() BrokenPipeError: [Errno 32] Broken pipe Call stack: File "/home/opsgenie/oec/scripts/actionExecutor.py", line 215, in main() File "/home/opsgenie/oec/scripts/actionExecutor.py", line 167, in main logging.debug(str(content_params)) Message: '{'body': '[Opsgenie] ***** closed alert: "last try for Friday" https://opsg.in/a/t/tandemdiabetes/375\'}' Arguments: () --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.6/logging/init.py", line 998, in emit self.flush() File "/usr/lib/python3.6/logging/init.py", line 978, in flush self.stream.flush() BrokenPipeError: [Errno 32] Broken pipe Call stack: File "/home/opsgenie/oec/scripts/actionExecutor.py", line 215, in main() File "/home/opsgenie/oec/scripts/actionExecutor.py", line 169, in main timeout=timeout, verify=False) File "/usr/lib/python3/dist-packages/requests/api.py", line 112, in post return request('post', url, data=data, json=json, **kwargs) File "/usr/lib/python3/dist-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, **kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 520, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 630, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send timeout=timeout File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 589, in urlopen conn = self._get_conn(timeout=pool_timeout) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 251, in _get_conn return conn or self._new_conn() File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 826, in _new_conn self.num_connections, self.host) Message: 'Starting new HTTPS connection (%d): %s' Arguments: (1, 'jira.tandemdiabetes.com') /usr/lib/python3/dist-packages/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning) --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.6/logging/init.py", line 998, in emit self.flush() File "/usr/lib/python3.6/logging/init.py", line 978, in flush self.stream.flush() BrokenPipeError: [Errno 32] Broken pipe Call stack: File "/home/opsgenie/oec/scripts/actionExecutor.py", line 215, in main() File "/home/opsgenie/oec/scripts/actionExecutor.py", line 169, in main timeout=timeout, verify=False) File "/usr/lib/python3/dist-packages/requests/api.py", line 112, in post return request('post', url, data=data, json=json, **kwargs) File "/usr/lib/python3/dist-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, **kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 520, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 630, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send timeout=timeout File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen chunked=chunked) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 396, in _make_request httplib_response.length) Message: '%s://%s:%s "%s %s %s" %s %s' Arguments: ('https', 'jira..com', 8443, 'POST', '/rest/api/2/issue/*****/comment', 'HTTP/1.1', 201, 432) --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.6/logging/init.py", line 998, in emit self.flush() File "/usr/lib/python3.6/logging/init.py", line 978, in flush self.stream.flush() BrokenPipeError: [Errno 32] Broken pipe Call stack: File "/home/opsgenie/oec/scripts/actionExecutor.py", line 215, in main() File "/home/opsgenie/oec/scripts/actionExecutor.py", line 171, in main logging.info("Successfully executed at Jira") Message: 'Successfully executed at Jira' Arguments: () Exception ignored in: <_io.TextIOWrapper name='' mode='w' encoding='UTF-8'> BrokenPipeError: [Errno 32] Broken pipe


From my research, it appears to just be a connection issue with a socket, and it seems to be intermittent so I can't tell you how to reproduce, but it has been when acknowledging alerts.

jiraServiceDeskActionExecutor.py - queue_message error

When an alert created in OpsGenie no ticket is being created in jira sd and error is reflected in OEC log file, and in OpsGenie log file

OEC log file:

  File "/home/opsgenie/oec/executable/jiraServiceDeskActionExecutor.py", line 179, in <module>
    main()
  File "/home/opsgenie/oec/executable/jiraServiceDeskActionExecutor.py", line 85, in main
    project_key = parse_field('projectKey', False)
  File "/home/opsgenie/oec/executable/jiraServiceDeskActionExecutor.py", line 26, in parse_field
    if not variable.strip():
AttributeError: 'NoneType' object has no attribute 'strip'

OpsGenie log file:

[system] Executed [createIssue] action via OEC[integrationId: 79d55750-d96c-44ac-a0a9-2f16a66eeee1 integrationType: JiraServiceDesk] with errors. Reason: Err: exit status 1, Stderr: Traceback (most recent call last): File "/home/opsgenie/oec/executable/jiraServiceDeskActionExecutor.py", line 179, in <module> main() File "/home/opsgenie/oec/executable/jiraServiceDeskActionExecutor.py", line 85, in main project_key = parse_field('projectKey', False) File "/home/opsgenie/oec/executable/jiraServiceDeskActionExecutor.py", line 26, in parse_field if not variable.strip(): AttributeError: 'NoneType' object has no attribute 'strip'

Raw output:

{
  "alertLogOwner": "System",
  "alertId": "a8c3e2b3-08cb-426e-9d86-60e0f3462793-1564492418009",
  "alertLogType": "system"
}

Latest OEC-scripts 1.1.6 throws error on older OS releases / python versions

We are running Icinga2 on RHEL7. A few days ago, I've updated to the latest release of these scripts (which was a bit painful, because the version inside the package is still 1.1.5).

Just now, I've noticed that opened alerts using the new scripts do show an error in OpsGenie alert activity log:

Executed [Create] action via OEC[integrationId: <id> integrationType: Icinga2] with errors. Reason: Err: exit status 1, Stderr: 
Traceback (most recent call last): File "/home/opsgenie/oec/scripts/actionExecutor.py", line 388, in <module> main()
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 371, in main send_create_request(is_service_alert)
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 46, in send_create_request attach(is_service_alert) 
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 122, in attach with tempfile.TemporaryDirectory() as tempdir:
 AttributeError: 'module' object has no attribute 'TemporaryDirectory'

Version number mismatch between download link and deb package version

Downloading version 1.0.4:

opsgenie@a62da8149262:/$ wget https://og-release-cicd-public-oregon.s3-us-west-2.amazonaws.com/purpose=public/project=oec-scripts/env=prod/branch=master/module=oec-scripts/version=1.0.4/opsgenie-jiraservicedesk-1.0.4-deb-amd64.deb -O /tmp/opsgenie-oec.dpkg
--2020-04-03 07:22:51--  https://og-release-cicd-public-oregon.s3-us-west-2.amazonaws.com/purpose=public/project=oec-scripts/env=prod/branch=master/module=oec-scripts/version=1.0.4/opsgenie-jiraservicedesk-1.0.4-deb-amd64.deb
Resolving og-release-cicd-public-oregon.s3-us-west-2.amazonaws.com (og-release-cicd-public-oregon.s3-us-west-2.amazonaws.com)... 52.218.241.177
Connecting to og-release-cicd-public-oregon.s3-us-west-2.amazonaws.com (og-release-cicd-public-oregon.s3-us-west-2.amazonaws.com)|52.218.241.177|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8465562 (8.1M) [application/octet-stream]
Saving to: '/tmp/opsgenie-oec.dpkg'

/tmp/opsgenie-oec.dpkg                   100%[==================================================================================>]   8.07M  3.83MB/s    in 2.1s

2020-04-03 07:22:54 (3.83 MB/s) - '/tmp/opsgenie-oec.dpkg' saved [8465562/8465562]

But package version is still 1.0.3:

opsgenie@a62da8149262:/$ dpkg-deb -I /tmp/opsgenie-oec.dpkg
 new Debian package, version 2.0.
 size 8465562 bytes: control archive=562 bytes.
     260 bytes,     8 lines      control
     232 bytes,     8 lines   *  postinst             #!/bin/bash
     271 bytes,    13 lines   *  preinst              #!/bin/bash
 Name: Opsgenie Edge Connector (OEC)
 Description: Integration server for Connecting On-Premise Monitoring and ITSM Tools
 Website: https://www.opsgenie.com
 Maintainer: Opsgenie
 Package: jiraservicedesk
 Section: jiraservicedesk
 Version: 1.0.3
 Architecture: amd64

opsgenie-icinga2 deb package has wrong name

Hello!

When installing opsgenie-icinga2 from deb package, it tries to replace actual Icinga2 due to package name being the same:

# dpkg-deb -I opsgenie-icinga2_1.1.3_amd64.deb 
 new Debian package, version 2.0.
 size 10788760 bytes: control archive=632 bytes.
     244 bytes,     8 lines      control              
     232 bytes,     8 lines   *  postinst             #!/bin/bash
     271 bytes,    13 lines   *  preinst              #!/bin/bash
 Name: Opsgenie Edge Connector (OEC)
 Description: Integration server for Connecting On-Premise Monitoring and ITSM T
ools
 Website: https://www.opsgenie.com
 Maintainer: Opsgenie
 Package: icinga2
 Section: icinga2
 Version: 1.1.3
 Architecture: amd64

Package name should not be icinga2, but opsgenie-icinga2 instead.

Icinga: actionExecutor.py doesn't assure the working dir while generation Zip file(s)

During processing of the alert integration script tries to create ZIPed observation document with histogram and trend images from Icinga.

As a first step of it it creates a ZIP file with the embedded date in the name, but doesn't specify in which directory that file will be created.

actionExecutor.py#L259

Apparently, somewhere in the process the current working directory either changes or initially set to the non-writable directory.

Hence, we are getting this error:

Executed [Create] action via OEC[integrationId: fd2c40c5-xxxxxxxxxxxxxxxxxxx integrationType: Icinga] with errors.
Reason: Err: exit status 1, Stderr: 
Traceback (most recent call last): 
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 425, in <module> main() 
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 408, in main send_create_request() 
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 288, in send_create_request attach() 
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 261, in attach zip = zipfile.ZipFile(file_name, 'w') 
File "/usr/lib64/python3.6/zipfile.py", line 1113, in __init__ self.fp = io.open(file, filemode) PermissionError: [Errno 13] 
Permission denied: 'details_2021_03_21_21_03_1616359507.zip' 

Either script should set CWD in the beginning to it's home directory(and hope it's writable) or should use /tmp or /var/tmp for creating a temporary ZIP file or should have an option to specify writable tmp directory and use it in the filename.

Also, readability of the script may benefit from using f'strings or format...

globalArgs Issue

Hi,

I would like to close a JIRA ticket if an alert in Opsgenie is closed. I'm using the jiraActionExecutor.py and oec. I'm getting this error when an alert is closed.

ESC[37mDEBUESC[0m[2019-09-27T13:47:15.263251913Z] Action[AddNote] execution of message[f3faf014-abce-415b-adf5-8e2067a0a35d] with alertId[698e9575-d8ed-4c5a-b780-111c63e867e2-1569584384790] failed: exit status 2 Stderr: usage: jiraActionExecutor.py [-h] -payload QUEUEPAYLOAD -apiKey APIKEY
-opsgenieUrl OPSGENIEURL -logLevel LOGLEVEL
[-username USERNAME] [-password PASSWORD]
[-url URL] [-projectKey PROJECTKEY]
[-issueTypeName ISSUETYPENAME]
jiraActionExecutor.py: error: unrecognized arguments: <list_of_args_you_want_to_pass_to_the_scripts>

What am I missing? What is globalArgs used for?

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.