Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP3:GA
ganglia
ganglia-0004-Metric-currestab-unlike-all-the-ot...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ganglia-0004-Metric-currestab-unlike-all-the-other-one-is-an-abso.patch of Package ganglia
From: Vladimir <vlemp@vuksan.com> Date: Mon, 9 Nov 2015 13:36:39 -0500 Git-commit: 1692e34d72fa735b6f0627df4c8a3b55d3ece6fa References: bsc#1087487 Subject: [PATCH] Metric currestab unlike all the other one is an absolute value and not a counter. Need to treat it separately Acked-by: John Jolly <jjolly@suse.de> --- gmond/python_modules/network/netstats.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/gmond/python_modules/network/netstats.py b/gmond/python_modules/network/netstats.py index f9c6795f..4581e710 100644 --- a/gmond/python_modules/network/netstats.py +++ b/gmond/python_modules/network/netstats.py @@ -19,6 +19,8 @@ stats_files = ["/proc/net/netstat", "/proc/net/snmp"] LAST_METRICS = copy.deepcopy(METRICS) METRICS_CACHE_MAX = 5 +# Metrics that are not counters but absolute values +ABSOLUTE_VALUES = [ "currestab" ] stats_pos = {} @@ -69,12 +71,15 @@ def get_metrics(): def get_value(name): """Return a value for the requested metric""" - metrics = get_metrics()[0] + # get metrics + [curr_metrics, last_metrics] = get_metrics() - name = name[len(NAME_PREFIX):] # remove prefix from name + parts = name.split("_") + group = parts[0] + metric = "_".join(parts[1:]) try: - result = metrics['data'][name] + result = float(curr_metrics['data'][group][metric]) except StandardError: result = 0 @@ -208,12 +213,18 @@ def metric_init(params): file.close() for group in stats_pos: - for item in stats_pos[group]: - descriptors.append(create_desc(Desc_Skel, { - "name" : group + "_" + stats_pos[group][item], - "description": stats_pos[group][item], - 'groups' : group - })) + for item in stats_pos[group]: + if stats_pos[group][item] in ABSOLUTE_VALUES: + descriptors.append(create_desc(Desc_Skel, { + "name" : group + "_" + stats_pos[group][item], + "call_back" : get_value, + "groups" : group + })) + else: + descriptors.append(create_desc(Desc_Skel, { + "name" : group + "_" + stats_pos[group][item], + "groups" : group + })) descriptors.append(create_desc(Desc_Skel, { "name" : "tcpext_tcploss_percentage", -- 2.13.6
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor