Monitor your CentOS stack with Prometheus

Julien Pivotto
Julien PivottoOpen Source Consultant at Inuits
Monitor your CentOS stack with
Prometheus
Julien Pivotto (@roidelapluie)
CERN
February 20st, 2019
user{name="roidelapluie"} 1
I like Open Source
I like monitoring
I like automation
... and all of that is my daily job at inuits
Traditional sysadmin-style
monitoring
Disk is full
No zombie processes
not 100 user connected
ssh works
swap is empty
Questions that come after:
It's up but it is performant?
It's down but for everyone?
Its is degraded but are the users impacted?
Is it even relevant?
Metrics Monitoring
e.g. traditionally graphite
Gather fine grained data at frequent interval
Make them useful by labelling them ; store
them
Analyze them to understand what is going on
Metrics ARE PART OF
monitoring
Do not maintain a metrics + a "traditional
monitoring" stack
Alert from metrics directly!
Monitoring source
Metrics
then Logs
then Spans (opentracing)
We are in the cloud era.
Here are some buzzwords for you
cloud, API, openstack, devops, docker, bimodal,
stateless, kubernetes, orchestration, automation,
serverless, docker, humanops, ansible, continuous
deployment, cri-o, jenkins, agile, docker, red hat,
containers, virtualization, provisionning, monitoring,
observability...
What is the cloud
Scale
Velocity
Change
On Premise looks like the
cloud
Nowadays you have no choice.
Scale
Velocity
Change
What are the needs
Automation
Scalability
Bye bye
all-in-one tools
tools that don't scale
tools you can not automate
We need deserve better tools
Our customers ask us to respond fast, in
seconds
We make hundreds of operations per second
What is your monitoring frequency... 5
minutes?
Time to get better tools /
protocols
Prometheus
https://prometheus.io/
Cloud Native
Easy to configure, deploy, maintain
Designed in multiple services
Container ready
Orchestration ready (dynamic config)
Fuzziness
Data Centric
A Metric in Prometheus has metadata:
myql_global_status_handlers_total{handler="tmp_write"} 1122
And lots of function to filter, change, remove...
those metadata while fetching them.
=> OpenMetrics.io
Open Source
Apache 2.0
Go
Support for multiple OS
Many "exporters":
https://github.com/prometheus/prometheus/wiki/Default-
port-allocations
Simple
1 service = 1 things
Takes care of its db (time based retention
and/or disk space based retention)
RPM
https://github.com/openshift/prometheus/blob/
master/golang-github-prometheus-
prometheus.spec (I have not tested it)
https://github.com/lest/prometheus-rpm
How does it work?
How does it work?
How does it work?
How does it work?
How does it work?
Exporters
Exporters expose metrics with an HTTP API
Bindings available for many languages
Exporters do not save data ; they are not
"proxies" and don't "cache" anything
Exploring Metrics
Exploring Metrics
Exploring Metrics
Exploring Metrics
PromQL
mysql_global_status_commands_total
PromQL
mysql_global_status_commands_total{command="select"}
PromQL
mysql_global_status_commands_total
{command=~"select|set_options"}
PromQL
mysql_global_status_commands_total{command=~"select|se
t_options"}
PromQL
deriv(mysql_global_status_connections[5m])
PromQL
{__name__=~".+innodb.+cache.*"}
predict_linear(mysql_heartbeat_lag_seconds[5m], 60*2)
sum(rate(mysql_global_status_commands_total{command=~"
(commit|rollback)"}[5m])) without (command)
Demo
prometheus
node_exporter + file collector
pushgateway
within openshift
Pushing metrics
Short lived batches can send metrics to a
"pushgateway"
Pushgateway is a project maintained by the
prometheus maintainers
Alerting
Prometheus has recording rules
Record frequent queries or alerting
Alert base on any PromQL queries.
One tool does one job...
Prometheus collects data
Exporters expose data
Grafana graphes data
Alertmanager dispatches alerts
Alertmanager
Open Source
Same developers as Prometheus
Second service
What is the Alertmanager
doing?
Receives alerts
Group them
Inhibits them
Dispatches them
Deals with HA
How to alerts?
Email
Some vendors: Slack, Hipchat, VictorOps,
pagerduty, ...
Generic Webhook -> Plug in anything you want
High Availability
2 prometheus servers do exact the same job
They send alerts to Alertmanagers
Alertmanagers are clustered not to send the
same notification twice
Monitor your CentOS stack with Prometheus
Grafana
Open Source (Apache 2.0)
Web app
Specialized in visualization
Pluggable
Multiple datasources: prometheus, graphite,
influxdb...
Has an API!
History of Grafana
Grafana is a fork of Kibana 3 ; used to be JS-
Driven.
Now fully featured, requires a database, multi-
projects/users support, etc...
Grafana and Prometheus
Prometheus shipped its own consoles
Now it recommends Grafana and deprecated
its own consoles
Grafana Dashboards
Grafana Dashboards
Time Picker
Configure Prometheus in
Grafana
Configure Prometheus in
Grafana
Prometheus Dashboard
Creating Grafana Dashboards
Takes time
Requires deep knowledge of the tools
Improved over time
Easy to share (json + online library)
Try grafonnet-lib!
Conclusion
Lots of data that can be explored in many ways
(subqueries are coming)
Trends and deviations are easy to calculate
Can monitor both business and technical
Very convenient to monitor any kind of stack
Conclusion
Open Source
Multiple small pieces
Rich ecosystem
For Cloud and On Premise
Julien Pivotto
roidelapluie
roidelapluie@inuits.eu
Inuits
https://inuits.eu
info@inuits.eu
Contact
I will give a
prometheus
workshop
at OSMC.de
2019!
1 of 58

More Related Content

What's hot(20)

Eclipse MicroProfile para el desarrollador ocupadoEclipse MicroProfile para el desarrollador ocupado
Eclipse MicroProfile para el desarrollador ocupado
Víctor Leonel Orozco López1.1K views
Eclipse MicroProfile metrics: Practical use casesEclipse MicroProfile metrics: Practical use cases
Eclipse MicroProfile metrics: Practical use cases
Víctor Leonel Orozco López555 views
Rx java in actionRx java in action
Rx java in action
Pratama Nur Wijaya910 views
Reactive Java (33rd Degree)Reactive Java (33rd Degree)
Reactive Java (33rd Degree)
Tomasz Kowalczewski26K views
It's always your faultIt's always your fault
It's always your fault
Przemek Jakubczyk305 views
Introduction to Retrofit and RxJavaIntroduction to Retrofit and RxJava
Introduction to Retrofit and RxJava
Fabio Collini5.6K views
Principios básicos de Garbage Collector en JavaPrincipios básicos de Garbage Collector en Java
Principios básicos de Garbage Collector en Java
Víctor Leonel Orozco López472 views
Celery with pythonCelery with python
Celery with python
Alexandre González Rodríguez9.1K views
Introduction to Python CeleryIntroduction to Python Celery
Introduction to Python Celery
Mahendra M4.6K views

Similar to Monitor your CentOS stack with Prometheus(20)

Introduction to PrometheusIntroduction to Prometheus
Introduction to Prometheus
Julien Pivotto6.7K views
MySQL Monitoring Shoot OutMySQL Monitoring Shoot Out
MySQL Monitoring Shoot Out
Kris Buytaert5.4K views
OpenTelemetry 101 FTWOpenTelemetry 101 FTW
OpenTelemetry 101 FTW
NGINX, Inc.61 views
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys Admins
Puppet5.3K views
Managing Postgres with AnsibleManaging Postgres with Ansible
Managing Postgres with Ansible
Gulcin Yildirim Jelinek4.3K views
Five android architectureFive android architecture
Five android architecture
Tomislav Homan586 views
Backtrack Manual Part8Backtrack Manual Part8
Backtrack Manual Part8
Nutan Kumar Panda1.2K views

More from Julien Pivotto(20)

The O11y ToolkitThe O11y Toolkit
The O11y Toolkit
Julien Pivotto35 views
What's new in Prometheus?What's new in Prometheus?
What's new in Prometheus?
Julien Pivotto15 views
Introduction to Grafana LokiIntroduction to Grafana Loki
Introduction to Grafana Loki
Julien Pivotto187 views
Why you should revisit mgmtWhy you should revisit mgmt
Why you should revisit mgmt
Julien Pivotto10 views
Prometheus and TLS - an IntroductionPrometheus and TLS - an Introduction
Prometheus and TLS - an Introduction
Julien Pivotto15 views
Powerful graphs in GrafanaPowerful graphs in Grafana
Powerful graphs in Grafana
Julien Pivotto12 views
YAML MagicYAML Magic
YAML Magic
Julien Pivotto4.3K views
HAProxy as Egress ControllerHAProxy as Egress Controller
HAProxy as Egress Controller
Julien Pivotto2.8K views
SIngle Sign On with KeycloakSIngle Sign On with Keycloak
SIngle Sign On with Keycloak
Julien Pivotto10K views
JsonnetJsonnet
Jsonnet
Julien Pivotto834 views
Grafonnet, grafana dashboards as codeGrafonnet, grafana dashboards as code
Grafonnet, grafana dashboards as code
Julien Pivotto4.1K views

Recently uploaded(20)

The Research Portal of Catalonia: Growing more (information) & more (services)The Research Portal of Catalonia: Growing more (information) & more (services)
The Research Portal of Catalonia: Growing more (information) & more (services)
CSUC - Consorci de Serveis Universitaris de Catalunya59 views
Java Platform Approach 1.0 - Picnic MeetupJava Platform Approach 1.0 - Picnic Meetup
Java Platform Approach 1.0 - Picnic Meetup
Rick Ossendrijver24 views
METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...
METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...
Prity Khastgir IPR Strategic India Patent Attorney Amplify Innovation24 views
ChatGPT and AI for Web DevelopersChatGPT and AI for Web Developers
ChatGPT and AI for Web Developers
Maximiliano Firtman161 views

Monitor your CentOS stack with Prometheus