I tried putting the code into into
/opt/omd/versions/2.0.0p18.cee/lib/python3/cmk/notification_plugins/opsgenie_issues.py
and it didn’t seem to work. See below.
def main() -> int:
context = utils.collect_context()
if 'PARAMETER_PASSWORD' not in context:
sys.stderr.write("API key not set\n")
return 2
# testing hosttags
host_tags = context['HOSTTAGS']
for (var, value) in context.items():
if var.startswith("HOSTLABEL_"):
host_tags += " " + var[10:] + ":" + value
context['HOSTTAGS'] = host_tags
# end testing hosttags
api_key = retrieve_from_passwordstore(context['PARAMETER_PASSWORD'])
I know at least 4 HOSTLABEL_* made it into the ticket as I pass them as fields in the ticket description:
Description
Host:
Service: Fans Chassis 1
Event:
Output: Manually set to Critical by
I had a colleague of mine look at it and he came up with this. (and it works for us now by changing the /omd/sites/####/lib/check_mk/notification_plugins/opsgenie_issues.py file that comes standard with Check_MK)
You shouldn’t directly change files below ~/lib since this is just a symlink (or chain of symlinks) to /opt/omd/versions/x.y.z/lib so your changes will no longer be active once a new version gets installed. Instead, place a copy of the file in ~/local/lib/... and modify that file instead.
Where is the original file located? I’m not using opsgenie myself, but I can find the “opsgenie_issues.py” only below .../lib/python3/cmk/notification_plugins/.
So your modified file should probably be placed in ~/local/lib/python3/cmk/notification_plugins/, not ~/local/lib/check_mk/...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.