Service Now notification fails

Hello, I have integrated Service-now into CMK for notification tickets as per -

However, no notification is created while testing with Fake check commands.

The notify.log states -

2021-08-23 06:55:24 Global rule 'Alerts for Service-now'...
2021-08-23 06:55:24  -> matches!

 SERVICEOUTPUT_HTML=(This macro is deprecated: see Werk#7427)

Are you sure you use the builtin plugin (anything in ~/local/share/check_mk/notifications/)?
What cmk version is used?

Yes, i am using the built-in plugin for the notification and the version using is 1.6.0p17 enterprise.

There is servicenow.py file in the (~/local/share/check_mk/notifications/) location

I read a post from “nickjwest1” that helped to make some progress -

I added a Contact to the Notification template and it gave different result from before. However, there seems to be plugin error that is failing the the notification still -

2021-09-02 10:07:31 Global rule 'Alerts for Service-now-test'...
2021-09-02 10:07:31  -> matches!

2021-09-02 10:07:31 Executing 1 notifications:
2021-09-02 10:07:31   * notifying cmk_khozy via servicenow, parameters: username, impact, host_short_desc, svc_desc, url, caller, password, svc_short_desc, urgency, host_desc, bulk: no

2021-09-02 10:07:31 Creating spoolfile: /omd/sites/ciq_enterprise/var/check_mk/notify/spool/a625dc0e-6b1c-4e17-b6a2-310867156041
2021-09-02 10:07:35 ----------------------------------------------------------------------
2021-09-02 10:07:35 Got spool file a625dc0e (url.com;HTTPS url.com) for local delivery via servicenow
2021-09-02 10:07:35      executing /omd/sites/ciq_enterprise/share/check_mk/notifications/servicenow
2021-09-02 10:07:36      Output: Traceback (most recent call last):
2021-09-02 10:07:36      Output:   File "/omd/sites/ciq_enterprise/share/check_mk/notifications/servicenow", line 14, in <module>
2021-09-02 10:07:36      Output:     sys.exit(servicenow.main())
2021-09-02 10:07:36      Output:   File "/omd/sites/ciq_enterprise/lib/python/cmk/cee/notification_plugins/servicenow.py", line 116, in main
2021-09-02 10:07:36      Output:     incident = handle_issue_exists(problem_id, proxies, url, user, pwd)
2021-09-02 10:07:36      Output:   File "/omd/sites/ciq_enterprise/lib/python/cmk/cee/notification_plugins/servicenow.py", line 263, in handle_issue_exists
2021-09-02 10:07:36      Output:     return response.json()["result"][0]["number"], response.json()["result"][0]["sys_id"]
2021-09-02 10:07:36      Output: KeyError: 'result'
2021-09-02 10:07:36      Plugin exited with code 1

Hello, please help to identify the problem here. Thanks!

@_rb @andreas-doehler @aeckstein @JoeDrake @cjcox

Please extend your help to identify the problem with this issue. Thank you.

I have no ServiceNow in usage at any of my sites. But your error shows that there is no result in the query for existing issues.
I have no enterprise 1.6 here to look at the code, but inside the actual 2.0 code these return statement, what gave you the error, is inside a “try - except” block and cannot lead to this message.

Thank you for the suggestions. The plugin is configured and working. Now, when i try to generate a fake notification for same host twice, it only creates a ticket in servicenow on first attempt and rejects for subsequent alerts.

Log tells that a problem id already exist and I am unable to create new tickets for same host twice or more even after closing the prior ticket -

2021-10-11 07:16:54 Got spool file 79d49251 (host.com;HTTPS host.com) for local delivery via servicenow
2021-10-11 07:16:54      executing /omd/sites/cmk_enterprise/share/check_mk/notifications/servicenow
2021-10-11 07:16:55      Output: Ticket INC0010533 with Check_MK problem ID: 22 in work notes already exists.

Any help with the above observation or problem i get with ServiceNow ticket creation for same host?? Thank you !!

Hi @khozy, I am sorry your problem could not be solved yet!

However, I want to make you aware of our about page for the troubleshooting section.
I want to underline the following things, as they seem striking to me:

  • Everyone here does this in their free time, please treat them accordingly
  • If you need urgent support, please open a ticket with the tribe or a partner (requires support contract)
  • Please use @mentions carefully

Your last finding is no problem this is working as intended i think.
Same problem ID no new ticket.
Fake notifications are no good way to test notifications as they lack some information normally needed. It is better to create “fake” service/host problems for such testing.

Hello @andreas-doehler

Please help me to understand few points -

  • Why does the problem id always assigned is 22
  • Is it possible to change the settings for the way these problem id is assigned? Where is this setting defined?
  • A new ticket for same host is only created when the ticket is deleted from service now. Ideally, it should allow to create a new ticket once the existing ticket is closed or resolved.

For real problems this is every time another number like you see here.
image

There is no setting the core generates this number as a consecutive number.
The problem after the problem from the screenshot has then the number 5651.

This is possible if your new ticket has not the same problem ID.
If your system generates for every notification the same ID then there is a problem in the system.
To check this go to the notification system and activate the analysis function.
image
Then check the single shown events for the event IDs.
image
You should see different problem IDs for the single problems.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.