bklyn 0.1.1

Rust interface for Kubernetes Heapster metric collection
docs.rs failed to build bklyn-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

bklyn

Build Status Software License crates.io

collect artisanal kubernetes cluster metrics from rust

Bklyn is a rust interface querying heapster.

api docs

Find them here

usage

Bklyn relies on the kubernetes heapster API to query cluster metrics. In order to do so, you will need your cluster username and password as well as a url for heapster. You can resolve this url using kubectl

After authenticating with a kubeternetes cluster, run the following

$ kubectl cluster-info

Inspect the output for the Heapster url.

With those items on hand, you should be on your way with bklyn

extern crate bklyn;
extern crate hyper;

use bklyn::{Credentials, Heapster};
use hyper::Client;
use std::env;

fn main() {
    if let (Ok(baseurl), Ok(user), Ok(password)) = (
        env::var("HEAPSTER_BASEURL"),
        env::var("HEAPSTER_USER"),
        env::var("HEAPSTER_PASSWORD")
    ) {
        let client = Client::new();
        let heapster = Heapster::new(
            baseurl,
            &client,
            Credentials::Basic(
                user,
                password
            )
        );
        if let Ok(names) = heapster.cluster().metrics().names() {
            for metric in names {
                println!(
                    "{:#?} metrics {:#?}",
                    metric,
                    heapster.cluster().metrics().values(metric.clone(), &Default::default())
                );
            }
        }

    }
}

Doug Tangren (softprops) 2016