SlideShare a Scribd company logo
1 of 17
How-To Go
The Extra Mile
on Monitoring
Grafana + Prometheus + JMX
+ PushGateway
Introduction
With this presentation, you will be able get even more metrics from your
Cluster/Applications.
Pre-Assumptions
1. Grafana Installed
2. Prometheus Installed
JMX
Create and Download JMX Exporter Directory
sudo mkdir -p /opt/jmx-exporter;
sudo cd /opt/jmx-exporter;
sudo wget
https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.15.0/jmx_prometheus_javaagent-
0.15.0.jar;
Note: just need to change the highlighted values for your own values.
JMX - Use Case Kafka
Download Kafka YML
sudo cd /opt/jmx-exporter;
wget https://github.com/prometheus/jmx_exporter/blob/master/example_configs/kafka-2_0_0.yml;
mv kafka-2_0_0.yml kafka_broker.yml;
[Cloudera] CM - Kafka Configuration (broker_java_opts)
-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -
javaagent:/opt/prometheus/jmx_prometheus_javaagent-0.15.0.jar=7072:/opt/prometheus/kafka_broker.yml
Restart Service and Check HTTP Metrics
Note: just need to change the highlighted values for your own values.
JMX - Use Case Kafka
Add Job to Prometheus Config YML
sudo nano /etc/prometheus/prometheus.yml;
- job_name: 'kafka_jmx'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'
scrape_interval: 5s
static_configs:
- targets: ['10.111.22.33:7072']
Restart Prometheus Service
sudo systemctl restart prometheus;
Note: just need to change the highlighted values for your own values.
JMX - Use Case NiFi
Create NiFi Metrics Config YML
sudo nano /usr/hdp/nifi/conf/nifi.yml;
lowercaseOutputLabelNames: true
lowercaseOutputName: true
rules:- pattern: ".*"
Add to Nifi Bootstrap Config File
sudo nano /usr/hdp/nifi/conf/bootstrap.conf; java.arg.18=-javaagent:/opt/jmx-exporter/jmx_prometheus_javaagent-
0.15.0.jar=7474:/usr/hdp/nifi/conf/nifi.yml
Note: java.arg.XX the XX value should be unique!
Restart Prometheus Service
sudo systemctl restart prometheus;
Note: just need to change the highlighted values for your own values.
Add Job to Prometheus Config YML
sudo nano /etc/prometheus/prometheus.yml;
- job_name: 'nifi_jmx'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'
scrape_interval: 5s
static_configs:
- targets: ['10.111.22.44:7474']
PushGateway
Download PushGateway
sudo cd /u01/downloads;
sudo wget https://github.com/prometheus/pushgateway/releases/download/v1.4.0/pushgateway-1.4.0.linux-amd64.tar.gz;
sudo tar xvzf pushgateway-1.4.0.linux-amd64.tar.gz && mv pushgateway-1.4.0.linux-amd64/pushgateway
/usr/local/bin/pushgateway;
PushGateway
Create User
sudo useradd -m -s /bin/false pushgateway && id pushgateway;
sudo chown pushgateway:pushgateway /usr/local/bin/pushgateway;
Create User
sudo nano /etc/prometheus/prometheus.yml;
global:
scrape_interval: 1s
scrape_configs:
- job_name: 'pushgateway'
honor_labels: true
Static_configs:
- targets: ['10.111.22.33:9091']
Adjust the firewall
sudo firewall-cmd --add-port=9091/tcp --permanent && firewall-cmd --reload;
Note: just need to change the highlighted values for your own values.
PushGateway
Creating a Systemd service file for Prometheus Server
sudo nano /etc/systemd/system/pushgateway.service;
[Unit]
Description=Custom Metrics on PushGateway
Wants=network-online.target
After=network-online.target
[Service]
User=pushgateway
Group=pushgateway
Type=simple
ExecStart=/usr/local/bin/pushgateway 
--web.listen-address=:9091 
--web.enable-admin-api 
--web.telemetry-path=/metrics 
--persistence.file=/tmp/metric.store 
--persistence.interval=5m
[Install]
WantedBy=multi-user.target
Note: just need to change the highlighted values for your own values.
PushGateway
Reload the Systemctl
sudo systemctl daemon-reload;
Now start and enable Prometheus to run on boot
sudo systemctl start pushgateway && sudo systemctl enable pushgateway;
Confirm Pushgateway is UP
sudo netstat -tunlp | grep pushgateway;
Note: just need to change the highlighted values for your own values.
PushGateway
Create Top Custom Metrics Script
sudo nano metricsTOP;
#!/bin/bash
# CPU Usage %
z=$(ps aux | grep -v '[' )
while read -r z
do
var=$var$(awk 'NR>1 {print "cpu_usage{user=""$1"" , pid=""$2"" , process=""$11"", arg=""$12" "$13" "$14" "$15"" }", $3z}');
done <<< "$z"
curl -X POST -H "Content-Type: text/plain" --data "$var
" http://localhost:9091/metrics/job/top/instance/hostname01
# Memory Usage Bytes
x=$(ps aux | grep -v '[' )
while read -r x
do
var2=$var2$(awk 'NR>1 {print "memory_usage{user=""$1"" , pid=""$2"" , process=""$11"", arg=""$12" "$13" "$14" "$15"" }", $6x}');
done <<< "$x"
curl -X POST -H "Content-Type: text/plain" --data "$var2
" http://localhost:9091/metrics/job/top/instance/hostname01
sudo chmod u+x metricsTOP && ./metricsTOP;
PushGateway
Create Crontab Job
sudo contrab -e;
* * * * * for i in {1..60}; do /path/metricsTOP & sleep 1; done
Create IOTop Custom Metrics Script
sudo nano metricsTOP;
* * * * * for i in {1..60}; do /path/metricsTOP & sleep 1; done
PushGateway
Create IOTop Custom Metrics Script
# IO Usage %
t=$(iotop -Pkqbn 1 | grep -v '[' )
while read -r t
do
var3=$var3$(awk 'NR>2 {print "iotop_usage{user=""$3"" , pid=""$1"" , stream="%" ,process=""$12"", arg=""$13" "$14" "$15" "$16"" }", $10}');
done <<< "$t"
curl -X POST -H "Content-Type: text/plain" --data "$var3
" http://localhost:9091/metrics/job/iotop/instance/hostname01
# IO Read Kbs
u=$(iotop -Pkqbn 1 | grep -v '[' )
while read -r u
do
var4=$var4$(awk 'NR>2 {print "iotop_read{user=""$3"" , pid=""$1"" , stream="read" ,process=""$12"", arg=""$13" "$14" "$15" "$16"" }", $4}');
done <<< "$u"
curl -X POST -H "Content-Type: text/plain" --data "$var4
" http://localhost:9091/metrics/job/iotop/instance/hostname01
# IO Write Kbs
v=$(iotop -Pkqbn 1 | grep -v '[' )
while read -r v
do
var5=$var5$(awk 'NR>2 {print "iotop_write{user=""$3"" , pid=""$1"" , stream="write" ,process=""$12"", arg=""$13" "$14" "$15" "$16"" }", $6}');
done <<< "$v"
curl -X POST -H "Content-Type: text/plain" --data "$var5
" http://localhost:9091/metrics/job/iotop/instance/hostname01
Note: just need to change the highlighted values for your own values.
Grafana
Grafana
Thanks
Big Data Engineer
Tiago Simões

