Hi,
I am trying to test host hook on Opennebula version 5.9 , running on Ubuntu 18.04 hosts.
I have disabled fencing on host error hook script, but getting below error on host failure.
oned.log
Mon Nov 18 11:51:45 2019 [Z0][InM][I]: ssh: connect to host 192.168.25.15 port 22: No route to host
Mon Nov 18 11:51:45 2019 [Z0][ONE][E]: Error monitoring Host 192.168.25.15 (5): -
Mon Nov 18 11:51:46 2019 [Z0][ReM][D]: Req:80 UID:0 IP:127.0.0.1 one.system.config invoked
Mon Nov 18 11:51:46 2019 [Z0][ReM][D]: Req:80 UID:0 one.system.config result SUCCESS, "<TEMPLATE><API_LIST_..."
Mon Nov 18 11:51:46 2019 [Z0][ReM][D]: Req:2624 UID:0 IP:127.0.0.1 one.host.info invoked , 0, false
Mon Nov 18 11:51:46 2019 [Z0][ReM][E]: Req:2624 UID:0 one.host.info result FAILURE [one.host.info] Error getting host [0].
Mon Nov 18 11:51:46 2019 [Z0][HKM][D]: Message received: EXECUTE FAILURE 1 255 PEFSR1VNRU5UUz4kSUQgLW0gLXAgNSAtdSA8L0FSR1VNRU5UUz48RVhFQ1VUSU9OX1JFU1VMVD48Q09NTUFORD4vdmFyL2xpYi9vbmUvcmVtb3Rlcy9ob29rcy9mdC9ob3N0X2Vycm9yLnJiICRJRCAtbSAtcCA1IC11IDwvQ09NTUFORD48U1RET1VUPjwvU1RET1VUPjxTVERFUlI+PC9TVERFUlI+PENPREU+MjU1PC9DT0RFPjwvRVhFQ1VUSU9OX1JFU1VMVD4=
Mon Nov 18 11:51:46 2019 [Z0][HKM][E]: Error executing Hook 1
Mon Nov 18 11:52:04 2019 [Z0][InM][D]: Host 192.168.25.16 (6) successfully monitored.
Mon Nov 18 11:52:04 2019 [Z0][VMM][D]: VM 38 successfully monitored: STATE=a CPU=8.09 MEMORY=2373740 NETRX=93092930 NETTX=3493803 DISKRDBYTES=661555624 DISKWRBYTES=3745862656 DISKRDIOPS=34981 DISKWRIOPS=17760
Mon Nov 18 11:52:04 2019 [Z0][VMM][D]: VM 40 successfully monitored: STATE=a CPU=11.13 MEMORY=579972 NETRX=15935141 NETTX=415854 DISKRDBYTES=1569249624 DISKWRBYTES=797000704 DISKRDIOPS=33583 DISKWRIOPS=7342
Mon Nov 18 11:52:12 2019 [Z0][ReM][D]: Req:6560 UID:0 IP:127.0.0.1 one.zone.raftstatus invoked
Mon Nov 18 11:52:12 2019 [Z0][ReM][D]: Req:6560 UID:0 one.zone.raftstatus result SUCCESS, "<RAFT><SERVER_ID>-1<..."
Mon Nov 18 11:52:12 2019 [Z0][ReM][D]: Req:880 UID:0 IP:127.0.0.1 one.vmpool.infoextended invoked , -2, -1, -1, -1
host_error.log
tail -f /var/log/one/host_error.log
[2019-11-14 15:56:33 +0800][HOST 5][I] Exiting. Host came back after waiting.
[2019-11-14 16:01:32 +0800][HOST ][I] Hook launched
[2019-11-14 16:01:32 +0800][HOST ][E] Could not get host info
[2019-11-14 16:01:32 +0800][HOST ][E] Exiting due to previous error.
[2019-11-14 16:57:06 +0800][HOST ][I] Hook launched
[2019-11-14 16:57:06 +0800][HOST ][E] Could not get host info
[2019-11-14 16:57:06 +0800][HOST ][E] Exiting due to previous error.
[2019-11-18 11:51:46 +0800][HOST ][I] Hook launched
[2019-11-18 11:51:46 +0800][HOST ][E] Could not get host info
[2019-11-18 11:51:46 +0800][HOST ][E] Exiting due to previous error.
onehook output
HOOK 1 INFORMATION
ID : 1
NAME : host_error
TYPE : state
LOCK : None
HOOK TEMPLATE
ARGUMENTS="$ID -m -p 5 -u"
COMMAND="ft/host_error.rb"
REMOTE="NO"
RESOURCE="HOST"
STATE="ERROR"
EXECUTION LOG
ID TIMESTAMP RC EXECUTION
0 11/14 16:01 255 ERROR
1 11/14 16:57 255 ERROR
2 11/18 11:51 255 ERROR
I have disabled the fencing and changed the $TEMPLATE to $ID, since I was using $ID on previous version of openenbula
cat /usr/share/one/examples/host_hooks/error_hook
ARGUMENTS = "$ID -m -p 5 -u"
COMMAND = "ft/host_error.rb"
NAME = "host_error"
STATE = "ERROR"
REMOTE = "no"
RESOURCE = HOST
TYPE = state