Exemplo n.º 1
0
static int	NET_IF_TOTAL_ERRORS(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
    kstat_named_t ikn;
    kstat_named_t okn;
    char    if_name[MAX_STRING_LEN];
    int	    ret;

    assert(result);

    init_result(result);

    if(num_param(param) > 1)
    {
	return SYSINFO_RET_FAIL;
    }

    if(get_param(param, 1, if_name, MAX_STRING_LEN) != 0)
    {
	return SYSINFO_RET_FAIL;
    }

	if ( SYSINFO_RET_OK == (ret = get_kstat_named_field(if_name, "ierrors", &ikn)) &&
		SYSINFO_RET_OK == (ret = get_kstat_named_field(if_name, "oerrors", &okn)) )
			SET_UI64_RESULT(result, ikn.value.ui32 + okn.value.ui32);

    return ret;
}
Exemplo n.º 2
0
static int	NET_IF_IN_PACKETS(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
    kstat_named_t kn;
    char    if_name[MAX_STRING_LEN];
    int	    ret;

    assert(result);

    init_result(result);

    if(num_param(param) > 1)
    {
	return SYSINFO_RET_FAIL;
    }

    if(get_param(param, 1, if_name, MAX_STRING_LEN) != 0)
    {
	return SYSINFO_RET_FAIL;
    }

    if ( SYSINFO_RET_OK == (ret = get_kstat_named_field(if_name, "ipackets64", &kn)) )
    {
	SET_UI64_RESULT(result, kn.value.ui64);
    }
    else if ( SYSINFO_RET_OK == (ret = get_kstat_named_field(if_name, "ipackets", &kn)) )
    {
	SET_UI64_RESULT(result, kn.value.ui32);
    }

    return ret;
}
Exemplo n.º 3
0
Arquivo: net.c Projeto: HupuInc/zabbix
static int	NET_IF_TOTAL_PACKETS(const char *if_name, AGENT_RESULT *result)
{
	kstat_named_t	ikn, okn;
	char		*error = NULL;

	if (SUCCEED == get_kstat_named_field(if_name, "ipackets64", &ikn, &error) &&
			SUCCEED == get_kstat_named_field(if_name, "opackets64", &okn, &error))
	{
		SET_UI64_RESULT(result, get_kstat_numeric_value(&ikn) + get_kstat_numeric_value(&okn));
	}
	else if (SUCCEED == get_kstat_named_field(if_name, "ipackets", &ikn, &error) &&
			SUCCEED == get_kstat_named_field(if_name, "opackets", &okn, &error))
	{
		SET_UI64_RESULT(result, get_kstat_numeric_value(&ikn) + get_kstat_numeric_value(&okn));
	}
	else
	{
		SET_MSG_RESULT(result, error);
		return SYSINFO_RET_FAIL;
	}

	zbx_free(error);

	return SYSINFO_RET_OK;
}
Exemplo n.º 4
0
static int	NET_IF_OUT_BYTES(const char *if_name, AGENT_RESULT *result)
{
	kstat_named_t	kn;

	if (SUCCEED == get_kstat_named_field(if_name, "obytes64", &kn) ||
			SUCCEED == get_kstat_named_field(if_name, "obytes", &kn))
	{
		SET_UI64_RESULT(result, get_kstat_numeric_value(&kn));
	}
	else
		return SYSINFO_RET_FAIL;

	return SYSINFO_RET_OK;
}
Exemplo n.º 5
0
static int	NET_IF_TOTAL_ERRORS(const char *if_name, AGENT_RESULT *result)
{
	kstat_named_t	ikn, okn;

	if (SUCCEED == get_kstat_named_field(if_name, "ierrors", &ikn) &&
			SUCCEED == get_kstat_named_field(if_name, "oerrors", &okn))
	{
		SET_UI64_RESULT(result, get_kstat_numeric_value(&ikn) + get_kstat_numeric_value(&okn));
	}
	else
		return SYSINFO_RET_FAIL;

	return SYSINFO_RET_OK;
}
Exemplo n.º 6
0
int	NET_IF_COLLISIONS(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
    kstat_named_t kn;
    char    if_name[MAX_STRING_LEN];
    int	    ret;

    assert(result);

    init_result(result);

    if(num_param(param) > 1)
    {
	return SYSINFO_RET_FAIL;
    }

    if(get_param(param, 1, if_name, sizeof(if_name)) != 0)
    {
	return SYSINFO_RET_FAIL;
    }

    if( SYSINFO_RET_OK == (ret = get_kstat_named_field(if_name, "collisions", &kn)) )
    {
	SET_UI64_RESULT(result, kn.value.ui32);
    }

    return ret;
}
Exemplo n.º 7
0
Arquivo: net.c Projeto: HupuInc/zabbix
int	NET_IF_COLLISIONS(AGENT_REQUEST *request, AGENT_RESULT *result)
{
	kstat_named_t	kn;
	char		*if_name, *error = NULL;

	if (1 < request->nparam)
	{
		SET_MSG_RESULT(result, zbx_strdup(NULL, "Too many parameters."));
		return SYSINFO_RET_FAIL;
	}

	if_name = get_rparam(request, 0);

	if (NULL == if_name || '\0' == *if_name)
	{
		SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid first parameter."));
		return SYSINFO_RET_FAIL;
	}

	if (SUCCEED != get_kstat_named_field(if_name, "collisions", &kn, &error))
	{
		SET_MSG_RESULT(result, error);
		return SYSINFO_RET_FAIL;
	}

	SET_UI64_RESULT(result, get_kstat_numeric_value(&kn));

	return SYSINFO_RET_OK;
}
Exemplo n.º 8
0
static int	NET_IF_IN_ERRORS(const char *if_name, AGENT_RESULT *result)
{
	kstat_named_t	kn;

	if (SUCCEED == get_kstat_named_field(if_name, "ierrors", &kn))
		SET_UI64_RESULT(result, get_kstat_numeric_value(&kn));
	else
		return SYSINFO_RET_FAIL;

	return SYSINFO_RET_OK;
}
Exemplo n.º 9
0
Arquivo: net.c Projeto: HupuInc/zabbix
static int	NET_IF_IN_BYTES(const char *if_name, AGENT_RESULT *result)
{
	kstat_named_t	kn;
	char		*error = NULL;

	if (SUCCEED == get_kstat_named_field(if_name, "rbytes64", &kn, &error) ||
			SUCCEED == get_kstat_named_field(if_name, "rbytes", &kn, &error))
	{
		SET_UI64_RESULT(result, get_kstat_numeric_value(&kn));
	}
	else
	{
		SET_MSG_RESULT(result, error);
		return SYSINFO_RET_FAIL;
	}

	zbx_free(error);

	return SYSINFO_RET_OK;
}
Exemplo n.º 10
0
Arquivo: net.c Projeto: HupuInc/zabbix
static int	NET_IF_OUT_ERRORS(const char *if_name, AGENT_RESULT *result)
{
	kstat_named_t	kn;
	char		*error = NULL;

	if (SUCCEED == get_kstat_named_field(if_name, "oerrors", &kn, &error))
	{
		SET_UI64_RESULT(result, get_kstat_numeric_value(&kn));
	}
	else
	{
		SET_MSG_RESULT(result, error);
		return SYSINFO_RET_FAIL;
	}

	return SYSINFO_RET_OK;
}
Exemplo n.º 11
0
int	NET_IF_COLLISIONS(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
	kstat_named_t	kn;
	char		if_name[MAX_STRING_LEN];

	if (1 < num_param(param))
		return SYSINFO_RET_FAIL;

	if (0 != get_param(param, 1, if_name, sizeof(if_name)))
		return SYSINFO_RET_FAIL;

	if (SUCCEED == get_kstat_named_field(if_name, "collisions", &kn))
		SET_UI64_RESULT(result, get_kstat_numeric_value(&kn));
	else
		return SYSINFO_RET_FAIL;

	return SYSINFO_RET_OK;
}