Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def carbon_list():
parser = common_parser('List the metrics this carbon node contains')
parser.add_argument(
'-d', '--storage-dir',
default='/opt/graphite/storage/whisper',
help='Storage dir')
args = parser.parse_args()
try:
for m in listMetrics(args.storage_dir):
print m
except IOError as e:
if e.errno == errno.EPIPE:
pass # we got killed, lol
else:
raise SystemExit(e)
def carbon_list():
parser = common_parser('List the metrics this carbon node contains')
parser.add_argument(
'-d', '--storage-dir',
default='/opt/graphite/storage/whisper',
help='Storage dir')
args = parser.parse_args()
try:
for m in listMetrics(args.storage_dir):
print m
except IOError as e:
if e.errno == errno.EPIPE:
pass # we got killed, lol
else:
raise SystemExit(e)
def carbon_lookup():
parser = common_parser('Lookup where a metric lives in a carbon cluster')
parser.add_argument(
'metric', metavar='METRIC', nargs=1,
type=str,
help='Full metric name to search for')
parser.add_argument(
'-s', '--short',
action='store_true',
help='Only display the address, without port and cluster name')
args = parser.parse_args()
config = Config(args.config_file)
cluster = Cluster(config, args.cluster)
def carbon_sync():
parser = common_parser(
'Sync local metrics using remote nodes in the cluster'
)
parser.add_argument(
'-f', '--metrics-file',
default='-',
help='File containing metric names to filter, or \'-\' ' +
'to read from STDIN')
parser.add_argument(
'-s', '--source-node',
required=True,
help='Override the source for metrics data')
parser.add_argument(
'-d', '--storage-dir',
def carbon_sync():
parser = common_parser(
'Sync local metrics using remote nodes in the cluster'
)
parser.add_argument(
'-f', '--metrics-file',
default='-',
help='File containing metric names to filter, or \'-\' ' +
'to read from STDIN')
parser.add_argument(
'-s', '--source-node',
required=True,
help='Override the source for metrics data')
parser.add_argument(
'-d', '--storage-dir',
def carbon_delete():
parser = common_parser('Soft delete metrics on the local node')
parser.add_argument(
'-d', '--storage-dir',
default='/opt/graphite/storage/whisper',
help='Storage dir')
parser.add_argument(
'-t', '--trash-dir',
default='/opt/graphite/storage/whisper/trash',
help='Trash dir')
parser.add_argument(
'-f', '--metrics-file',
default='-',
help='File containing metric names to filter, or \'-\' ' +
'to read from STDIN')
def carbon_hosts():
parser = common_parser('Return the addresses for all nodes in a cluster')
args = parser.parse_args()
config = Config(args.config_file)
cluster = Cluster(config, args.cluster)
cluster_hosts = [d[0] for d in cluster.destinations]
print "\n".join(cluster_hosts)
def carbon_sieve():
parser = common_parser(
'Given a list of metrics, output those that belong to a node')
parser.add_argument(
'-f', '--metrics-file',
default='-',
help='File containing metric names to filter, or \'-\' ' +
'to read from STDIN')
parser.add_argument(
'-n', '--node',
help='Filter for metrics belonging to this node. Uses local addresses ' +
'if not provided.')
parser.add_argument(
'-I', '--invert',
action='store_true',
def carbon_sieve():
parser = common_parser(
'Given a list of metrics, output those that belong to a node')
parser.add_argument(
'-f', '--metrics-file',
default='-',
help='File containing metric names to filter, or \'-\' ' +
'to read from STDIN')
parser.add_argument(
'-n', '--node',
help='Filter for metrics belonging to this node. Uses local ' +
'addresses if not provided.')
parser.add_argument(
'-I', '--invert',
action='store_true',
def carbon_hosts():
parser = common_parser('Return the addresses for all nodes in a cluster')
args = parser.parse_args()
config = Config(args.config_file)
cluster = Cluster(config, args.cluster)
cluster_hosts = [d[0] for d in cluster.destinations]
print "\n".join(cluster_hosts)