49a93743a4
**- Why I did it** We need RIF counters to be enabled by default. Flex Counter does probe for supported counters. If a platform does not support RIF counters, SAI will return NOT_SUPPORTED and Flex Counter will stop polling the counter. **- How to verify it** After fresh install rif counter gropup is enabled by default: $ counterpoll show Type Interval (in ms) Status -------------------- ------------------ -------- QUEUE_STAT default (10000) enable PORT_STAT default (1000) enable RIF_STAT default (1000) enable QUEUE_WATERMARK_STAT default (10000) enable PG_WATERMARK_STAT default (10000) enable Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
38 lines
963 B
Python
Executable File
38 lines
963 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import swsssdk
|
|
import time
|
|
|
|
def enable_counter_group(db, name):
|
|
info = {}
|
|
info['FLEX_COUNTER_STATUS'] = 'enable'
|
|
db.mod_entry("FLEX_COUNTER_TABLE", name, info)
|
|
|
|
def enable_counters():
|
|
db = swsssdk.ConfigDBConnector()
|
|
db.connect()
|
|
enable_counter_group(db, 'PORT')
|
|
enable_counter_group(db, 'RIF')
|
|
enable_counter_group(db, 'QUEUE')
|
|
enable_counter_group(db, 'PFCWD')
|
|
enable_counter_group(db, 'PG_WATERMARK')
|
|
enable_counter_group(db, 'QUEUE_WATERMARK')
|
|
|
|
def get_uptime():
|
|
with open('/proc/uptime') as fp:
|
|
return float(fp.read().split(' ')[0])
|
|
|
|
def main():
|
|
# If the switch was just started (uptime less than 5 minutes),
|
|
# wait for 3 minutes and enable counters
|
|
# otherwise wait for 60 seconds and enable counters
|
|
uptime = get_uptime()
|
|
if uptime < 300:
|
|
time.sleep(180)
|
|
else:
|
|
time.sleep(60)
|
|
enable_counters()
|
|
|
|
if __name__ == '__main__':
|
|
main()
|