Fix missing OCF logging

W/o this patch, the most of the OCF agents
sending their own logs to nothere.

This is a major issue, because we want to
be able troubleshoot and keep OCF events
in syslog and collected at remote logs
server(s) as well.

The solution is to enable HA_LOGTAG and
HA_LOGFACILITY for each OCF script shipped
with the Fuel.

DocImpact: Ops guide. Logging events from
Fuel OCF agents will be collected both
locally in the /var/log/daemon.log and remotely,
with the file names based on the agent "foo-agent"
name as the "ocf-foo-agent.log". Note, that the
RabbitMQ will continue to log its OCF events
to the lrmd.log due to backwards compatibility reasons.

Closes-bug: #1487083
Change-Id: Ida2d5fe31de42d31131e0f3a3e7b1a771caf8dfd
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2015-08-20 17:31:53 +02:00
parent ed5e1b1a63
commit 6d90814c56
19 changed files with 40 additions and 3 deletions

View File

@ -38,6 +38,8 @@ OCF_RESKEY_user_default="ceilometer"
OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
OCF_RESKEY_amqp_server_port_default="5673"
: ${HA_LOGTAG="ocf-ceilometer-agent-central"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}

View File

@ -38,6 +38,8 @@ OCF_RESKEY_user_default="ceilometer"
OCF_RESKEY_pid_default="$HA_RSCTMP/$OCF_RESOURCE_INSTANCE.pid"
OCF_RESKEY_amqp_server_port_default="5673"
: ${HA_LOGTAG="ocf-ceilometer-agent-compute"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}

View File

@ -36,6 +36,8 @@ OCF_RESKEY_config_default="/etc/ceilometer/ceilometer.conf"
OCF_RESKEY_user_default="ceilometer"
OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
: ${HA_LOGTAG="ocf-ceilometer-alarm-evaluator"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}

View File

@ -30,6 +30,8 @@ OCF_RESKEY_conffile_default="/etc/haproxy/haproxy.cfg"
OCF_RESKEY_pidfile_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
OCF_RESKEY_binpath_default="/usr/sbin/haproxy"
: ${HA_LOGTAG="ocf-haproxy"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_conffile=${OCF_RESKEY_conffile_default}}
: ${OCF_RESKEY_pidfile=${OCF_RESKEY_pidfile_default}}
: ${OCF_RESKEY_binpath=${OCF_RESKEY_binpath_default}}
@ -164,7 +166,7 @@ haproxy_start()
fi
# run the haproxy binary
"${COMMAND}" ${OCF_RESKEY_extraconf} -f "${CONF_FILE}" -p "${PIDFILE}"
"${COMMAND}" ${OCF_RESKEY_extraconf} -f "${CONF_FILE}" -p "${PIDFILE}"
if [ $? -ne 0 ]; then
ocf_log err "Error. haproxy daemon returned error $?."
exit $OCF_ERR_GENERIC

View File

@ -37,6 +37,8 @@ OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
OCF_RESKEY_amqp_server_port_default="5673"
OCF_RESKEY_user_default="heat"
: ${HA_LOGTAG="ocf-heat_engine"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}

View File

@ -37,6 +37,8 @@ OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
OCF_RESKEY_amqp_server_port_default="5673"
OCF_RESKEY_user_default="heat"
: ${HA_LOGTAG="ocf-heat_engine"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}

View File

