Skip to main content

Prometheus Installation

Goal:
This blog will help you with prometheus installation.

Installation Steps.

    Create user without a home directory.
    sudo useradd --no-create-home --shell /bin/false prometheus

    Create directories to copy prometheus config and library files and give permission to user that you crated.
    sudo mkdir /etc/prometheus
    sudo mkdir /var/lib/prometheus
    sudo chown prometheus:prometheus /etc/prometheus
    sudo chown prometheus:prometheus /var/lib/prometheus

    Download and unzip prometheus from github.
    curl -LO https://github.com/prometheus/prometheus/releases/download/v2.3.2/prometheus-2.3.2.linux-amd64.tar.gz 
    tar -xvf prometheus-2.3.2.linux-amd64.tar.gz
    mv prometheus-2.3.2.linux-amd64 prometheus-files
    

    Copy prometheus binary files to bin directory and give permission.
    sudo cp prometheus-files/prometheus /usr/local/bin/
    sudo cp prometheus-files/promtool /usr/local/bin/
    sudo chown prometheus:prometheus /usr/local/bin/prometheus
    sudo chown prometheus:prometheus /usr/local/bin/promtool
    

    Copy prometheus config files to directory we have created and give permission.
    sudo cp -r prometheus-files/consoles /etc/prometheus
    sudo cp -r prometheus-files/console_libraries /etc/prometheus
    sudo chown -R prometheus:prometheus /etc/prometheus/consoles
    sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries
    

    Open  prometheus YAML file and change server details from where you want to scrap log that has to be monitor.
    sudo vi /etc/prometheus/prometheus.yml
    

    Copy below content in file.
    global:
      scrape_interval: 10s
         
    scrape_configs:
      - job_name: 'prometheus'
        scrape_interval: 5s
        static_configs:
          - targets: ['localhost:9090']
    

    Give permission to above file.
    sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml
    

    Create prometheus service file to start/stop/reload prometheus as daemon.
    sudo vi /etc/systemd/system/prometheus.service
    

    Copy below content and close file.
    [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
         
    [Install]
    WantedBy=multi-user.target
        

    Give permission to above file.
    sudo systemctl daemon-reload
    sudo systemctl start prometheus
    sudo systemctl status prometheus
    

 

Hope You are able to install, Comment below if you have any doubt I will try to help ASAP.

Comments

Popular posts from this blog

Install Central Logging on Amazon Linux

Goal: In these tutorial we gonna cover setup of central logging system on amazon linux (CentOs) in same aws vpc . We will setup one central log server to receive log using rsyslog, after that we will setup one client to forward apache & syslog to central server. we already covered forward logs from central log server to ELK stack for analyzing. Logging Stack Component: Central Log server Multiple logging client server/Any apache web server generating logs Rsyslog: we setup with rsyslog v8-stable. You can use any rsyslog  version after rsyslog-6, because we encountered rsyslog drop message in earlier version. Prerequisites: Rsyslog is quite light weight, we doesn't requirement any high configuration machine, aws t2.micro should be enough. We are running t2.micro in production for central log server to receive around 1000 log entry/second, server is using less then 2 percent/sec within same vpc. Now Let's Start we gonna break these tutorial in two pa...

GoReplay - Testing Your Site with Actual Traffic

Goal:   In these article we gonna learn How to capture your Real Time traffic from production and reuse it at your testing/development environment. Prerequisite: One web server running, or If you are just playing around then you can run goreplay test ftp server. Let's Begin Load Testing for site serving millions user wasn't be that easy before I came to know GoReplay . Here I am not gonna explain you How great go replay is, You will automatically get to know after following steps above step to capture and replay your request logs. FYI GoReplay capture logs from tcpdump. Installation: Download zip file from there git repo and unzip it. # create a directory mkdir ~/goreplay # go to directory you created cd ~/goreplay # download tar file from goreplay git repo wget https://github.com/buger/goreplay/releases/download/v0.16.1/gor_0.16.1_x64.tar.gz # unzip it tar -xf gor_0.16.1_x64.tar.gz After Unzipping Check GoReplay binary File is available in directory. Ca...

Install Elasticsearch, Logstash, and Kibana (ELK Stack) on Amazon Linux

Goal: In these tutorial we gonna cover installation of ELK Stack on fresh amazon ec2 linux (CentOS). We will install Elasticsearch 5.x.x, Logstash 5.x.x, and Kibana 5.x.x. We will also show you how to configure filebeat to forwards apache logs collected by central rsyslog server to elk server using Filebeat 5.x.x. ELK stack components: Logstash: Transform incoming logs. Elasticsearch(ES): Stores logs transformed by logstash. Kibana: Web interface for searching and visualizing logs stored in elasticsearch, which is proxied through Nginx. Filebeat: Lightweight Shipper of Logs from client to logstash server. Prerequisites: Minimum size to run your ES cluster RAM --> 4GB CPU --> 2 core Disk --> 20 GB (highly varies on your log size) You many need to increase RAM, CPU, Disk size depending on your log size. Let's start on our main goal to setup ELK Server Install java 8 sudo yum install java-1.8.0-openjdk Change Java Home as Java 8 sudo sh -c "echo expo...