Beispiel #1
0
/* callback function invoked from OpenIPMI */
static void	got_control_setting(ipmi_control_t *control, int err, void *cb_data)
{
	const char		*__function_name = "got_control_setting";
	zbx_ipmi_host_t		*h = cb_data;
	zbx_ipmi_control_t	*c;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);

	if (0 != err)
	{
		zabbix_log(LOG_LEVEL_DEBUG, "%s() fail: %s", __function_name, zbx_strerror(err));

		h->err = zbx_dsprintf(h->err, "error 0x%x while set control", err);
		h->ret = NETWORK_ERROR;
		h->done = 1;
		return;
	}

	c = get_ipmi_control(h, control);

	if (NULL == c)
	{
		THIS_SHOULD_NEVER_HAPPEN;
		h->err = zbx_dsprintf(h->err, "fatal error");
		h->ret = NOTSUPPORTED;
		h->done = 1;
		return;
	}

	zabbix_log(LOG_LEVEL_DEBUG, "set value completed for control %s@[%s]:%d", c->c_name, h->ip, h->port);

	h->done = 1;

	zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s", __function_name, zbx_result_string(h->ret));
}
static void	got_control_reading(ipmi_control_t *control, int err, int *val, void *cb_data)
{
	const char		*__function_name = "got_control_reading";
	zbx_ipmi_host_t		*h = cb_data;
	int			n;
	zbx_ipmi_control_t	*c;
	const char		*e_string;
	ipmi_entity_t		*ent;
	size_t			sz;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);

	if (0 != err)
	{
		zabbix_log(LOG_LEVEL_DEBUG, "%s() fail: %s", __function_name, zbx_strerror(err));

		h->err = zbx_dsprintf(h->err, "error 0x%x while reading control", err);
		h->ret = NETWORK_ERROR;
		h->done = 1;
		goto out;
	}

	c = get_ipmi_control(h, control);

	if (NULL == c)
	{
		THIS_SHOULD_NEVER_HAPPEN;
		h->err = zbx_strdup(h->err, "fatal error");
		h->ret = NOTSUPPORTED;
		h->done = 1;
		goto out;
	}

	if (c->num_values == 0)
	{
		THIS_SHOULD_NEVER_HAPPEN;
		h->err = zbx_strdup(h->err, "no value present for control");
		h->ret = NOTSUPPORTED;
		h->done = 1;
		goto out;
	}

	ent = ipmi_control_get_entity(control);
	e_string = ipmi_entity_get_entity_id_string(ent);

	for (n = 0; n < c->num_values; n++)
	{
		zabbix_log(LOG_LEVEL_DEBUG, "control values [%s | %s | %d:%d]",
				c->c_name, e_string, n + 1, val[n]);
	}

	sz = sizeof(int) * c->num_values;
	memcpy(c->val, val, sz);

	h->done = 1;
out:
	zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s", __function_name, zbx_result_string(h->ret));
}
Beispiel #3
0
static void	got_control_reading(ipmi_control_t *control, int err, int *val, void *cb_data)
{
	zbx_ipmi_host_t		*h = cb_data;
	int			n;
	zbx_ipmi_control_t	*c;
	const char		*c_type, *e_string;
	ipmi_entity_t		*ent;
	size_t			sz;

	zabbix_log(LOG_LEVEL_DEBUG, "In got_control_reading()");

	if (err) {
		h->err = zbx_dsprintf(h->err, "Error 0x%x while read control", err);
		h->ret = NETWORK_ERROR;
		h->done = 1;
		return;
	}

	c = get_ipmi_control(h, control);

	if (NULL == c)
	{
		/* this should never happen */
		h->err = zbx_dsprintf(h->err, "Fatal error");
		h->ret = NOTSUPPORTED;
		h->done = 1;
		return;
	}

	if (c->num_values == 0)
	{
		/* this should never happen */
		h->err = zbx_dsprintf(h->err, "No value present for control");
		h->ret = NOTSUPPORTED;
		h->done = 1;
		return;
	}

	ent = ipmi_control_get_entity(control);
	e_string = ipmi_entity_get_entity_id_string(ent);
	c_type = ipmi_control_get_type_string(control);

	for (n = 0; n < c->num_values; n++)
	{
		zabbix_log(LOG_LEVEL_DEBUG, "Control values [%s | %s | %d:%d]",
				c->c_name, e_string, n + 1, val[n]);
	}

	sz = sizeof(int) * c->num_values;
	memcpy(c->val, val, sz);

	h->done = 1;
}
Beispiel #4
0
static void	control_change(enum ipmi_update_e op, ipmi_entity_t *ent, ipmi_control_t *control, void *cb_data)
{
	zbx_ipmi_host_t *h = cb_data;

	zabbix_log(LOG_LEVEL_DEBUG, "In control_change()");

	if (op == IPMI_ADDED)
	{
		if (NULL == get_ipmi_control(h, control))
			allocate_ipmi_control(h, control);
	}
	else if (op == IPMI_DELETED)
		delete_ipmi_control(h, control);
}
static void	control_change(enum ipmi_update_e op, ipmi_entity_t *ent, ipmi_control_t *control, void *cb_data)
{
	const char	*__function_name = "control_change";
	zbx_ipmi_host_t *h = cb_data;

	zabbix_log(LOG_LEVEL_DEBUG, "In %s() phost:%p host:'[%s]:%d'", __function_name, h, h->ip, h->port);

	if (IPMI_ADDED == op)
	{
		if (NULL == get_ipmi_control(h, control))
			allocate_ipmi_control(h, control);
	}
	else if (IPMI_DELETED == op)
	{
		delete_ipmi_control(h, control);
	}

	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
}
Beispiel #6
0
static void	got_control_setting(ipmi_control_t *control, int err, void *cb_data)
{
	zbx_ipmi_host_t		*h = cb_data;
	zbx_ipmi_control_t	*c;
	const char		*c_type, *e_string;
	ipmi_entity_t		*ent;

	zabbix_log(LOG_LEVEL_DEBUG, "In got_control_setting()");

	if (err) {
		h->err = zbx_dsprintf(h->err, "Error 0x%x while set control", err);
		h->ret = NETWORK_ERROR;
		h->done = 1;
		return;
	}

	c = get_ipmi_control(h, control);

	if (NULL == c)
	{
		/* this should never happen */
		h->err = zbx_dsprintf(h->err, "Fatal error");
		h->ret = NOTSUPPORTED;
		h->done = 1;
		return;
	}

	ent = ipmi_control_get_entity(control);
	e_string = ipmi_entity_get_entity_id_string(ent);
	c_type = ipmi_control_get_type_string(control);

	zabbix_log(LOG_LEVEL_DEBUG, "Set value completed for control %s@[%s]:%d",
			c->c_name, h->ip, h->port);

	h->done = 1;
}