Hi, i have created a python custom notification script to create tickets on BMC via REST API, so the usecase is that when host state changes from up to down or unreachable, it should create a ticket on BMC!
I tried running it on CLI as follows, and it works (created ticket), but when i tried using testing it from checkmk GUI via test notification, it doesnot works (not creating tikcet), what could be the reason? is this the bug in Checkmk, or i am missing something? Also, could anyone guide me how i can use and create my own env variables in my python script for this? i want to ceate a parameter “host_group” in checkmk and want to access it in my script!
If you put your hosts in host groups, then that membership is automatically reflected in the environment variable NOTIFY_HOSTGROUPNAMES. You don’t need to do anything for that.
For example, I put a host into the two groups grp_1 and grp_2:
… and the notification script is then automatically called with the following variable:
NOTIFY_HOSTGROUPNAMES=grp_2,grp_1
I suggest you first use this simple script as a notification script to see what variables are automatically set by checkmk. There are about 100 variables and they all start with NOTIFY_
As to why your script doesn’t get called is hard to tell without knowing how you configured the notification process.
Again, I would suggest you first try the environment printer script from above and configure a notification rule for one specific contact and without further conditions: