File tree Expand file tree Collapse file tree
network/netstats/python_modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,11 +107,27 @@ def get_tcploss_percentage(name):
107107 if pct < 0 :
108108 print name + " is less 0"
109109 pct = 0
110- except KeyError :
110+ except Exception :
111111 pct = 0.0
112112
113113 return pct
114114
115+ def get_tcpattemptfail_percentage (name ):
116+
117+ # get metrics
118+ [curr_metrics , last_metrics ] = get_metrics ()
119+
120+ try :
121+ pct = 100 * (float (curr_metrics ['data' ]['tcp' ]["attemptfails" ]) - float (last_metrics ["data" ]['tcp' ]["attemptfails" ])) / (float (curr_metrics ['data' ]['tcp' ]['outsegs' ]) + float (curr_metrics ['data' ]['tcp' ]['insegs' ]) - float (last_metrics ['data' ]['tcp' ]['insegs' ]) - float (last_metrics ['data' ]['tcp' ]['outsegs' ]))
122+ if pct < 0 :
123+ print name + " is less 0"
124+ pct = 0
125+ except Exception :
126+ pct = 0.0
127+
128+ return pct
129+
130+
115131def get_retrans_percentage (name ):
116132
117133 # get metrics
@@ -122,7 +138,7 @@ def get_retrans_percentage(name):
122138 if pct < 0 :
123139 print name + " is less 0"
124140 pct = 0
125- except KeyError :
141+ except Exception :
126142 pct = 0.0
127143
128144 return pct
@@ -196,6 +212,15 @@ def metric_init(params):
196212 'groups' : 'tcpext'
197213 }))
198214
215+ descriptors .append (create_desc (Desc_Skel , {
216+ "name" : "tcpext_" + "tcpattemptfail_percentage" ,
217+ "call_back" : get_tcpattemptfail_percentage ,
218+ "description" : "TCP attemptfail percentage, tcpattemptfail / insegs + outsegs" ,
219+ "units" : "pct" ,
220+ 'groups' : 'tcpext'
221+ }))
222+
223+
199224 descriptors .append (create_desc (Desc_Skel , {
200225 "name" : "tcp_" + "retrans_percentage" ,
201226 "call_back" : get_retrans_percentage ,
You can’t perform that action at this time.
0 commit comments