More Related Content

What's hot

An example Hadoop Install
An example Hadoop InstallAn example Hadoop Install
An example Hadoop InstallMike Frampton
 
Hadoop installation
Hadoop installationHadoop installation
Hadoop installationAnkit Desai
 
Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2IMC Institute
 
Running hadoop on ubuntu linux
Running hadoop on ubuntu linuxRunning hadoop on ubuntu linux
Running hadoop on ubuntu linuxTRCK
 
Install and Configure Ubuntu for Hadoop Installation for beginners
Install and Configure Ubuntu for Hadoop Installation for beginners Install and Configure Ubuntu for Hadoop Installation for beginners
Install and Configure Ubuntu for Hadoop Installation for beginners Shilpa Hemaraj
 
Hadoop single node setup
Hadoop single node setupHadoop single node setup
Hadoop single node setupMohammad_Tariq
 
Automated infrastructure is on the menu
Automated infrastructure is on the menuAutomated infrastructure is on the menu
Automated infrastructure is on the menujtimberman
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點William Yeh
 
Automated Java Deployments With Rpm
Automated Java Deployments With RpmAutomated Java Deployments With Rpm
Automated Java Deployments With RpmMartin Jackson
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopLorin Hochstein
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)Soshi Nemoto
 
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기Ji-Woong Choi
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012Carlos Sanchez
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksCarlos Sanchez
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe BookTim Riley
 
