Projet

Général

Profil

Révision 76b4675d

ID76b4675d1bc581a2a097ef80b368e7c76881a82c
Parent 77e53059
Enfant 09b145cb

Ajouté par Nathaniel Clark il y a environ 5 ans

Fix flake warnings

Signed-off-by: Nathaniel Clark <>

Voir les différences:

plugins/router/arris-sb6183
102 102
        )
103 103

  
104 104
        # POWER
105
        print("multigraph arris_power")
106
        print("graph_title Arris Power (dBmV)")
107
        print("graph_vlabel Power (dBmV)")
108
        print("graph_category network")
105
        print(
106
            """multigraph arris_power
107
graph_title Arris Power (dBmV)
108
graph_vlabel Power (dBmV)
109
graph_category network"""
110
        )
109 111
        for i in range(1, DOWNCOUNT + 1):
110 112
            print("down_{0}.label Down Ch {1}".format(i, i))
111 113
            print("down_{0}.type GAUGE".format(i))
......
153 155
            print("snr.draw LINE1")
154 156

  
155 157
        # ERRORS
156
        print("\nmultigraph arris_error")
157
        print("graph_title Arris Channel Errors")
158
        print("graph_category network")
159
        print("graph_args --base 1000")
160
        print("graph_vlabel errors/sec")
161
        print("graph_category network")
162
        print("corr.label Corrected")
163
        print("corr.type DERIVE")
164
        print("corr.min 0")
165
        print("uncr.label Uncorrectable")
166
        print("uncr.type DERIVE")
167
        print("uncr.min 0")
168
        print("uncr.warning 1")
158
        print(
159
            """
160
multigraph arris_error
161
graph_title Arris Channel Errors
162
graph_category network
163
graph_args --base 1000
164
graph_vlabel errors/sec
165
graph_category network
166
corr.label Corrected
167
corr.type DERIVE
168
corr.min 0
169
uncr.label Uncorrectable
170
uncr.type DERIVE
171
uncr.min 0
172
uncr.warning 1"""
173
        )
169 174

  
170 175
        for i in range(1, DOWNCOUNT + 1):
171 176
            name = "down_{0}".format(i)
......
185 190
        sys.exit(0)
186 191

  
187 192
    if sys.argv[1] == "autoconfig":
188
        try:
193

  
194
        def check(url):
189 195
            from lxml import html
190 196

  
191
            resp = request.urlopen(STATUS_URL)
197
            resp = request.urlopen(url)
198
            html.fromstring("<html>")
199
            return resp
200

  
201
        try:
202
            resp = check(STATUS_URL)
192 203
        except ImportError:
193 204
            print("no (missing lxml module)")
194 205
        except OSError:
......
197 208
            if resp.status == 200:
198 209
                print("yes")
199 210
            else:
200
                print("no (Bad status code: %d)" % page.status_code)
211
                print("no (Bad status code: %d)" % resp.status_code)
201 212
        sys.exit(0)
202 213

  
203
from lxml import html
204

  
205 214
rxblank = re.compile(r"[\x00\n\r\t ]+", re.MULTILINE)
206 215
rxcomment = re.compile(r"<!--.*?-->")
207 216
rxscript = re.compile(r"<script.*?</script>", re.MULTILINE)
......
211 220
    """
212 221
    Extract simpleTables from page at URL
213 222
    """
223
    from lxml import html
224

  
214 225
    try:
215 226
        resp = request.urlopen(url)
216 227
    except OSError:
......
266 277
    trs.pop(0)
267 278

  
268 279
    headings = ["".join(x.itertext()).strip() for x in trs.pop(0).findall("td")]
269
    # ['Channel', 'Lock Status', 'Modulation', 'Channel ID', 'Frequency', 'Power', 'SNR', 'Corrected', 'Uncorrectables']
280
    # ['Channel', 'Lock Status', 'Modulation', 'Channel ID', 'Frequency', 'Power', 'SNR',
281
    # 'Corrected', 'Uncorrectables']
270 282
else:
271 283
    trs = []
272 284
    headings = []
......
329 341
    trs.pop(0)
330 342

  
331 343
    headings = ["".join(x.itertext()).strip() for x in trs.pop(0).findall("td")]
332
    # ['Channel', 'Lock Status', 'US Channel Type', 'Channel ID', 'Symbol Rate', 'Frequency', 'Power']
344
    # ['Channel', 'Lock Status', 'US Channel Type', 'Channel ID', 'Symbol Rate',
345
    # 'Frequency', 'Power']
333 346

  
334 347
for row in trs:
335 348
    data = dict(

Formats disponibles : Unified diff