Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added FC error metrics

  • Loading branch information...
commit f6211b7b0f3703e5779f04ca5b15352b70200415 1 parent 4ffa92a
Evan Fraser evanjfraser authored

Showing 1 changed file with 22 additions and 28 deletions. Show diff stats Hide diff stats

  1. +22 28 fibrechannel/fibrechannel.py
50 fibrechannel/fibrechannel.py
@@ -32,15 +32,6 @@
32 32 'ifOutUcastPkts' : (1,3,6,1,2,1,2,2,1,17),
33 33 'ifOutErrors' : (1,3,6,1,2,1,2,2,1,20),
34 34 }
35   -#oidDict = {
36   -# 'ifIndex' : (1,3,6,1,2,1,2,2,1,1),
37   -# 'ifName' : (1,3,6,1,2,1,31,1,1,1,1),
38   -# 'ifAlias' : (1,3,6,1,2,1,31,1,1,1,18),
39   -# 'ifHCInOctets' : (1,3,6,1,2,1,31,1,1,1,6),
40   -# 'ifHCOutOctets' : (1,3,6,1,2,1,31,1,1,1,10),
41   -# 'ifInUcastPkts' : (1,3,6,1,2,1,2,2,1,11),
42   -# 'ifOutUcastPkts' : (1,3,6,1,2,1,2,2,1,17),
43   -# }
44 35
45 36 def get_metrics():
46 37 """Return all metrics"""
@@ -86,11 +77,6 @@ def get_delta(name):
86 77 def runSnmp(oidDict,ip):
87 78
88 79 # cmdgen only takes tuples, oid strings don't work
89   -## ifIndex = (1,3,6,1,2,1,2,2,1,1)
90   -## ifName = (1,3,6,1,2,1,31,1,1,1,1)
91   -## ifAlias = (1,3,6,1,2,1,31,1,1,1,18)
92   -## ifHCInOctets = (1,3,6,1,2,1,31,1,1,1,6)
93   -## ifHCOutOctets = (1,3,6,1,2,1,31,1,1,1,10)
94 80
95 81 # 'ifIndex' : (1,3,6,1,2,1,2,2,1,1),
96 82 # 'ifDescr' : (1,3,6,1,2,1,2,2,1,2),
@@ -141,7 +127,6 @@ def buildDict(oidDict,t,switch): # passed a list of tuples, build's a dict based
141 127 temp = str(t[t.index(line)][1][1]) #(use ifDescr)
142 128 #lowercase the name, change spaces + '/' to '_'
143 129 name = ((temp.lower()).replace(' ','_')).replace('/','_')
144   - #print name
145 130 inoct = str(t[t.index(line)][2][1])
146 131 builtdict[switch+'_'+name+'_bitsin'] = int(inoct) * 8
147 132 outoct = str(t[t.index(line)][5][1])
@@ -150,19 +135,11 @@ def buildDict(oidDict,t,switch): # passed a list of tuples, build's a dict based
150 135 builtdict[switch+'_'+name+'_pktsin'] = int(inpkt)
151 136 outpkt = str(t[t.index(line)][7][1])
152 137 builtdict[switch+'_'+name+'_pktsout'] = int(outpkt)
153   - #if match and t[t.index(line)][0][1] != '':
154   - # alias = str(t[t.index(line)][0][1])
155   - # index = str(t[t.index(line)][1][1])
156   - # name = str(t[t.index(line)][2][1])
157   - # hcinoct = str(t[t.index(line)][3][1])
158   - # builtdict[switch+'_'+alias+'_bitsin'] = int(hcinoct) * 8
159   - # hcoutoct = str(t[t.index(line)][4][1])
160   - # builtdict[switch+'_'+alias+'_bitsout'] = int(hcoutoct) * 8
161   - # hcinpkt = str(t[t.index(line)][5][1])
162   - # builtdict[switch+'_'+alias+'_pktsin'] = int(hcinpkt)
163   - # hcoutpkt = str(t[t.index(line)][6][1])
164   - # builtdict[switch+'_'+alias+'_pktsout'] = int(hcoutpkt)
165   -
  138 + inerrors = str(t[t.index(line)][3][1])
  139 + builtdict[switch+'_'+name+'_inerrors'] = int(inerrors)
  140 + outerrors = str(t[t.index(line)][6][1])
  141 + builtdict[switch+'_'+name+'_outerrors'] = int(outerrors)
  142 +
166 143 #pprint.pprint(builtdict)
167 144 return builtdict
168 145
@@ -173,6 +150,7 @@ def define_metrics(Desc_Skel, ipaddr, switch):
173 150 aliasdict = buildDict(oidDict,snmpTable,switch)
174 151 spoof_string = ipaddr + ':' + switch
175 152 #print newdict
  153 + #pprint.pprint(aliasdict.keys())
176 154
177 155 for key in aliasdict.keys():
178 156 if "bitsin" in key:
@@ -207,6 +185,22 @@ def define_metrics(Desc_Skel, ipaddr, switch):
207 185 "groups" : "Packets",
208 186 "spoof_host" : spoof_string,
209 187 }))
  188 + elif "inerrors" in key:
  189 + descriptors.append(create_desc(Desc_Skel, {
  190 + "name" : key,
  191 + "units" : "errors",
  192 + "description" : "inbound packet errors",
  193 + "groups" : "Packets",
  194 + "spoof_host" : spoof_string,
  195 + }))
  196 + elif "outerrors" in key:
  197 + descriptors.append(create_desc(Desc_Skel, {
  198 + "name" : key,
  199 + "units" : "errors",
  200 + "description" : "outbound packet errors",
  201 + "groups" : "Packets",
  202 + "spoof_host" : spoof_string,
  203 + }))
210 204
211 205
212 206 return descriptors

0 comments on commit f6211b7

Please sign in to comment.
Something went wrong with that request. Please try again.