Multinode kubernetes-cluster
Multinode kubernetes-clusterMultinode kubernetes-cluster
Multinode kubernetes-clusterRam Nath
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)Soshi Nemoto
 

What's hot (20)

An example Hadoop Install
An example Hadoop InstallAn example Hadoop Install
An example Hadoop Install
 
Hadoop installation
Hadoop installationHadoop installation
Hadoop installation
 
Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2
 
Hadoop on ec2
Hadoop on ec2Hadoop on ec2
Hadoop on ec2
 
Running hadoop on ubuntu linux
Running hadoop on ubuntu linuxRunning hadoop on ubuntu linux
Running hadoop on ubuntu linux
 
Install and Configure Ubuntu for Hadoop Installation for beginners
Install and Configure Ubuntu for Hadoop Installation for beginners Install and Configure Ubuntu for Hadoop Installation for beginners
Install and Configure Ubuntu for Hadoop Installation for beginners
 
Hadoop single node setup
Hadoop single node setupHadoop single node setup
Hadoop single node setup
 
Automated infrastructure is on the menu
Automated infrastructure is on the menuAutomated infrastructure is on the menu
Automated infrastructure is on the menu
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點Ansible 實戰:top down 觀點
Ansible 實戰:top down 觀點
 
Automated Java Deployments With Rpm
Automated Java Deployments With RpmAutomated Java Deployments With Rpm
Automated Java Deployments With Rpm
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)DevOps(3) : Ansible - (MOSG)
DevOps(3) : Ansible - (MOSG)
 
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
 
Multinode kubernetes-cluster
Multinode kubernetes-clusterMultinode kubernetes-cluster
Multinode kubernetes-cluster
 
Hadoop completereference
Hadoop completereferenceHadoop completereference
Hadoop completereference
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 

Similar to Monitoring Extra Mile Grafana Prometheus JMX PushGateway

Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with CapistranoRamazan K
 
Continuous delivery with docker
Continuous delivery with dockerContinuous delivery with docker
Continuous delivery with dockerJohan Janssen
 
Web Applications with Eclipse RT and Docker in the Cloud
Web Applications with Eclipse RT and Docker in the CloudWeb Applications with Eclipse RT and Docker in the Cloud
Web Applications with Eclipse RT and Docker in the CloudMarkus Knauer
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
Plone deployment made easy
Plone deployment made easyPlone deployment made easy
Plone deployment made easyKim Chee Leong
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_trainingvideos
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetOmar Reygaert
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
 
Tensorflow in Docker
Tensorflow in DockerTensorflow in Docker
Tensorflow in DockerEric Ahn
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis OverviewLeo Lorieri
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newYiwei Ma
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...Puppet
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configurationlutter
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Yiwei Ma
 
Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 DevelopmentDuke Dao
 
Free radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleFree radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleChanaka Lasantha
 
DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDocker, Inc.
 

Similar to Monitoring Extra Mile Grafana Prometheus JMX PushGateway (20)

Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Continuous delivery with docker
Continuous delivery with dockerContinuous delivery with docker
Continuous delivery with docker
 
