💻
Cheet Sheets
  • 🦁Başlarken
  • 🟧DevOps Pre-Requisite
    • ❤️Why Linux? | Linux Basics #1
    • 💛Vi Editor | Linux Basics #2
    • 💙Basics Commands | Linux Basics #3
    • 🧡Package Managers | Linux Basics #4
    • 💚Services | Linux Basics #5
    • 💛Networking Basics
    • 🤎DNS Basics
    • 🩶Applications Basics
    • 🟨Java introduction
    • 🟩NodeJS Introduction
    • 🟦Python Introduction
    • 🟪GIT Introduction
    • 🟧Apache Web Server Introduction
    • ⬛Apache Tomcat
    • 🟫Python Flask
    • 🟥Node.js Express App
    • 🟨Databases
    • 🟩MySQL
    • 🟪MongoDB
    • 🟨SSL & TLS
    • 🟦YAML & JSON - JSON Path
    • ⬛Labs Resources
  • 🍎Kubernetes
    • 🍏Kubernetes: Nedir ?
    • 🍒Bileşenler
    • 🍵Kubectl ve Versiyon
    • ❤️Pod
    • 🏷️Label ve Selector
    • 🔎Annotation
    • 📲Namespaces
    • 📦Deployments
    • 🔁ReplicaSet
    • 🔙Rollout & Rollback
    • 🌐Networking - 1
    • 🌏Service
    • 🛠️Liveness Probe & Readiness Probe
    • 🥐Resource Limits
    • 💰Environment Variables
    • 📃Ephemeral Volumes
    • 🔑Secrets
    • 🌂ConfigMap
    • 🖥️Node Affinity
    • 🔌Pod Affinity
    • ✍️Taint and Toleration
    • 🔦DaemonSet
    • 🧀PV/PVC
    • 🌜Storage Class
    • 🗿StatefulSet
    • 🕹️Job & Cronjob
    • 🔐Authentication
    • 📏Role-based access control (RBAC)
    • 🈷️Service Account
    • 📈Ingress
    • 📂ImagePullPolicy & ImageSecret
    • 📖Static Pods
    • 🌐Network Policy
    • 🫐Helm Nedir?
    • 📽️Prometheus Stack - Monitoring
    • 💼EFK Stack - Monitoring
    • 🥳CRD & Operator
  • 🧑‍⚕️GIT & GITHUB
    • 👉Girizgah
    • 🌴Branch
    • 🤝Merge
    • 🤔Conflict - Rebase
    • 🇸🇴Alias
    • 🛑Gitignore
    • 🥢Diff
    • ◀️Checkout
    • 🔦Stash
    • 👉Other
  • ☁️AWS
    • 🪣S3
    • 🚙EC2
    • ⚖️ELB
    • 🤝Auto Scaling
    • 🗄️EFS
    • 🔐VPC
    • 🎆CloudFront
    • ❤️Route53
    • 🦈RDS
    • 🏢ElastiCache
    • 🔭CloudWatch
    • 👀CloudTrail
    • 📃CloudFormation
    • 🔕SNS
    • 📬SQS
    • 🎇SWF
    • 📧SES
    • 📦Kinesis
    • 📐AWSConfig
    • 👩‍🏭OpsWork
    • 🚀Lambda - Api Gateway
    • 📌ECS - EKS
    • 🔑KMS
    • 📂Directory Service
    • 🏐Snowball
    • 💾Storage Gateway
    • 💽Volume Gateway
    • 📼Tape Gateway
    • 🏠Organizations
    • 🔙Backup-Transfer-CloudShell
    • 🆔IAM
    • 📀DataSync
    • 🗃️FSx
    • 🎒Aurora Serverless
    • 🌐Global Accelerator
    • 💪HPC
    • 🎰Outposts
    • 🗼Others
  • 👨‍🔬Ansible
    • 👉Girizhah
    • 📔YAML
    • ⚙️Komponentler
    • 🎒Inventory
    • 🏑ad-hoc
    • ▶️Playbook
  • 👨‍⚕️PROMETHEUS
    • 📈Terminoloji
    • 🦯Ubuntu 20.04 Prometheus Kurulum
    • 🗒️prometheus.yml dosyasına ilk bakış:
    • 🧭promQL up query
    • 📇Exporters
    • 🔦promQL Data Types
    • 🦯Selectors & Matchers
    • 🔢Binary Operators
    • 💀ignoring and on
    • ✍️Aggregation Operators
    • 🧠Functions
    • 🖊️Alıştırma
    • 💻Client Libraries
    • 🐍Examining the data of our Python application
    • 🐐Examining the data of our GO application
    • ⏺️Recording Rules
    • 💡rate functions
    • ⏰Alerting
    • ⌚Alert Routing
    • ⏰Slack integration with Prometheus
    • 🤯PagerDuty integration with Prometheus
    • ◼️BlackBox exporter
    • 📍Push Gateway
    • 🪒Service Discovery
    • 🧊kube cadvisor with external prometheus
    • 👉aws with prometheus
    • ☁️CloudWatch Exporter
    • 👨‍🚒mysql exporter
    • 🛃Custom exporter with Python
    • ⚙️Prometheus with HTTP API
    • 🤖Prometheus Federation For Kubernetes
    • 📺Grafana
    • ⁉️Prometheus: Ne zaman kullanılmalı? Ne zaman kullanılmamalıdır?
  • 🍪Sheets
    • 🛳️Docker Sheets
    • 🐐Kube Sheets
  • 🔢12 Factor APP
    • 🏗️Introduction
    • 1️⃣Codebase
    • 2️⃣Dependencies
    • 3️⃣Concurrency
    • 4️⃣Processes
    • 5️⃣Backing Services
    • 6️⃣Config
    • 7️⃣Build, release, run
    • 8️⃣Port binding
    • 9️⃣Disposability
    • 🔟Dev/prod parity
    • 🕚Logs
    • 🕛Admin processes
  • ☁️Azure 104
    • 👨‍👨‍👧‍👧Azure Active Directory ( Entra ID )
    • 💰Subscriptions
    • 🌎Virtual Network (VNET)
    • 💻Virtual Machines
    • 🧑‍🌾Load Balancing
    • 🥍Network Advanced
    • 🪡Automating Deployment and Configuration
    • 💂Securing Storage
    • 📓Administering Azure Blobs and Azure Files
    • 🔧Managing Storage
    • 🎁App Service
    • 🛳️Azure Container
    • 🥇Backup And Recovery
    • 🪐Network Watcher
    • ⏰Resource Monitoring And Alerts
  • ⛅AZURE 305
    • 🆔identity and access management
    • 💼Desing Azure AD (Entra ID)
    • 👨‍💼Desing for Azure B2B
    • 🛃Desing for Azure B2C
    • 💳Design for MFA and Conditional Access
    • ⛑️Design for Identity Protection
    • 🚶Access Reviews
    • 🚦Managed identity Demostration
    • 🔐Key Vault Demostration
    • 👑Governance hierarchy
    • 💠Design for Management Groups
    • 🔑Desing for Subscriptions
    • 🍇Desing for resource groups
    • 📟Design for resource tags
    • 🚷Azure Policy & RBAC
    • 🫐Desing For Blueprints
    • 🪡Desing for Virtual Networks
    • 🛫Design for on-premises connectivity to Azure
    • 🔽Design for network connectivity
    • 📦Design for application delivery
    • 🥞Design for network security and application protection
    • 📕Choose a compute solution
    • 🌊Design for virtual machines
    • 🔋Azure Batch Demostration
    • 🛰️Design for Azure App Service
    • ⛲Design for Azure Container Instances
    • 🎢Design for Azure Kubernetes Service
    • 📠Azure Functions Demostration
    • 💪Azure Logic Apps Demostration
    • 🧑‍💼Design for data storage
    • 🎞️Design for Azure storage accounts
    • 🌟Choose the storage replication
    • 📹Azure blob storage - Lifecycle & immutable demo
    • 🥌Azure Files Demostration
    • 🕸️Design Azure disks
    • 🦼Design for storage security
    • 🔮Azure Table Storage And Cosmos DB Demostration
    • 🟧Azure SQL Solutions
    • 🎡Azure SQL Database - Purchasing models
    • 🕯️Database availability
    • 📜Data security strategy
    • 🧮Azure SQL Edge
    • 🚲Azure Data Factory
    • 🔅Azure Data Lake Storage
    • 🧘‍♂️Azure Databricks
    • 🎒Azure Synapse Analytics
    • 🅰️Azure Stream Analytics
    • 📼Data flow strategy
    • 🍥Cloud Adoption Framework
    • ☣️Azure Migration Framework
    • 🦿Assessing workloads
    • 🪡Migration tools
    • 🤖Azure Database migration
    • 👥Storage migration
    • 👜Azure Backup
    • ⏲️Azure Blob Backup and Recovery
    • 💈Azure files backup and recovery
    • 🎞️Azure VM backup and recovery
    • 🧺Azure SQL backup and recovery
    • ⏰Azure Site Recovery
    • 📩Differentiate event and message
    • ✈️Azure messaging solutions
    • 🚜Event Hub
    • 🥍Application optimization solution
    • 🎁Application lifecycle
    • 📺Azure Monitor
    • 🅱️Log Analytics
    • 👥Azure workbooks and Insights
    • 🚌Azure Data Explorer
  • Github Actions
    • Github Actions Nedir?
    • Workflow & Schedule Triggers
    • Single and Multiple Events
    • Manuel Events
    • Webhook Events
    • Conditional Keywords For Steps
    • Expressions - 1
    • Expressions - 2
    • Runners
    • Workflow Commands
    • Workflow Context
    • Dependent Jobs
    • Encrypted Secrets
    • Configuration Variables
    • Default & Custom Env Varb
    • Set Env Varb with Workflow Commands
    • Github Token Secret
    • Add Script to workflow
    • Push Package #1
    • Push Package #2 Docker
    • Service Containers
    • Routing workflow to runner
    • CodeQL Step
    • Caching Package and Dependency Files
    • Remove workflow Artifact
    • Workflow Status Badge
    • Env Protection
    • Job Matrix Configuration
    • Disable & Delete Workflows
    • Actions type for Action
    • Inputs and Outputs for actions
    • Action Versions
    • Files and Directories for Actions
    • Exit Codes
    • Reusable Workflow & Reuse Templates for Actions and Workflows
    • Configure Self Hosted Runners for Enterprise
  • Loki
    • What is Loki?
    • Architecture of Loki
    • Install Loki For Ubuntu
    • Install Promtail For Ubuntu
    • Querying Logs
    • Loki in Kubernetes
    • Deploying Loki in Kubernetes
    • Connecting to Grafana
    • Viewing Kubernetes logs
    • Promtail Customize & Pipeline
  • Ansible
    • Ansible Introduction
    • Introduction to Ansible Configuration Files
    • Ansible Inventory
    • Inventory Formats
    • Ansible Variables
    • Variable Types
    • Registering Variables and Variable Precedence
    • Variable Scoping
    • Magic Variables
    • Ansible Facts
    • Ansible Playbooks
    • Verifying Playbooks
    • Ansible lint
    • Ansible Conditionals
    • Ansible Conditionals based on facts, variables, re-use
    • Ansible Loops
    • Ansible Modules
    • Introduction to Ansible Plugins
    • Modules and Plugins Index
    • Introduction to Handlers
    • Ansible Roles
    • Ansible Collections
    • Introduction to Templating
    • Jinja2 Templates for Dynamic Configs
  • 🅰️Ansible Advanced
    • Playbook run options
    • Facts
    • Configuration files
