How to use the carbonate.cluster.Cluster function in carbonate

To help you get started, we’ve selected a few carbonate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphite-project / carbonate / carbonate / cli.py View on Github external
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)

    results = lookup(str(args.metric[0]), cluster)

    if args.short:
        for i, _ in enumerate(results):
            results[i] = results[i].split(':')[0]

    print "\n".join(results)
github graphite-project / carbonate / carbonate / cli.py View on Github external
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)

    results = lookup(str(args.metric[0]), cluster)

    if args.short:
        for i, _ in enumerate(results):
            results[i] = results[i].split(':')[0]

    print "\n".join(results)
github graphite-project / carbonate / carbonate / cli.py View on Github external
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)
github graphite-project / carbonate / carbonate / cli.py View on Github external
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)
github graphite-project / carbonate / carbonate / cli.py View on Github external
parser.add_argument(
        '--field',
        type=int,
        help='Input field to sieve if multiple metrics per-line of input. ' +
        'Note that fields are indexed starting with 1.')

    parser.add_argument(
        '--field-separator',
        default=',',
        help='Character used to separate metric names when using "--field"')

    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()
github graphite-project / carbonate / carbonate / cli.py View on Github external
parser.add_argument(
        '--field',
        type=int,
        help='Input field to sieve if multiple metrics per-line of input. ' +
        'Note that fields are indexed starting with 1.')

    parser.add_argument(
        '--field-separator',
        default=',',
        help='Character used to separate metric names when using "--field"')

    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()