Code Monkey home page Code Monkey logo

zabbix-script-servicenow's Introduction

ServiceNow tickets from Zabbix

Python script for custom Zabbix script media. Script uses ServiceNow API.

[Paypal donate button] (https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8LB6J222WRUZ4)

Installation

Copy the zabbix-create-service-now-incident.py script into the AlertScriptsPath directory which is by default /usr/lib/zabbix/alertscripts and make it executable:

$ cd /usr/lib/zabbix/alertscripts
$ wget https://raw.github.com/monitoringartist/zabbix-script-servicenow/master/zabbix-create-service-now-incident.py 
$ chmod 755 zabbix-create-service-now-incident.py

Configuration

To forward Zabbix events to ServiceNow a new media script needs to be created and associated with a user. Follow the steps below as a Zabbix Admin user:

1.) Create a new media type [Admininstration > Media Types > Create Media Type]

Name: ServiceNow API
Type: Script
Script name: zabbix-create-service-now-incident.py

2.) Modify the Media for the Admin user [Administration > Users]

Type: ServiceNow API
Send to: string               <--- this string is not used
When active: 1-7,00:00-24:00
Use if severity: (all)
Status: Enabled

3.) Configure Action [Configuration > Actions > Create Action > Action] Event source: Triggers

Name: Create ServiceNow ticket
Default Subject: {TRIGGER.STATUS}

Default Message:
Trigger: {TRIGGER.NAME}
Trigger description: {TRIGGER.DESCRIPTION} 
Trigger severity: {TRIGGER.SEVERITY}
Trigger nseverity: {TRIGGER.NSEVERITY}
Trigger status: {TRIGGER.STATUS}
Trigger URL: {TRIGGER.URL}
Host: {HOST.HOST}
Host description: {HOST.DESCRIPTION}
Event age: {EVENT.AGE}
Current Zabbix time: {DATE} {TIME} 

Item values:

1. {ITEM.NAME1} ({HOST.NAME1}:{ITEM.KEY1}): {ITEM.VALUE1}
2. {ITEM.NAME2} ({HOST.NAME2}:{ITEM.KEY2}): {ITEM.VALUE2}
3. {ITEM.NAME3} ({HOST.NAME3}:{ITEM.KEY3}): {ITEM.VALUE3}

Zabbix event ID: {EVENT.ID}
Zabbix web UI: https://zabbix.domain.com/zabbix

For a full list of trigger macros see https://www.zabbix.com/documentation/2.4/manual/appendix/macros/supported_by_location

At the Conditions tab, to only forward PROBLEM events:

(A)	Maintenance status not in "maintenance" 
(B)	Trigger value = "PROBLEM" 

Finally, add an operation:

Send to Users: Admin
Send only to: ServiceNow API

Troubleshooting

Set debug to 1 in the script for debug output:

debug = 1

And test script in commandline manually. It is very likely, that your ServiceNow instance has different settings (mandatory fields, lists, ...). You should to see in server response, what is a problem.

Author

Devops Monitoring zExpert, who loves monitoring systems, which start with letter Z. Those are Zabbix and Zenoss.

Professional monitoring services:

[Monitoring Artist] (http://www.monitoringartist.com)

zabbix-script-servicenow's People

Contributors

jangaraj avatar

Watchers

James Cloos avatar vivek kumar guta avatar

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.