Powered by GitBook
On this page

Was this helpful?

  1. PROMETHEUS

Ubuntu 20.04 Prometheus Kurulum

PreviousTerminolojiNextprometheus.yml dosyasına ilk bakış:

Last updated 2 years ago

Was this helpful?

  • Aşağıdaki komut ile iki adet dizin oluşturun:

/etc/prometheus dizini Prometheus konfigürasyon dosyaları için kullanılır. Bu dosyalar, Prometheus'un scrape edeceği hedeflerin tanımlarını içerir.

/var/lib/prometheus dizini, Prometheus'un depolama dizini olarak kullanılır. Prometheus, scrape ettiği metrikleri burada saklar.

sudo mkdir -p /etc/prometheus && sudo mkdir -p /var/lib/prometheus
  • Ardından aşağıdaki komutu çalıştırın, aşağıdaki komut iki işlemi gerçekleştirir:

    1. "wget" komutu, belirtilen URL'den Prometheus'un belirli bir sürümünü (2.43.0) indirir. "" adresindeki sıkıştırılmış Prometheus dosyalarını indirir.

    2. "tar" komutu, indirilen dosyayı açar. "-xvf" parametreleri, sıkıştırılmış dosyayı açmak ve çıktıları konsola göstermek için kullanılır. Bu işlem sonucunda, "prometheus-2.43.0.linux-amd64" dizini oluşturulur ve bu dizinde Prometheus uygulamasının çalıştırılması için gerekli dosyalar bulunur.

