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 15 Next »

In this manual, we will describe how to make a local copy of a built-in notification script. 

LAST TESTED ON CHECKMK 2.1.0P1

Table of Contents

Getting Started

Background information regarding this subject is available on our:

Quick and dirty way

  1. Copy the notification plugin to the local directory

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

    OMD[mysite]:~/local/share/check_mk/notifications$ chmod +x ~/local/share/check_mk/notifications/servicenow.py

    .

  3. Inside the script, you need to change

    The 3rd line to the name of your script. This name will be displayed in the Notification rules

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

    print("outside: about to check for __main__ == %s" % __name__)
    if __name__ == "__main__":
         print("outside: about to call main()")    
         sys.exit(main())

The common way for Python developers


This way is more efficient and recommended for Python developers

  1. Create a folder inside the local Python structure.

    OMD[mysite]:~$ cd ~/local/lib/python3/cmk
    OMD[mysite]:~/local/lib/python3/cmk$ mkdir notifications_custom

    .

  2. Copy the notification script from the Python structure to the local Python structure.

    OMD[mysite]:~$ cp ~/lib/python3/cmk/cee/notification_plugins/servicenow.py ~/local/lib/python3/cmk/notifications_custom/

    .

  3. Copy the notification script from the notification path to the local notification path.

    OMD[mysite]:~$ cp ~/share/check_mk/notifications/servicenow ~/local/share/check_mk/notifications/

    .

  4. Now let's change some values.

     OMD[mysite]:~$ vi ~/local/share/check_mk/notifications/servicenow  

    .

  5. Change 

    # Servicenow (Enterprise only)
    to 
    # Servicenow Custom (Enterprise only)
    
    and the import directory to the local structure
    
    from cmk.cee.notification_plugins import servicenow
    to  
    from cmk.cee.notifications_custom import servicenow 


Per default, all notification 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