@ -35,6 +35,8 @@ OCF_RESKEY_test_passwd_default=""
OCF_RESKEY_additional_parameters_default=""
OCF_RESKEY_master_timeout_default="300"
: ${HA_LOGTAG="ocf-mysql-wss"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
MYSQL_BINDIR="$(dirname ${OCF_RESKEY_binary})"

View File

@ -40,6 +40,8 @@ OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
OCF_RESKEY_amqp_server_port_default="5672"
OCF_RESKEY_zeromq_default="false"
: ${HA_LOGTAG="ocf-nova-compute"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}

View File

@ -49,6 +49,8 @@ OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
OCF_RESKEY_amqp_server_port_default="5672"
OCF_RESKEY_zeromq_default="false"
: ${HA_LOGTAG="ocf-nova-network"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}

View File

@ -19,6 +19,8 @@ OCF_RESKEY_enable_forwarding_default=true
OCF_RESKEY_other_networks_default=""
OCF_RESKEY_bridge_default="" # can be "", or bridge name
: ${HA_LOGTAG="ocf-ns_IPaddr2"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_cidr_netmask=${OCF_RESKEY_cidr_netmask_default}}
: ${OCF_RESKEY_ns=${OCF_RESKEY_ns_default}}
: ${OCF_RESKEY_base_veth=${OCF_RESKEY_base_veth_default}}

View File

@ -43,6 +43,8 @@ OCF_RESKEY_bridge_default=br-mgmt
OCF_RESKEY_host_interface_default=mgmt-conntrd
OCF_RESKEY_ns_interface_default=conntrd
: ${HA_LOGTAG="ocf-ns_conntrackd"}
: ${HA_LOGFACILITY="daemon"}
# For users of versions prior to 1.2:
# Map renamed parameter "conntrackd" to "binary" if in use
: ${OCF_RESKEY_binary=${OCF_RESKEY_conntrackd-${OCF_RESKEY_binary_default}}}

View File

@ -35,6 +35,8 @@ OCF_RESKEY_binpath_default="/usr/sbin/dnsmasq"
OCF_RESKEY_extraconf_default=""
: ${OCF_ROOT=${OCF_ROOT_default}}
: ${HA_LOGTAG="ocf-ns_dns"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_ns=${OCF_RESKEY_ns_default}}
: ${OCF_RESKEY_conffile=${OCF_RESKEY_conffile_default}}

View File

@ -51,6 +51,8 @@ OCF_RESKEY_route_metric_default="10000"
OCF_RESKEY_debug_default=false
: ${OCF_ROOT=${OCF_ROOT_default}}
: ${HA_LOGTAG="ocf-ns_haproxy"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_ns=${OCF_RESKEY_ns_default}}
: ${OCF_RESKEY_conffile=${OCF_RESKEY_conffile_default}}
@ -316,7 +318,7 @@ set_ns_routing() {
fi
# up the ns part
ocf_log debug "Bringing up the namespace interface: ${OCF_RESKEY_namespace_interface}"
ocf_log debug "Bringing up the namespace interface: ${OCF_RESKEY_namespace_interface}"
ocf_run nsip link set "${OCF_RESKEY_namespace_interface}" up
# set ns part's ip

View File

@ -35,6 +35,8 @@ OCF_RESKEY_binpath_default="/usr/sbin/ntpd"
OCF_RESKEY_extraconf_default=""
: ${OCF_ROOT=${OCF_ROOT_default}}
: ${HA_LOGTAG="ocf-ns_ntp"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_ns=${OCF_RESKEY_ns_default}}
: ${OCF_RESKEY_conffile=${OCF_RESKEY_conffile_default}}

View File

@ -40,6 +40,8 @@ OCF_RESKEY_network_mask_default="30"
OCF_RESKEY_route_metric_default="10000"
: ${OCF_ROOT=${OCF_ROOT_default}}
: ${HA_LOGTAG="ocf-ns_vrouter"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_ns=${OCF_RESKEY_ns_default}}
: ${OCF_RESKEY_other_networks=${OCF_RESKEY_other_networks_default}}

View File

@ -45,7 +45,8 @@ OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
OCF_RESKEY_remove_artifacts_on_stop_start_default='true'
OCF_RESKEY_debug_default='false'
: ${HA_LOGTAG="ocf-neutron-dhcp-agent"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_plugin_config=${OCF_RESKEY_plugin_config_default}}

View File

@ -46,6 +46,8 @@ OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
OCF_RESKEY_external_bridge_default="br-ex"
OCF_RESKEY_debug_default=false
: ${HA_LOGTAG="ocf-neutron-l3-agent"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_plugin_config=${OCF_RESKEY_plugin_config_default}}

View File

@ -34,6 +34,8 @@ OCF_RESKEY_user_default="neutron"
OCF_RESKEY_pid_default="${HA_RSCTMP}/${__SCRIPT_NAME}/${__SCRIPT_NAME}.pid"
OCF_RESKEY_debug_default="false"
: ${HA_LOGTAG="ocf-neutron-metadata-agent"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_agent_config=${OCF_RESKEY_agent_config_default}}

View File

@ -40,6 +40,8 @@ OCF_RESKEY_segmentation_bridge_default="br-tun"
OCF_RESKEY_log_file_default="/var/log/neutron/openvswitch-agent.log"
OCF_RESKEY_debug_default='false'
: ${HA_LOGTAG="ocf-neutron-ovs-agent"}
: ${HA_LOGFACILITY="daemon"}
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
: ${OCF_RESKEY_plugin_config=${OCF_RESKEY_plugin_config_default}}