wget https://github.com/prometheus/prometheus/releases/download/v2.43.0/prometheus-2.43.0.linux-amd64.tar.gz && tar -xvf prometheus-2.43.0.linux-amd64.tar.gz
  • Ardından indirdiğimiz uygulama dosyaları içerisinde, ihtiyacımız olan dosyaları kullanıyoruz. Aşağıdaki komutu çalıştırıyoruz. Aşağıdaki komut;

    1. "cd" komutu, çalışma dizinini "prometheus-2.31.3.linux-amd64" dizinine değiştirir.

    2. "sudo mv prometheus promtool /usr/local/bin/" komutu, prometheus ve promtool dosyalarını /usr/local/bin/ dizinine taşır. Bu dizin, kullanıcıların yürütülebilir dosyalarını sakladığı bir sistem dizinidir.

    3. "sudo mv consoles/ console_libraries/ /etc/prometheus/" komutu, consoles ve console_libraries dizinlerini /etc/prometheus/ dizinine taşır. Bu dizinler, Prometheus'un grafik arayüzü için kullanılan dosyaları içerir.

    4. "sudo mv prometheus.yml /etc/prometheus/prometheus.yml" komutu, prometheus.yml dosyasını /etc/prometheus/ dizinine taşır. Bu dosya, Prometheus'un scrape edeceği hedeflerin ve scrape işlemleri için kullanılacak özelliklerin tanımlandığı dosyadır.

