Knative Monitoring with Sysdig on IBM Cloud
Tags: knative, cloudcomputing, monitoring, sysdig
Published: 2019-04-10 01:20:03

---
title: Knative Monitoring with Sysdig on IBM Cloud
published: true
tags: knative, cloudcomputing, monitoring, sysdig
canonical_url: https://medium.com/vmacwrites/knative-monitoring-with-sysdig-on-ibm-cloud-dc206c3f413d
---

After learning on how to [deploy an app to Knative on IBM Cloud](https://dev.to/vidyasagarmsc/install-knative-with-istio-on-ibm-cloud-2fd9) and how to do [Knative log analysis using LogDNA](https://dev.to/vidyasagarmsc/knative-log-analysis-with-logdna-on-ibm-cloud-34ag), it’s time to monitor our Knative Kubernetes cluster using IBM Cloud Monitoring with Sysdig service.

IBM Cloud Monitoring with Sysdig is a third-party cloud-native, and container-intelligence management system that you can include as part of your IBM Cloud architecture.

> Use it to gain operational visibility into the performance and health of your applications, services, and platforms. It offers administrators, DevOps teams and developers full stack telemetry with advanced features to monitor and troubleshoot, define alerts, and design custom dashboards. IBM Cloud Monitoring with Sysdig is operated by Sysdig in partnership with IBM.

### Provision a Sysdig instance

> Before provisioning the service, [Manage user access](https://cloud.ibm.com/docs/services/Monitoring-with-Sysdig/index.html#step1)

With your Knative node app running on IBM Cloud, let’s provision a Sysdig instance to start monitoring the app.

- Navigate to the [observability dashboard](https://cloud.ibm.com/observe) and under overview > click “create monitoring instance”.
- Give a service name, choose a region/location (us-south), select a resource group and choose an appropriate plan based on your requirement.
- Click **create** to provision the instance.

### Configure the Sysdig agent

After you provision an instance, you must configure a Sysdig agent for each metric source that you want to monitor. A metric source is a cloud resource that you want to monitor and control its performance and health. In our case, the metric source is a Kubernetes cluster.

![](https://cdn-images-1.medium.com/max/1024/1*Tp9L9xGydrC-SD7lsGbKcw.png)

To configure,

- Under monitoring on observability dashboard, click on **Edit sources** next to the Sysdig instance you just created in the above step.
- Click Kubernetes on the left pane and as you have already set the KUBECONFIG, you can skip to “Install Sysdig agent to your cluster” step.
- Run the command which looks something similar to this _(with your sysdig access key)_

```
curl -sL https://raw.githubusercontent.com/draios/sysdig-cloud-scripts/master/agent_deploy/IBMCloud-Kubernetes-Service/install-agent-k8s.sh | bash -s -- -a **<ACCESS_KEY>** -c ingest.us-south.monitoring.cloud.ibm.com -ac 'sysdig_capture_enabled: false'
```

> Alternatively, you may deploy the Sysdig agent manually by following the instructions [here](https://cloud.ibm.com/docs/services/Monitoring-with-Sysdig/config_agent.html#kube_manually).

![](https://cdn-images-1.medium.com/max/891/1*bokInzlndbLxoptWP0PAMQ.png)

- To confirm the successful creation of Sysdig agent on every worker node in the cluster, run the below command

```
kubectl get pods -n ibm-observe
```

![](https://cdn-images-1.medium.com/max/1024/1*7PiwKbZ3YB4X9Dbfa-vfeQ.png)

### Monitor your cluster

Let’s monitor our Kubernetes cluster running your app on Knative.To do this, click **View Sysdig** and you should see the sysdig monitor wizard.

- On the welcome page, click  **Next.**
- Choose **Kubernetes** as your installation method under set up environment.

![](https://cdn-images-1.medium.com/max/1024/1*Nqgp2OdZjv3d3SToDBX2Ug.png)

- Once your nodes are connected, you are ready to go. Your cluster will be scanned for Infrastructure and integrations.

![](https://cdn-images-1.medium.com/max/1024/1*rTOyTVo0PlK05_heru-1Jg.png)

- You can monitor your cluster in the **EXPLORE** view that is available through the Web UI. This view is the starting point to troubleshoot and monitor your infrastructure. It is the default homepage of the Web UI for users.
- On the EXPLORE view, You can see all the namespaces in your cluster and check various dashboards and metrics with a bundle of information including the Health of your nodes, deployments, pods, services etc.,

![](https://cdn-images-1.medium.com/max/1024/1*NQcQ_PiDqRyGYI919rYSXw.png)

![](https://cdn-images-1.medium.com/max/1024/1*kfqbdpnlLzVZcPQp-A72qQ.png)

- We need to generate some traffic/load and there are many open source libraries/tools available. In the post, we will be using [Vegeta](https://github.com/tsenart/vegeta), an HTTP load testing tool and library. You can also use [hey](https://github.com/rakyll/hey).
- Before generating the load, let’s quickly check whether the IP_ADDRESS and HOST_URL are set properly while deploying the app.

```
echo $IP_ADDRESS

echo $HOST_URL
```

After installing [Vegeta](https://github.com/tsenart/vegeta/releases), run the below command

```
echo “GET [http://${IP_ADDRESS](http://%24%7BIP_ADDRESS)}" | vegeta attack -duration=300s -header “Host: ${HOST_URL}” | tee results.bin | vegeta report
 vegeta report -type=json results.bin > metrics.json
 cat results.bin | vegeta plot > plot.html
 cat results.bin | vegeta report -type=”hist[0,100ms,200ms,300ms]”
```

You can open the _plot.html_ file in the folder you have run the above command to see the Vegeta plot

![](https://cdn-images-1.medium.com/max/1024/1*hJuS-5X0DGHwTc1mXvVj5Q.png)

Once you start sending a load of HTTP requests, it’s time to check the dashboards.

Use dashboards to monitor your infrastructure, applications, and services. You can use pre-defined dashboards. You can also create custom dashboards through the Web UI or programmatically. You can backup and restore dashboards by using Python scripts.

> A **dashboard** shows groups of metrics that report on the health, performance, and state of your infrastructure, applications, and services for a single host or a group of hosts. Dashboards offer a specialized insight into network data, application data, topology, services, hosts, and containers.

- Click **DASHBOARDS** on the left pane and select HTTP overview under My Shared Dashboards. You should see the Request Count and other metrics.

![](https://cdn-images-1.medium.com/max/1024/1*tdPTFzUI8KJYf_ByLp_6Xw.png)

- Feel free to change the way you want to see….

![](https://cdn-images-1.medium.com/max/1024/1*lZqnCawqF9sxB44Gwl-f_g.png)

- Here’s an overview by Container

![](https://cdn-images-1.medium.com/max/1024/1*27z1ugYu9TjhiRLjiGzCFg.png)

> What we have seen is just the tip of an iceberg, To dig deeper into dashboards, [**read this**](https://cloud.ibm.com/docs/services/Monitoring-with-Sysdig/dashboards.html#dashboards)

You can also learn about alerts. For more information, see [Working with alerts](https://console.bluemix.net/docs/services/Monitoring-with-Sysdig/monitoring.html#alerts).

### Autoscaling in action

Let’s check the autoscaling feature of Knative in a Sysdig dashboard real-time. Before making a Vegeta attack, this is the deployment state of Kubernetes default namespace. If you observe closely there’s no knative-node-app pods.

> No. of Pods = 3 are logdna pods.

Don’t forget to set on the refresh time to 10 S on the LIVE panel in the bottom of the page.

![](https://cdn-images-1.medium.com/max/1024/1*l6KEm4m30b0isXqBdLNEEQ.png)

Once we make a Vegeta attack say for 60 seconds, this is what you will see, a new **knative-node-app-00001-deployment** scaled to 3 pods to take the concurrent requests. After the load goes down, it will return to the

![](https://cdn-images-1.medium.com/max/1024/1*98X7ShrWutNr7ndTJYF0RA.png)

**Questions or concerns? Please don’t hesitate to reach out to me on Twitter:** [**VidyasagarMSC**](https://twitter.com/VidyasagarMSC)

## Further reading

- [Knative Docs](https://github.com/knative/docs)
- Knative [Monitoring](https://medium.com/@VidyasagarMSC/knative-monitoring-with-grafana-zipkin-weavescope-other-plugins-30a2d8d20344)

* * *