Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


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

...

Status
colourGreen
titleLAST TESTED ON CHECKMK 2.3.0P1


Panel
borderColorblack
bgColor#f8f8f8
titleTable of Contents

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

    Code Block
    languagebash
    themeRDark
    OMD[

...

  1. mysite]:~$ cp ~/lib/python3/cmk/cee/notification_plugins/servicenow.py ~/local/share/check_mk/notifications/


    .
  2. make the script executable

    Code Block
    languagebash
    themeRDark
    OMD[

...

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

    .

  2. Inside the script, you need to change

...



  1. The 3rd line to

...

  1. the name of your script. This name will be displayed in the Notification rules

    Code Block
    languagebash
    themeRDark
    3 # Notification script name
    4 # Bulk: no


    .

...

  1. At the end of the notification script, we need to add:

    Code Block
    languagebash
    themeRDark
    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

...

  1. a

...

  1. folder

...

  1. inside

...

  1. the

...

  1. local

...

  1. Python structure.

    Code Block
    languagebash
    themeRDark
    OMD[mysite]:~$ cd ~/local/lib/python3/cmk
    OMD[

...

  1. mysite]:~/local/lib/python3/cmk$ mkdir notifications_custom

...

  1. .

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

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

...

  1. .

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

    Code Block
    languagebash
    themeRDark
    OMD[mysite]:~$ cp ~/share/check_mk/notifications/servicenow ~/local/share/check_mk/notifications/

...

  1. .

  2. Now let's change some values.

    Code Block
    languagebash
    themeRDark
     OMD[mysite]:~$ vi ~/local/share/check_mk/notifications/servicenow  

...

  1. .

  2. Change 

    Code Block
    languagebash
    themeRDark
    # Servicenow (Enterprise only)
    

...

  1. to

...

  1.  

...

  1. 
    # Servicenow Custom (Enterprise only)
    
    and the import directory to the local structure

...

  1. 
    
    

...

  1. from cmk.cee.notification_plugins import servicenow
    

...

  1. to

...

  1.   

...

  1. 
    

...

  1. from cmk.

...

  1. notifications_custom import servicenow 

...



Note

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

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


Filter by label (Content by label)
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = in ( "notifications" , "notification" ) and type = "page" and space = "KB"
labelsnotifications

...