def _post(cls, args): api._timeout = args.timeout if args.localhostname: host = find_localhost() else: host = args.host if args.tags: tags = sorted(set([t.strip() for t in args.tags.split(',') if t])) else: tags = None res = api.Metric.send( metric=args.name, points=args.value, host=host, device=args.device, tags=tags, metric_type=args.type) report_warnings(res) report_errors(res)
def test_find_localhost(self): # Once run assert socket.getfqdn() == find_localhost() # Once memoized assert socket.getfqdn() == find_localhost()