Skip to content

Lemurctl

Meng Ding edited this page Feb 28, 2020 · 7 revisions

Overview

Lemurctl is a command line utility to access and control Lemur powered by Turbonomic. It offers the capability to view real time entities discovered by Lemur, and the resource consumer and provider relationships between these entities i.e., the supply chain. Using Lemur, user can easily sort entities of certain type (e.g., applications, or containers) based on their resource consumption. User can also take a top-down approach to examine the metric and resource usage of a specific application and all the other entities along the supply chain of that application to quickly determine the resource bottle neck that may affect the performance of the application.

Getting Started

Prerequisites

  • Go 1.13 (Go version prior to 1.13 requires module-aware mode, e.g., GO111MODULE=on)
  • Lemur server is installed and running

Lemurctl Installation

  • Clone the repository
$ git clone https://github.com/turbonomic/lemur.git
  • Build the binary
$ cd lemur/lemurctl
$ make
  • Move the binary into your PATH
$ sudo mv ./lemurctl /usr/local/bin/lemurctl
  • Test to ensure the version you installed is up-to-date
$ lemurctl -v

Use Cases

Get first familiar with the concept and taxonomy of the Lemur/Turbonomic Supply Chain here

  • Always use the -h or --help option to get a description of the command syntax and options
$ lemurctl -h

Usage: lemurctl [OPTIONS] COMMAND [arg...]

lemurctl controls Lemur, powered by Turbonomic.

...

Options:
  --kubeconfig value           path to the kubeconfig file to access the Lemur cluster [$KUBECONFIG]
  --insecure, -k               allow connections to SSL enabled InfluxDB server without certs [$INSECURE_CONNECTION]
  --log-level value, -l value  specify log level (debug, info, warn, error, fatal, panic) (default: "info") [$LOG_LEVEL]
  --influxdb value             specify the endpoint of the InfluxDB server (deprecated) [$INFLUXDB_SERVER]
  --debug, -d                  enable debug mode [$DEBUG]
  --help, -h                   show help
  --version, -v                print the version
  
Commands:
  get, g  Display one or many entities or groups of entities
  help    Shows a list of commands or help for one command
  
Run 'lemurctl COMMAND --help' for more information on a command.

  • lemurctl interacts with the InfluxDB service that comes with your Lemur install to retrieve the entity information and build the supply chain. The InfluxDB service is automatically discovered from the Kubernetes cluster where your Lemur is deployed. All that is required is to provide the correct kubeconfig to your cluster through either command line argument --kubeconfig=<PATH> or environment variable export KUBECONFIG=<PATH>.

  • The InfluxDB server is SSL enabled through istio ingress gateway. In order to connect to the InfluxDB server without certification, specify -k in your command or export INSECURE_CONNECTION=true in your environment variable.

  • Get a list of kubernetes clusters discovered by Lemur

$ lemurctl -k get cluster
ID                                      TYPE                     
6eb24347-92fe-11e9-96bd-005056b8136b    vm                       
d8eb33cf-f4e5-11e7-9653-005056802f41    vm  

You can match the ID to a specific kubernetes cluster by running the following command:

$ kubectl -n default get svc kubernetes -o=jsonpath='{.metadata.uid}'
6eb24347-92fe-11e9-96bd-005056b8136b

All the following use cases require a cluster ID to be set such that entities retrieved only belong to one cluster scope. Out of box, Lemur only monitors one kubernetes cluster where Lemur itself is running. In this case, the cluster ID is automatically set by lemurctl, so there is no need to set the scope additionally. If you add multiple kubernetes target to your Lemur install, make sure to set the LEMUR_CLUSTER environment variable, or add --cluster to your command line options to indicate which cluster you want lemurctl to point at. For example:

$ export LEMUR_CLUSTER=6eb24347-92fe-11e9-96bd-005056b8136b
  • Get a list of applications that belong to a kubernetes cluster sorted by VCPU
