Page 2 of 3

Re: Nagios integration with Service-now

Posted: Tue Oct 13, 2020 2:14 pm
by tgriep
The ServiceNow perl script is suppose to log the connections to the following log file.

Code: Select all

/var/log/sn_ticketer.log
Check it for any errors and make sure the URL it is trying to access is correct.

Re: Nagios integration with Service-now

Posted: Wed Oct 14, 2020 4:27 am
by Beena_Jogin
I have updated same error msg in /var/log/sn_ticketer.log and accessing the correct url

****************************************
13/10/2020 8:15:50 Config loaded.
13/10/2020 8:15:50 Connecting to: https://inf.nagio.interface.user:passwo ... nt.do?WSDL
13/10/2020 8:15:50 Connection to Service-Now Failed: 400 Bad Request


****************************************

From payload , manually able to create the service now tickets but when trying from service-now perl script getting below error
===========================================================================
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 400 Bad Request
Connection: close
Date: Wed, 14 Oct 2020 09:26:23 GMT
Server: ServiceNow
Client-Date: Wed, 14 Oct 2020 09:26:23 GMT
Client-Peer: 139.1.152.51:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=DE/O=T-Systems International GmbH/OU=T-Systems Trust Center/ST=Nordrhein Westfalen/postalCode=57250/L=Netphen/street=Untere Industriestr. 20/CN=TeleSec ServerPass Class 2 CA
Client-SSL-Cert-Subject: /C=DE/O=operational services GmbH & Co. KG/OU=Business Customers/ST=Hessen/L=Frankfurt am Main/CN=*.osnow.de
Client-SSL-Cipher: ECDHE-RSA-AES256-GCM-SHA384
Client-SSL-Socket-Class: IO::Socket::SSL
Client-Transfer-Encoding: chunked
Set-Cookie: BIGipServerpool_poc1.osnow.de=!LPdeUDWeT9RbYDu4wCke6xiIs5ISUZ/aMgXR9MM68M/g51lgqLoW0U4OluiVxJy0Qvp3yp6XERK9tA==; path=/; Httponly; Secure

400 Bad Request at /usr/local/nagios/libexec/service-now.pl line 447.
========================================================================================

also below nagios log


[1602683493] wproc: stderr line 01: print() on closed filehandle LOG at /usr/local/nagios/libexec/sn_ticketer.pl line 658.
[1602683493] wproc: stderr line 02: 400 Bad Request at /usr/local/nagios/libexec/sn_ticketer.pl line 301.
[1602683493] wproc: stdout line 01: Unable to open log file: Permission denied
[1602683493] wproc: stdout line 02: Cleaning up archived DB entries older than TTL
[1602683493] wproc: stdout line 03: Config loaded.
[1602683493] wproc: stdout line 04: Message hash for this alert is: a420f7821f45341530b8c21379d37259
[1602683493] wproc: stdout line 05: Ticket track enabled using database.
[1602683493] wproc: stdout line 06: Inserting low into priority.
[1602683493] wproc: stdout line 07: Inserting monitoring into contact_type.
[1602683493] wproc: stdout line 08: Inserting Host: LX140Y.EMEA.ADS.LANXESS
[1602683493] wproc: stdout line 09: Service: Explorer
[1602683493] wproc: stdout line 10: State: CRITICAL
[1602683493] wproc: stdout line 11: Time: Wed Oct 14 13:51:33 UTC 2020
[1602683493] wproc: stdout line 12: Description: explorer.exe: not running
[1602683493] wproc: stdout line 13:
[1602683493] wproc: stdout line 14: into description.
[1602683493] wproc: stdout line 15: Inserting inf.nagio.interface.user into u_requester.
[1602683493] wproc: stdout line 16: Inserting LX140Y into cmdb_ci.
[1602683493] wproc: stdout line 17: Inserting inf.nagio.interface.user into opened_by.
[1602683493] wproc: stdout line 18: Inserting LXS-ITO-Service-Desk into u_incident_owner_group.
[1602683493] wproc: stdout line 19: Inserting software into subcategory.
[1602683493] wproc: stdout line 20: Inserting inf.nagio.interface.user into caller_id.
[1602683493] wproc: stdout line 21: Inserting Monitoring into business_service.
[1602683493] wproc: stdout line 22: Inserting LXS-ITO-Service-Desk into assignment_group.
[1602683493] wproc: stdout line 23: Inserting Create into u_processing_type.
[1602683493] wproc: stdout line 24: Inserting failure into category.

Re: Nagios integration with Service-now

Posted: Wed Oct 14, 2020 9:42 am
by tgriep
The error on line 301 is when the perl script is trying to connect to the Service Now site and the URL data is not formatted correctly.
The data in the URL is formatted by the field_map.ini file so make sure that is setup.

Here are some instructions on setting up the mapings.

Optionally you can use the default field_map.ini settings but in the likely case you need to customize it do one of the following:

If you are familiar with the service-now page field formats then read the Field mapping section below, then open the field_map.ini and begin mapping. OR 9a. If you are NOT familiar with the service-now page field formats then create a backup copy of field_map.ini 9b. Open field_map.ini and remove all the default [incident.do] configuration settings, save and exit. 9c. Run the map builder: ./sn_ticketer.pl --page='incident.do' --buildmap 9d. Open the field_map.ini, if everything went well it should now contain all of the available fields for creating incidents. 9e. Remove all of the fields you don't need and read the Field mapping section below to learn more about configuration.

