Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

TOP 20 INTERVIEW QUESTION FOR PROMETHEUS AND GRAFANA

Interview questions for Grafana:-

1.What is Grafana?

Grafana helps us by allowing us to query, visualization, alert and explore our metrics no matter where they are stored, it also helps in providing us with the tools for turning our time series database data into the beautiful graphs and visualizations.

2.What is a Grafana Dashboard?

Grafana Dashboard contains data form the plugged-in data sources like Graphite, Prometheus, Influx DB, ElasticSearch, MySQL, PostgreSQL, etc.The dashboard contains a gamut of visualization optins such as geo maps, heat maps, histograms, all the variety of charts & graphs which a business typically requires to study data.It also can contain different individual panels on the grid, and each panel has different functionalities.

3.What is Grafana Cloud?

Grafana Cloud is highly available, fast fully managed and an open SaaS software as a service metrics platform.I takes the load of hosting the solution on prem and helps in free managing the entire development infrastructure and it runs on Kubernetes clusters.

4.What types of Monitoring can be done via Grafana?

There are 4 tyes of Monitoring that can be done by Grafana are:

CPU

Disk Space

Memory

Top Process

5.How to set up Grafana so that no password is necessary to view dashboards?

[auth.anonymous]

# enable anonymous access

enabled = true

[auth.basic]

enabled = false

# The full public facing url

root_url = %(protocol)s://%(domain)s:%(http_port)s/

What are the 2 types of alerting in Grafana?

The 2 types of Grafana are as follows:

Alert Rule – helps in defining conditions which are regurlarly evaluated by Grafana.

Notification Channel – helps in notifying the channels which are configured for the alerts.

6.How to import custom dashboards to grafana using help?

{{- $files := .Files.Glob “dashboards/*.json” }}

{{- if $files }}

apiVersion: v1

kind: ConfigMapList

items:

{{- range $path, $fileContents := $files }}

{{- $dashboardName := regexReplaceAll “(^.*/)(.*)\\.json$” $path “2” }}

– apiVersion: v1

  kind: ConfigMap

  metadata:

    name: {{ printf “%s-%s” (include “prometheus-operator.fullname” $) $dashboardName | trunc 63 | trimSuffix “-” }}

    namespace: {{ template “prometheus-operator.namespace” . }}

    labels:

      {{- if $.Values.grafana.sidecar.dashboards.label }}

      {{ $.Values.grafana.sidecar.dashboards.label }}: “1”

      {{- end }}

 app: {{ template “prometheus-operator.name” $ }}-grafana

{{ include “prometheus-operator.labels” $ | indent 6 }}

  data:

    {{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}

{{- end }}

{{- end }}

7.How can we completely uninstall grafana?

sudo apt-get remove –auto-remove grafana

sudo apt-get purge –auto-remove grafana

sudo apt-get autoclean

sudo apt-get autoremove

locate grafana and manually remove files and folder

Prometheus Interview question:-

1.What is Prometheus?

Prometheus is developed at soundcloud and integrated into the CNCF, it has the ability for creating user specific customs alerts and notifications which is based on the data through metrics.

Prometheus is also used for running ad-hoc queries and minor issues during debugging, its aspect is utilized when integrating with visualization backends.

2.How to persist data in Prometheus running in a Docker container?

For using this line instead of what you have in your command:

–volume a-new-volume:/prometheus \

3.How can we join two metrics in a Prometheus query?

We can use the consul exporter for ingesting the health and status of our service in Prometheus and the fire alerts when the status of services and nodes in Consul is critical.

We can join metrics by using the following command:

(

  max(consul_health_service_status{status=”critical”})

  by (service_name,status,node) == 1

)

   + on(service_name,node) group_left(env)

(

   0 * consul_service_tags

)

4.How to calculate containers’ cpu usage in kubernetes with prometheus as monitoring?

We can get the CPU usage at cluster level by:

sum (rate (container_cpu_usage_seconds_total{id=”/”}[1m])) / sum (machine_cpu_cores) * 100

We can track the CPU usage by using:

sum (rate (container_cpu_usage_seconds_total{image!=””}[1m])) by (pod_name)

5.How can we group labels in a Prometheus query?

We can use the label replace to group all the misc together:

sum by (new_group) (

  label_replace(

    label_replace(my_metric, “new_group”, “$1”, “group”, “.+”),

    “new_group”, “misc”, “group”, “misc group.+”

  )

)

6.How to use the selected period of time in a query?

We can use the $__interval variable like this:

use the $__interval variable like this:

7.How can we increase Prometheus storage retention?

We can config the retention by using the following code:

[Unit]

Description=Prometheus

Wants=network-online.target

After=network-online.target

[Service]

User=prometheus

Group=prometheus

Type=simple

ExecStart=/usr/local/bin/prometheus \

    –config.file /etc/prometheus/prometheus.yml \

    –storage.tsdb.path /var/lib/prometheus/ \

    –web.console.templates=/etc/prometheus/consoles \

    –web.console.libraries=/etc/prometheus/console_libraries \

    –web.external-url=http://34.89.26.156:9090 \

    –storage.tsdb.retention.time=1y

[Install]

WantedBy=multi-user.target

8.How can we gracefully avoid divide by zero in Prometheus?

rate({__name__=”hystrix_command_latency_total_seconds_sum”}[60s])

rate({__name__=”hystrix_command_latency_total_seconds_count”}[60s])

9.How to add extra label to Prometheus metrics?

We can use the following command for adding the extra label:

mongodb_exporter_last_scrape_duration_seconds{instance=”127.0.0.1:9216″,job=”mongo”}

If we need to chande the label we can use the following command:

mongodb_exporter_last_scrape_duration_seconds{cluster=”stage”, instance=”127.0.0.1:9216″,job=”mongo”} 

Rajesh Kumar
Follow me
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x