mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
25 lines
No EOL
738 B
Python
25 lines
No EOL
738 B
Python
import sys
|
|
|
|
class MuninGraph(object):
|
|
def __init__(self, graph_config, calculate_metrics):
|
|
self.graph_config = graph_config
|
|
self.calculate_metrics = calculate_metrics
|
|
|
|
def run(self):
|
|
cmd_name = None
|
|
if len(sys.argv) > 1:
|
|
cmd_name = sys.argv[1]
|
|
if cmd_name == 'config':
|
|
self.print_config()
|
|
else:
|
|
metrics = self.calculate_metrics()
|
|
self.print_metrics(metrics)
|
|
|
|
def print_config(self):
|
|
for key,value in self.graph_config.items():
|
|
print '%s %s' % (key, value)
|
|
|
|
def print_metrics(self, metrics):
|
|
for key, value in metrics.items():
|
|
print '%s.value %s' % (key, value)
|
|
|