You should go through the README.md file in the folder where the perl script resides for more details on the field_map.ini file.

If you have to go through a proxy server to access the internet, make sure that is setup in the config.ini.

Re: Nagios integration with Service-now

Posted: Wed Oct 14, 2020 12:13 pm
by Beena_Jogin
When i perform the default incident.do using script getting same error Bad request

[root@ libexec]# ./sn_ticketer.pl --page='incident.do' --buildmap
Cleaning up archived DB entries older than TTL
Config loaded.
Connecting to: https://inf.nagio.interface.user:InfyAu ... nt.do?WSDL
Connection to Service-Now Failed: 400 Bad Request
[root@LAZURMOAP1VD libexec]#

Log output :-

****************************************
14/10/2020 16:35:36 Cleaning up archived DB entries older than TTL
14/10/2020 16:35:36 Config loaded.
14/10/2020 16:35:36 Connecting to: https://inf.nagio.interface.user:InfyAu ... nt.do?WSDL
14/10/2020 16:35:36 Connection to Service-Now Failed: 400 Bad Request

****************************************
14/10/2020 16:36:0 Cleaning up archived DB entries older than TTL
14/10/2020 16:36:0 Config loaded.
14/10/2020 16:36:0 Connecting to: https://inf.nagio.interface.user:InfyAu ... nt.do?WSDL
14/10/2020 16:36:1 Connection to Service-Now Failed: 400 Bad Request
========================================================================

Re: Nagios integration with Service-now

Posted: Thu Oct 15, 2020 8:29 am
by Beena_Jogin
when i followed below steps default incident and after running the ./sn_ticketer.pl --page="incident.do" --buildmap and getting below output and field_map.ini flie contain nothing in page expect comments

[root@ test-Servicenow]# ./sn_ticketer.pl --page='incident.do' --buildmap
Cleaning up archived DB entries older than TTL
Config loaded.
Connecting to: https://inf.nagio.interface.user:InfyAu ... nt.do?WSDL
Connection to Service-Now Failed: 400 Bad Request

[root@ test-Servicenow]# cat field_map.ini
;
; The INI Heading is the page to edit and the fields to enter data into are the options for that heading.
; The following special characters are evaluated in the order listed, they must not contain spaces!
; $WORD$ is a substitution option to be specified as an argument
; &EXPRESSION& should be mathematical expression that will be evaluated.
; %PAGE:FIELD:WORD% Using this will lookup the object ID of another service-now entry.
; ^ Fields prefixed with this symbol will be updated
; @ Arguments of fields prefixed with ^ and this symbol will be appended instead of being overwritten.
; WHITESPACE BETWEEN META CHARACTERS IS NOT ALLOWED.

[root@ test-Servicenow]#



When mention the [incident.do] in field_map.ini, then getting below error msg

[root@ libexec]# ./sn_ticketer.pl --page="incident.do" --buildmap
Cleaning up archived DB entries older than TTL
Config loaded.
Page mapping already exists in field map config, stopping import.

[root@ libexec]# cat field_map.ini
;
; The INI Heading is the page to edit and the fields to enter data into are the options for that heading.
; The following special characters are evaluated in the order listed, they must not contain spaces!
; $WORD$ is a substitution option to be specified as an argument
; &EXPRESSION& should be mathematical expression that will be evaluated.
; %PAGE:FIELD:WORD% Using this will lookup the object ID of another service-now entry.
; ^ Fields prefixed with this symbol will be updated
; @ Arguments of fields prefixed with ^ and this symbol will be appended instead of being overwritten.
; WHITESPACE BETWEEN META CHARACTERS IS NOT ALLOWED.
[incident.do]

[root@ libexec]#


where i can see the mapping imported mapping fields ?

Re: Nagios integration with Service-now

Posted: Thu Oct 15, 2020 12:41 pm
by ssax
Please attach this file:

Code: Select all

/usr/local/nagios/libexec/sn_ticketer.pl
Please PM me a copy of your profile, you can download it from Admin > System Profile by clicking the Download Profile button.

Thank you!

Re: Nagios integration with Service-now

Posted: Thu Oct 15, 2020 1:02 pm
by Beena_Jogin
I have attached the script

Thank you

Raghavendra

Re: Nagios integration with Service-now

Posted: Thu Oct 15, 2020 2:24 pm
by ssax
That's the latest so you should be fine.

Please attach (or PM) your /usr/local/nagios/libexec/config.ini. You can sanitize the user/password but leave any special characters in them that you have in them so I can see if those have issues.

Re: Nagios integration with Service-now

Posted: Thu Oct 15, 2020 11:14 pm
by Beena_Jogin
I have shared the config file

Re: Nagios integration with Service-now

Posted: Fri Oct 16, 2020 10:46 am
by ssax
Check your PMs, I just sent a reply, I think it has to do with special characters in the password with a basic auth URL:

https://stackoverflow.com/questions/671 ... -auth-urls