Web Applications with Eclipse RT and Docker in the Cloud
Web Applications with Eclipse RT and Docker in the CloudWeb Applications with Eclipse RT and Docker in the Cloud
Web Applications with Eclipse RT and Docker in the Cloud
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Plone deployment made easy
Plone deployment made easyPlone deployment made easy
Plone deployment made easy
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training
 
Docker
DockerDocker
Docker
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 
Nodejs in Production
Nodejs in ProductionNodejs in Production
Nodejs in Production
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Docker practice
Docker practiceDocker practice
Docker practice
 
Tensorflow in Docker
Tensorflow in DockerTensorflow in Docker
Tensorflow in Docker
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册
 
Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 Development
 
Free radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleFree radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmaple
 
DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker Captains
 

Recently uploaded

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Monitoring Extra Mile Grafana Prometheus JMX PushGateway

  • 1. How-To Go The Extra Mile on Monitoring Grafana + Prometheus + JMX + PushGateway
  • 2. Introduction With this presentation, you will be able get even more metrics from your Cluster/Applications.
  • 4. JMX Create and Download JMX Exporter Directory sudo mkdir -p /opt/jmx-exporter; sudo cd /opt/jmx-exporter; sudo wget https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.15.0/jmx_prometheus_javaagent- 0.15.0.jar; Note: just need to change the highlighted values for your own values.
  • 5. JMX - Use Case Kafka Download Kafka YML sudo cd /opt/jmx-exporter; wget https://github.com/prometheus/jmx_exporter/blob/master/example_configs/kafka-2_0_0.yml; mv kafka-2_0_0.yml kafka_broker.yml; [Cloudera] CM - Kafka Configuration (broker_java_opts) -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false - javaagent:/opt/prometheus/jmx_prometheus_javaagent-0.15.0.jar=7072:/opt/prometheus/kafka_broker.yml Restart Service and Check HTTP Metrics Note: just need to change the highlighted values for your own values.
  • 6. JMX - Use Case Kafka Add Job to Prometheus Config YML sudo nano /etc/prometheus/prometheus.yml; - job_name: 'kafka_jmx' # metrics_path defaults to '/metrics' # scheme defaults to 'http' scrape_interval: 5s static_configs: - targets: ['10.111.22.33:7072'] Restart Prometheus Service sudo systemctl restart prometheus; Note: just need to change the highlighted values for your own values.
  • 7. JMX - Use Case NiFi Create NiFi Metrics Config YML sudo nano /usr/hdp/nifi/conf/nifi.yml; lowercaseOutputLabelNames: true lowercaseOutputName: true rules:- pattern: ".*" Add to Nifi Bootstrap Config File sudo nano /usr/hdp/nifi/conf/bootstrap.conf; java.arg.18=-javaagent:/opt/jmx-exporter/jmx_prometheus_javaagent- 0.15.0.jar=7474:/usr/hdp/nifi/conf/nifi.yml Note: java.arg.XX the XX value should be unique! Restart Prometheus Service sudo systemctl restart prometheus; Note: just need to change the highlighted values for your own values. Add Job to Prometheus Config YML sudo nano /etc/prometheus/prometheus.yml; - job_name: 'nifi_jmx' # metrics_path defaults to '/metrics' # scheme defaults to 'http' scrape_interval: 5s static_configs: - targets: ['10.111.22.44:7474']
  • 8. PushGateway Download PushGateway sudo cd /u01/downloads; sudo wget https://github.com/prometheus/pushgateway/releases/download/v1.4.0/pushgateway-1.4.0.linux-amd64.tar.gz; sudo tar xvzf pushgateway-1.4.0.linux-amd64.tar.gz && mv pushgateway-1.4.0.linux-amd64/pushgateway /usr/local/bin/pushgateway;
  • 9. PushGateway Create User sudo useradd -m -s /bin/false pushgateway && id pushgateway; sudo chown pushgateway:pushgateway /usr/local/bin/pushgateway; Create User sudo nano /etc/prometheus/prometheus.yml; global: scrape_interval: 1s scrape_configs: - job_name: 'pushgateway' honor_labels: true Static_configs: - targets: ['10.111.22.33:9091'] Adjust the firewall sudo firewall-cmd --add-port=9091/tcp --permanent && firewall-cmd --reload; Note: just need to change the highlighted values for your own values.
  • 10. PushGateway Creating a Systemd service file for Prometheus Server sudo nano /etc/systemd/system/pushgateway.service; [Unit] Description=Custom Metrics on PushGateway Wants=network-online.target After=network-online.target [Service] User=pushgateway Group=pushgateway Type=simple ExecStart=/usr/local/bin/pushgateway --web.listen-address=:9091 --web.enable-admin-api --web.telemetry-path=/metrics --persistence.file=/tmp/metric.store --persistence.interval=5m [Install] WantedBy=multi-user.target Note: just need to change the highlighted values for your own values.
  • 11. PushGateway Reload the Systemctl sudo systemctl daemon-reload; Now start and enable Prometheus to run on boot sudo systemctl start pushgateway && sudo systemctl enable pushgateway; Confirm Pushgateway is UP sudo netstat -tunlp | grep pushgateway; Note: just need to change the highlighted values for your own values.
  • 12. PushGateway Create Top Custom Metrics Script sudo nano metricsTOP; #!/bin/bash # CPU Usage % z=$(ps aux | grep -v '[' ) while read -r z do var=$var$(awk 'NR>1 {print "cpu_usage{user=""$1"" , pid=""$2"" , process=""$11"", arg=""$12" "$13" "$14" "$15"" }", $3z}'); done <<< "$z" curl -X POST -H "Content-Type: text/plain" --data "$var " http://localhost:9091/metrics/job/top/instance/hostname01 # Memory Usage Bytes x=$(ps aux | grep -v '[' ) while read -r x do var2=$var2$(awk 'NR>1 {print "memory_usage{user=""$1"" , pid=""$2"" , process=""$11"", arg=""$12" "$13" "$14" "$15"" }", $6x}'); done <<< "$x" curl -X POST -H "Content-Type: text/plain" --data "$var2 " http://localhost:9091/metrics/job/top/instance/hostname01 sudo chmod u+x metricsTOP && ./metricsTOP;
  • 13. PushGateway Create Crontab Job sudo contrab -e; * * * * * for i in {1..60}; do /path/metricsTOP & sleep 1; done Create IOTop Custom Metrics Script sudo nano metricsTOP; * * * * * for i in {1..60}; do /path/metricsTOP & sleep 1; done
  • 14. PushGateway Create IOTop Custom Metrics Script # IO Usage % t=$(iotop -Pkqbn 1 | grep -v '[' ) while read -r t do var3=$var3$(awk 'NR>2 {print "iotop_usage{user=""$3"" , pid=""$1"" , stream="%" ,process=""$12"", arg=""$13" "$14" "$15" "$16"" }", $10}'); done <<< "$t" curl -X POST -H "Content-Type: text/plain" --data "$var3 " http://localhost:9091/metrics/job/iotop/instance/hostname01 # IO Read Kbs u=$(iotop -Pkqbn 1 | grep -v '[' ) while read -r u do var4=$var4$(awk 'NR>2 {print "iotop_read{user=""$3"" , pid=""$1"" , stream="read" ,process=""$12"", arg=""$13" "$14" "$15" "$16"" }", $4}'); done <<< "$u" curl -X POST -H "Content-Type: text/plain" --data "$var4 " http://localhost:9091/metrics/job/iotop/instance/hostname01 # IO Write Kbs v=$(iotop -Pkqbn 1 | grep -v '[' ) while read -r v do var5=$var5$(awk 'NR>2 {print "iotop_write{user=""$3"" , pid=""$1"" , stream="write" ,process=""$12"", arg=""$13" "$14" "$15" "$16"" }", $6}'); done <<< "$v" curl -X POST -H "Content-Type: text/plain" --data "$var5 " http://localhost:9091/metrics/job/iotop/instance/hostname01 Note: just need to change the highlighted values for your own values.