我在Centos7中使用Pacemaker + Corosync,我创建了自己的资源代理并创建了一个自定义资源来运行我的一些脚本。
在我的资源代理中我有监视功能,每隔x分钟检查一次,当这个监视功能失败时,我返回" OCF_ERR_GENERIC"因此所有的reosurce都失败了。
当我执行命令" PCS status"我可以看到资源已停止/失败,并且还可以在失败的操作中看到有关失败的消息"未知错误":
[root@pcmk01 opt]# pcs status
Cluster name: opt_cluster
Stack: corosync
Current DC: pcmk02-cr (version 1.1.15-11.el7_3.2-e174ec8) - partition with quorum
Last updated: Mon Jan 30 10:21:36 2017 Last change: Mon Jan 30 10:15:46 2017 by hacluster via crmd on pcmk02-cr
2 nodes and 5 resources configured
Online: [ pcmk01-cr pcmk02-cr ]
Full list of resources:
Master/Slave Set: myoptClone01 [myopt_data01]
Masters: [ pcmk01-cr ]
Slaves: [ pcmk02-cr ]
myopt_fs01 (ocf::heartbeat:Filesystem): Started pcmk01-cr
myopt_VIP01 (ocf::heartbeat:IPaddr2): Started pcmk01-cr
ServicesResource (ocf::heartbeat:RADviewServices): Stopped
Failed Actions:
* ServicesResource_monitor_120000 on pcmk02-cr **'unknown error'** (1): call=141, status=complete, exitreason='none',
last-rc-change='Mon Jan 30 10:19:36 2017', queued=0ms, exec=142ms
有没有办法插入我自己的错误信息而不是这个"未知错误"消息???
答案 0 :(得分:2)
我不相信无论如何都会在crm_mon
或pcs status
的输出中出现更具描述性的错误。但是,这些输出中的错误确实为失败提供了时间戳。在自定义资源代理中,您可以在错误期间向日志输出任何内容。然后,您可以检查pcs status
输出中显示的时间戳周围的日志,以获得有关故障的更准确信息。