Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

In this manual we will describe how to make a local copy of a built-in notification script. There are two ways:

Quick and dirty way 

  1. Copy the notification plugin to the local directory

    OMD[at]:~$ cp ~/lib/python3/cmk/cee/notification_plugins/servicenow.py ~/local/share/check_mk/notifications/
  2. make the script executable

    OMD[at]:~/local/share/check_mk/notifications$ chmod +x ~/local/share/check_mk/notifications/servicenow.py
  3. Inside the script, you need to change:
    1. The 3rd line to a name of your script. This name will be displayed in the Notification rules

      3 # Notification script name
      4 # Bulk: no
    2. at the end of the notification script, we need to add:

      if __name__ == "__main__":
          sys.exit(main())



Common way for python developers

This way is more efficient and recommended for python developers

# Create a folder inside the local python structure
OMD[at]:~$ cd ~/local/lib/python3/cmk
OMD[at]:~/local/lib/python3/cmk$ mkdir notifications_custom

# Copy the notification script from the python structure to the local python structure
OMD[at]:~$ cp ~/lib/python3/cmk/cee/notification_plugins/servicenow.py ~/local/lib/python3/cmk/notifications_custom/

# Copy the notification script from the notification path to the local notification path
OMD[at]:~$ cp ~/share/check_mk/notifications/servicenow ~/local/share/check_mk/notifications/

# Now lets change some values
OMD[at]:~$ vi ~/local/share/check_mk/notifications/servicenow 

Change 

 3 # Servicenow (Enterprise only)

to 

 3 # Servicenow Custom (Enterprise only)

and the import directory to the local structure

13     from cmk.cee.notification_plugins import servicenow

to  

13  from cmk.cee.notifications_custom import servicenow


Per default all notifications scripts are inside ~/lib/python3/cmk/notification_plugins/.

As servicenow is only available with the enterprise edition, you will find the script here: ~/lib/python3/cmk/cee/notification_plugins/


  • No labels