Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • Madrid
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Event collection using script

Log in to subscribe to topics and get notified when content changes.

Event collection using script

You can create a scripted integration with Event Management to push external events from monitoring tools. You can use the cURL command-line tool to send one or more events to a ServiceNow instance.

Before you begin

For Mac, cURL is automatically available.

For Unix, Linux, or Windows, make sure that the cURL command-line tool is installed. You can download it at http://curl.haxx.se/download.html.

Role required: evt_mgmt_integration

About this task

For scripted integration, no configuration is required. If your monitoring tool is a supported event source, you can instead select a connector and configure an instance to pull events using a MID Server. In either case, the system uses a web service API to add events to the Event [em_event] table, see Event collection to MID Server via web service API.

Procedure

  1. Use a text editor to create a shell (.sh) file with event records.
    curl -v -H "Accept: application/json" -H "Content-Type: application/json" -X POST --data "{
        "records":
        [ {
             \"source\" : \"Simulated\",
            \"node\" : \"nameofnode\",
            \"type\" : \"High Virtual Memory\",
            \"resource\" : \"C:\",
            \"severity\" : \"5\",
            \"description\" : \"Virtual memory usage exceeds 98%\",
            \"ci_type\":\"cmdb_ci_app_server_tomcat\",
           \"additional_info\":\"{\\\"name\\\":\\\"My Airlines\\\"}\"
          },
          {
          \"source\" : \"Simulated\",
          \"node\" : \"01.myairlines.com\",
          \"type\" : \"High CPU Utilization\",
          \"resource\" : \"D:\",
          \"severity\" : \"5\",
          \"description\" : \"CPU on 01.my.com at 60%\"
          }
       ]
    }" -u myUserID:myPassword https://<my-instance>.service-now.com/api/global/em/jsonv2
    
    
  2. Use the -H option. For the POST parameter, start the data block with an open bracket and delimit the data with backslashes. For example:
    POST --data "{\"records\":[{\"source\" :  [. . .]}"
    Table 1. Header parameters for use with -H option
    Parameter Type Description
    Accept String The acceptable type for this message.

    The default value is application/json.

    Content-Type String The content type for this message.

    The default value is application/json.

    POST String The request type is POST with one or more trailing records.
  3. Use the -u option and the instance URL with login credentials. For example:
     -u myUserID:myPassword "https://<my-instance>.service-now.com/api/global/em/jsonv2"
  4. Test the scripted integration.
Feedback