View file File name : check_a2_omni_pxe_https_check.sh Content :#!/bin/bash # # Jira: SYSENG-24777 # # A script with a basic HTTPS check that runs on omni server and checks each of the PXE servers if they're working properly # _pxe_servers="omni-pxe-sf omni-pxe-az omni-pxe-nl omni-pxe-sg" icinga_out="/tmp/pxe_check_out.txt" for _pxe in ${_pxe_servers}; do _output=$(curl --connect-timeout 5 --max-time 5 -sX POST https://"${_pxe}".a2hosting.com/create -H 'Content-Type: application/json' -d '{"filename": "xx-xx-xx-xx-xx-xx", "uri": "http://mirror.a2hosting.com", "kernel": "/almalinux8/vmlinuz", "initrd": "/almalinux8/initrd.img", "method": "/almalinux/8/BaseOS/x86_64/kickstart/", "ks": "https://omni-prov.a2hosting.com//almalinux8/bmd/man.ks", "pxetemplate": "TEMPLATE", "token": "token-token-token-token", "host_id": "9999", "omni_host": "omni.a2hosting.com"}' | jq -r .success) if [[ "${_output}" == 1 ]]; then echo "${_pxe} - PXE server (HTTPS) is working properly" else echo "${_pxe} - PXE server (HTTPS) is NOT working!" fi done > ${icinga_out} if grep -q "NOT working" ${icinga_out}; then echo "check_a2_omni_pxe_https_check - $(grep "NOT working" ${icinga_out} | sed ':a;N;$!ba;s/\n/ | /g')" exit 2 else echo "check_a2_omni_pxe_https_check - $(grep "is working" ${icinga_out} | sed ':a;N;$!ba;s/\n/ | /g')" exit 0 fi