Nebulous Pumpkin Moons

    cadvisor-api

    1.0.1 • Public • Published

    Cadvisor API Client

    Build Status Coverage Status

    It's easy to use HTTP Client for any version of Cadvisor API (default : 1.3)

    Cadvisor Api Client using :

    Usage

    Cadvisor Api Parameters

    • hostname (ex. localhost)
    • port (ex. 8080)
    • requestTimeout amount of time to wait for the request to finish
    • connectTimeout amount of time to wait for a socket
    • retry options to provide to node-retry;"false" disables retry; defaults to 4 retries
    • log bunyan instance
    • headers HTTP headers to set in all requests
    • dtrace node-dtrace-provider handle
    • userAgent user-agent string to use

    Get Cadvisor Machine Info

    const cadvisor = require('cadvisor-api')();
     
    cadvisor.getMachineInfo().then(function(machineInfo){
        // ...show or parse your data
    }).catch(function(exceptionData){
       // ...show or parse error
    });

    or

    const cadvisor = require('cadvisor-api')({
        hostname:'localhost',
        port:8080,
        requestTimeout: 1000,
        connectTimeout: 1000,
    });
     
    cadvisor.getMachineInfo().then(function(machineInfo){
        // ...show or parse your data
    }).catch(function(exceptionData){
       // ...show or parse error
    });

    Get Cadvisor Container Info

    const cadvisor = require('cadvisor-api')();
     
    cadvisor.getContainerInfo().then(function(machineInfo){
        // ...show or parse your data
    }).catch(function(exceptionData){
       // ...show or parse error
    });

    or

    const cadvisor = require('cadvisor-api')();
     
    cadvisor.getContainerInfo('data-container').then(function(machineInfo){
        // ...show or parse your data
    }).catch(function(exceptionData){
       // ...show or parse error
    });

    Get Cadvisor SubContainer Info

    const cadvisor = require('cadvisor-api')();
     
    cadvisor.getSubContainerInfo().then(function(machineInfo){
        // ...show or parse your data
    }).catch(function(exceptionData){
       // ...show or parse error
    });

    or

    const cadvisor = require('cadvisor-api')();
     
    cadvisor.getSubContainerInfo('data-subcontainer').then(function(machineInfo){
        // ...show or parse your data
    }).catch(function(exceptionData){
       // ...show or parse error
    });

    Get Cadvisor Docker Info

    const cadvisor = require('cadvisor-api')();
     
    cadvisor.getDockerInfo().then(function(machineInfo){
        // ...show or parse your data
    }).catch(function(exceptionData){
       // ...show or parse error
    });

    or

    const cadvisor = require('cadvisor-api')();
     
    cadvisor.getDockerInfo('cadvisor').then(function(machineInfo){
        // ...show or parse your data
    }).catch(function(exceptionData){
       // ...show or parse error
    });

    Install

    npm i cadvisor-api

    DownloadsWeekly Downloads

    482

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    16.3 kB

    Total Files

    9

    Last publish

    Collaborators

    • lfirek