Bu işlemlerin sonucunda, Prometheus'un dosyaları ve konfigürasyon dosyaları, sistemde doğru konumlara taşınmış olur ve Prometheus uygulaması başlatılabilir hale gelir.

cd prometheus-2.31.3.linux-amd64 && sudo mv prometheus promtool /usr/local/bin/ && sudo mv consoles/ console_libraries/ /etc/prometheus/ && sudo mv prometheus.yml /etc/prometheus/prometheus.yml
  • Aşağıdaki komut ile, Prometheus ve promtool uygulamalarının sürüm numaralarını görüntülüyoruz.

    1. "prometheus --version" komutu, yüklü Prometheus sürümünün numarasını gösterir. Bu sürüm numarası, Prometheus'un çalıştığı sürüm hakkında bilgi verir.

    2. "promtool --version" komutu, yüklü promtool sürümünün numarasını gösterir. Promtool, Prometheus araç setinin bir parçasıdır ve konfigürasyon dosyalarının doğruluğunu kontrol etmek ve metric değerlerini test etmek için kullanılır.

Bu komutlar, Prometheus ve promtool'un doğru şekilde yüklendiğini ve çalıştırıldığını doğrulamak için kullanılabilir.

prometheus --version && promtool --version
  • Aşağıdaki komut ile, Prometheus için bir grup ve kullanıcı hesabı oluşturup ve bu hesapların gerekli dizinlere erişim haklarını ayarlıyoruz. Aşağıdaki komut;

    1. "sudo groupadd --system prometheus" komutu, "prometheus" adında bir sistem grubu oluşturur. Bu grup, yalnızca sistem hesapları tarafından kullanılabilir.

    2. "sudo useradd -s /sbin/nologin --system -g prometheus prometheus" komutu, "prometheus" adında bir sistem kullanıcısı oluşturur. Bu kullanıcı, sistemde bir oturum açamaz ve sadece "prometheus" grubuna aittir.

    3. "sudo chown -R prometheus:prometheus /etc/prometheus/ /var/lib/prometheus/" komutu, /etc/prometheus/ ve /var/lib/prometheus/ dizinlerinin sahibini "prometheus" kullanıcısı ve "prometheus" grubu olarak ayarlar. Bu, bu dizinlerdeki tüm dosyaların ve alt dizinlerin "prometheus" kullanıcısı tarafından okunabilir ve yazılabilir olmasını sağlar.

    4. "sudo chmod -R 775 /etc/prometheus/ /var/lib/prometheus/" komutu, /etc/prometheus/ ve /var/lib/prometheus/ dizinlerinin izinlerini ayarlar. Bu dizinlerin sahibi ve grubu, içindeki dosyaları okuma, yazma ve çalıştırma izni verirken, diğer kullanıcılar için sadece okuma ve çalıştırma izni verir. Bu, sadece "prometheus" kullanıcısının bu dizinlerdeki dosyalara yazabileceği ve değişiklik yapabileceği anlamına gelir.