$ lemurctl -k get app
NAME                                                                                                        VCPU (MHz)VMEM (GB) 
App-istio-system/istio-galley-664b9468d6-kmx6n/galley                                                       52.86     0.02      
App-istio-system/prometheus-776fdf7479-4c6mw/prometheus                                                     51.55     0.58      
App-kube-system/calico-node-85txg/calico-node                                                               45.00     0.15         
App-kube-system/kube-controller-manager-ip-10-0-0-38.ca-central-1.compute.internal/kube-controller-manager  32.71     0.05      
App-istio-system/istio-sidecar-injector-7c5d49854d-5nfqv/sidecar-injector-webhook                           30.31     0.01      
App-turbonomic/kafka-77689b4464-mvkv7/kafka                                                                 25.33     0.74      
  • Get a list of VMs that belong to a kubernetes cluster sorted by VMEM
$ lemurctl -k get vm --sort VMEM
NAME                                        VCPU (MHz)          VMEM (GB)    
meng-xl-machinedeployment-78d5dd8785-2gws6  971.53 [21.12%]     5.77 [70.68%]
meng-xl-machinedeployment-78d5dd8785-8v4ss  364.28 [7.92%]      5.54 [67.85%]
controlplane-0                              447.38 [9.32%]      2.02 [24.76%]
  • View the supply chain summary originating from applications
$ lemurctl -k get app --supply-chain
TYPE                     COUNT                    PROVIDERS                     CONSUMERS                     
APPLICATION              45                       CONTAINER                                                   
CONTAINER                45                       CONTAINER_POD                 APPLICATION                   
CONTAINER_POD            42                       VIRTUAL_MACHINE               CONTAINER                     
VIRTUAL_MACHINE          7                        COMPUTE_TIER,STORAGE_TIER     CONTAINER_POD,APPLICATION     
COMPUTE_TIER             2                                                      VIRTUAL_MACHINE               
STORAGE_TIER             1                                                      VIRTUAL_MACHINE               
  • View the supply chain starting from an application
$ lemurctl -k get app App-istio-system/prometheus-776fdf7479-4c6mw/prometheus --supply-chain
TYPE                     COUNT                    PROVIDERS                     CONSUMERS                     
APPLICATION              1                        CONTAINER                                                   
NAME                                              VCPU (MHz)                    VMEM (GB)                     
*stem/prometheus-776fdf7479-4c6mw/prometheus      69.38                         0.57                          

TYPE                     COUNT                    PROVIDERS                     CONSUMERS                     
CONTAINER                1                        CONTAINER_POD                 APPLICATION                   
NAME                                              VCPU (MHz)                    VMEM (GB)                     
*stem/prometheus-776fdf7479-4c6mw/prometheus      69.38 [1.51%]                 0.57 [6.99%]                  

TYPE                     COUNT                    PROVIDERS                     CONSUMERS                     
CONTAINER_POD            1                        VIRTUAL_MACHINE               CONTAINER                     
NAME                                              VCPU (MHz)                    VMEM (GB)                     
istio-system/prometheus-776fdf7479-4c6mw          69.38 [1.51%]                 0.57 [6.99%]                  

TYPE                     COUNT                    PROVIDERS                     CONSUMERS                     
VIRTUAL_MACHINE          1                        COMPUTE_TIER,STORAGE_TIER     APPLICATION,CONTAINER_POD     
NAME                                              VCPU (MHz)                    VMEM (GB)                     
meng-xl-machinedeployment-78d5dd8785-2gws6        1152.54 [25.05%]              5.26 [64.44%]                 

TYPE                     COUNT                    PROVIDERS                     CONSUMERS                     
COMPUTE_TIER             1                                                      VIRTUAL_MACHINE               
NAME                                              
m4.large                                          

TYPE                     COUNT                    PROVIDERS                     CONSUMERS                     
STORAGE_TIER             1                                                      VIRTUAL_MACHINE               
NAME                                              
GP2                                              

Coming Soon

  • The ability to manage (list/add/remove) targets
  • The ability to execute actions
  • The ability to show a meaningful display name of a cluster
Clone this wiki locally