Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
args = parser.parse_args()
config = Config(args.config_file)
cluster = Cluster(config, args.cluster)
invert = args.invert
if args.metrics_file and args.metrics_file[0] != '-':
fi = args.metrics_file
else:
fi = []
if args.node:
match_dests = [args.node]
else:
match_dests = local_addresses()
try:
for metric in fileinput.input(fi):
if args.field is None:
m = metric.strip()
else:
fields = metric.split(args.field_separator)
try:
m = fields[int(args.field)-1].strip()
except IndexError:
raise SystemExit("Field index is out-of-bounds")
for match in filterMetrics([m], match_dests, cluster, invert):
print metric.strip()
except KeyboardInterrupt:
sys.exit(1)
args = parser.parse_args()
config = Config(args.config_file)
cluster = Cluster(config, args.cluster)
invert = args.invert
if args.metrics_file and args.metrics_file[0] != '-':
fi = args.metrics_file
else:
fi = []
if args.node:
match_dests = [args.node]
else:
match_dests = local_addresses()
try:
for metric in fileinput.input(fi):
if args.field is None:
m = metric.strip()
else:
fields = metric.split(args.field_separator)
try:
m = fields[int(args.field)-1].strip()
except IndexError:
raise SystemExit("Field index is out-of-bounds")
for match in filterMetrics([m], match_dests, cluster, invert):
print metric.strip()
except KeyboardInterrupt:
sys.exit(1)