Dave Ford
2018-11-12 13:30:45 UTC
Hi - I've having tremendous trouble trying to automate some actions in
CheckMK.
I've most achieved what I want to do - that is, to schedule downtime
for a host depending on the result of a local checkMK check.
The problem I'm having is to check if the scheduled downtime has
already been scheduled for a host. I was trying to use the
'downtimes_of_host' view, but it doesn't work properly because of the
mixed date view is changing from a proper date to '12 hrs' or similar.
While I can set the date format to absolute in the gui manually, I
can't work out how to do this with curl.
Can someone advise on this - otherwise, I'll have to give up entirely
on automation if I can't get check_mk to output dates in machine-
readable format.
The code I'm using to view the downtime for a host is:
curl -s --get \
--data-urlencode output_format=JSON \
--data-urlencode view_name=downtimes_of_host \
--data-urlencode _username=set-downtime \
--data-urlencode _secret=...... \
--data-urlencode _do_actions=yes \
--data-urlencode _do_confirm=yes \
--data-urlencode host="${HOSTNAME}" \
--data-urlencode _transid=-1 \
"https://......./check_mk/view.py"
Thanks
CheckMK.
I've most achieved what I want to do - that is, to schedule downtime
for a host depending on the result of a local checkMK check.
The problem I'm having is to check if the scheduled downtime has
already been scheduled for a host. I was trying to use the
'downtimes_of_host' view, but it doesn't work properly because of the
mixed date view is changing from a proper date to '12 hrs' or similar.
While I can set the date format to absolute in the gui manually, I
can't work out how to do this with curl.
Can someone advise on this - otherwise, I'll have to give up entirely
on automation if I can't get check_mk to output dates in machine-
readable format.
The code I'm using to view the downtime for a host is:
curl -s --get \
--data-urlencode output_format=JSON \
--data-urlencode view_name=downtimes_of_host \
--data-urlencode _username=set-downtime \
--data-urlencode _secret=...... \
--data-urlencode _do_actions=yes \
--data-urlencode _do_confirm=yes \
--data-urlencode host="${HOSTNAME}" \
--data-urlencode _transid=-1 \
"https://......./check_mk/view.py"
Thanks