Host Maintenance With Start Time and End Time

Got it all working! I had a couple of misplaced items and typos in my script, causing the errors, but it’s working now! Here some details in case someone else needs it out there:

I created custom variables in main.mk like this:

extra_host_conf["_HOSTDOWNTIMESTART"] = [
( "Blah", ALL_HOSTS),]
 
extra_host_conf["_HOSTDOWNTIMEEND"] = [
( "Blah", ALL_HOSTS),]

Then added the new custom variables in check_mk_templates.cfg like this:

NOTIFY_HOST_HOSTDOWNTIMESTART=‘$_HOSTDOWNTIMESTART$’
NOTIFY_HOST_HOSTDOWNTIMEEND=‘$_HOSTDOWNTIMEEND$’
check_mk --notify

And at the end of my custom notification script ( checkmk2maint, which also extracts the needed data from the CMK downtimes view page) there is the ASCII-format-body mail-out command, to make it simple for the automation process like this:

/usr/bin/printf “%b” “@@@ CMK Maintenance @@@ \n\nHOSTNAME=====$NOTIFY_HOSTNAME\nNOTIFICATION_TYPE=====$NOTIFY_NOTIFICATIONTYPE\nDOWNTIME_START=====$NOTIFY_HOST_HOSTDOWNTIMESTART\nDOWNTIME_END=====$NOTIFY_HOST_HOSTDOWNTIMEEND\n” | /bin/mail -s “** $NOTIFY_NOTIFICATIONTYPE Host Alert: $NOTIFY_HOSTNAME While Current Status=$NOTIFY_HOSTSTATE **” $NOTIFY_CONTACTEMAIL

Email sample below:

@@@ CMK Maintenance @@@

HOSTNAME=====SERVER
NOTIFICATION_TYPE=====(DOWNTIMESTART, DOWNTIMEEND or DOWNTIMECANCELLED)
DOWNTIME_START=====Start_Time
DOWNTIME_END=====End_Time