Bu işlemlerin sonucunda, Prometheus, "/etc/prometheus" ve "/var/lib/prometheus" dizinlerine erişebilecek ve bu dizinlerde değişiklik yapabilecek "prometheus" kullanıcısı ve grubu oluşturulur.

sudo groupadd --system prometheus && sudo useradd -s /sbin/nologin --system -g prometheus prometheus && sudo chown -R prometheus:prometheus /etc/prometheus/ /var/lib/prometheus/ && sudo chmod -R 775 /etc/prometheus/ /var/lib/prometheus/
  • Ardından prometheus için systemd dosyası oluşturuyoruz.

sudo vim /etc/systemd/system/prometheus.service

Yukarıdaki oluşturduğumuz dosya içerisine aşağıdaki parametreleri ekliyoruz;

[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Restart=always
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.listen-address=0.0.0.0:9090

[Install]
WantedBy=multi-user.target

Yukarıdaki dosyadaki yapılandırma ayarları, Prometheus'u sistem başlatıldığında otomatik olarak başlatır ve herhangi bir arıza durumunda yeniden başlatır. Ayrıca, Prometheus'un yapılandırma dosyasının yeri, depolama dizini, web konsolu şablonları ve kütüphaneleri ve dinlenecek adres ve port gibi diğer ayarları da belirler.

  • Ardından aşağıdaki komut ile servisi başlatıyoruz ve durumunu kontrol ediyoruz.

sudo systemctl start prometheus && sudo systemctl enable prometheus && sudo systemctl status prometheus
  • Ardından tarayıcı üzerinden prometheus arayüzüne bağlanabiliriz;

http://server-ip:9090

Official Docs:

👨‍⚕️
🦯
https://github.com/prometheus/prometheus/releases/download/v2.43.0/prometheus-2.43.0.linux-amd64.tar.gz
https://prometheus.io/download/