On this page. Prometheus is an open source monitoring system that allows you to collect metrics from any configured target system. Prometheus implements a multi-dimensional data-model with powerful queries, great visualization, precise alerting, and comes with many integrations. Prometheus originally was created by SoundCloud in 2012, but has now become an independent open source project maintained independently by the open source community - all components are available under the Apache 2 License on Github. In this tutorial, I will show you how to install and configure Prometheus and the nodeexporter. We will install Prometheus monitoring system and then configure the nodeexporter to collect metrics from the server.
We will be using the CentOS 7 server for this tutorial guide. Prerequisites. CentOS 7 server. Root privileges What will we do?.
Create a new user and download Prometheus. Configure Prometheus As a Systemd Service. Configure Firewalld. Install and Configure nodeexporter. Add nodeexporter to the Prometheus Server. Testing Step 1 - Create a new User and Download Prometheus In this tutorial, the Prometheus service will run as a non-root user. So we need to create a new non-root user on the system.
Jul 9, 2017 - How To Install and Configure Monit On CentOS 7 / RHEL 7. Monit is an opensource monitoring tool for Linux operating system which. Alert anytime a service fails and you can configurate to attempt to fix any failed services. Install Mon Service Monitor Centos. 7/30/2017 0 Comments Let's see how to install Splunk on centos 7, one of the best tool to explore and monitor the huge data over a network. FAQ: 2 Speed Test Tools. Because the speed test is browser based, and browsers are not very good at providing feedback for exact upload speed at any given moment.
We will create a new user named 'prometheus', and all prometheus services will be running under the prometheus user. Create new 'prometheus' user using the command below. Useradd -m -s /bin/bash prometheus A new user has been created.
Now log in to the user and download prometheus using the. Su - prometheus wget Extract the prometheus-xx.x.x.tar.gz file and rename the directory to 'prometheus'. Tar -xzvf prometheus-2.2.1.linux-amd64.tar.gz mv prometheus-2.2.1.linux-amd64/ prometheus/ Prometheus is downloaded to the server, and all prometheus files are on the '/home/prometheus/prometheus' directory. Step 2 - Configure Prometheus As a Systemd Service In this step, we will configure prometheus as a systemd service. We will create a new service file prometheus.service on the '/etc/systemd/system' directory. Go to the '/etc/systemd/system/' directory and create new service file 'prometheus.service' using editor.
Cd /etc/systemd/system/ vim prometheus.service Paste the prometheus service configuration below. Unit Description=Prometheus Server Documentation=After=network-online.target Service User=prometheus Restart=on-failure #Change this line if you download the #Prometheus on different path user ExecStart=/home/prometheus/prometheus/prometheus -config.file=/home/prometheus/prometheus/prometheus.yml -storage.tsdb.path=/home/prometheus/prometheus/data Install WantedBy=multi-user.target Save and exit. Now reload the systemd system using the systemctl command below.
Systemctl daemon-reload Start the prometheus service and enable it to launch everytime at system startup. Systemctl start prometheus systemctl enable prometheus The prometheus is now running as a systemd service, check it using the command below. Systemctl status prometheus Make sure you get the 'Running' service status. Or check it using the netstat command below.
Netstat -plntu Make sure you get the result as shown below. Prometheus is running by default under the port '9090'. Step 3 - Configure Firewalld If you're using Firewalld on your system, add the port 9090 to the Firewalld list ports. Open port 9090 for the Prometheus access using firewall-cmd commands below. Firewall-cmd -add-port=9090/tcp -permanent firewall-cmd -reload Now open your web browser and type the server IP address with port 9090.
Type 'httprequeststotal' in the query field and click the 'Execute' button. And you will see HTTP requests to the prometheus server with all info about the time, HTTP status code, and method etc. Step 4 - Install and Configure nodeexporter nodeexporter is an exporter of machine metrics that can run on.Nix and Linux system.
In this tutorial, we will install the nodeexporter on the same server prometheus. We will monitor and get the metric of the prometheus server. Login to the prometheus user and download the 'nodeexporter' using the wget command. Su - prometheus wget Extract the nodeexporter and rename the directory to 'nodeexporter'. Tar -xzvf nodeexporter-0.16.0-rc.1.linux-amd64.tar.gz mv nodeexporter-0.16.0-rc.1.linux-amd64 nodeexporter Next, we will create new service file for the nodeexporter. Back to the root shell, goto the '/etc/systemd/system' directory and create new nodeexporter service file 'nodeexporter.service' using vim. Cd /etc/systemd/system/ vim nodeexporter.service There, paste nodeexporter service configuration below.
Unit Description=Node Exporter Wants=network-online.target After=network-online.target Service User=prometheus ExecStart=/home/prometheus/nodeexporter/nodeexporter Install WantedBy=default.target Save and exit. Now reload the systemd system. Systemctl daemon-reload Then start the nodeexporter service and enable it to launch everytime at system startup. Systemctl start nodeexporter systemctl enable nodeexporter The nodeexporter service is now running on the server - check it using the netstat command.
Netstat -plntu And you will get the node-exporter is running on port 9100. Step 5 - Add nodeexporter to the Prometheus Server In this step, we will add the nodeexporter to the prometheus server. Login to the prometheus user and edit the configuration 'prometheus.yml' file.
Login to the prometheus user. Su - prometheus Goto the 'prometheus' directory and edit the configuration file 'prometheus.yml'. Cd prometheus/ vim prometheus.yml Under the 'scrapeconfig' line, add new jobname nodeexporter by copy-pasting the configuration below. jobname: 'nodeexporter' staticconfigs: - targets: 'localhost:9100' Save and exit.
Now restart the prometheus service. Systemctl restart prometheus The nodeexporter has been added to the prometheus server. Step 6 - Testing Prometheus and nodeexporter Open your web browser and then input the server IP address. Type the meminfo collector ' nodememoryMemAvailablebytes' in the query field and click the 'Execute' button.
And you will get the result as below. You will get the available memory on the server instance 'localhost:9100', and the jobname 'node-exporter'. Or if you want to access the nodeexporter raw data, you need to add the nodeexporter port 9100 to the firewalld. Firewall-cmd -add-port=9100/tcp firewall-cmd -reload And then type the server IP address with port 9100. And you will get the nodeexporter raw data as shown below. Installation and configuration of the prometheus monitoring system with the nodeexporter on CentOS 7 has been completed successfully. Reference.
About Muhammad Arul Muhammad Arul is a freelance system administrator and technical writer. He is working with Linux Environments for more than 5 years, an Open Source enthusiast and highly motivated on Linux installation and troubleshooting. Mostly working with RedHat/CentOS Linux and Ubuntu/Debian, Nginx and Apache web server, Proxmox, Zimbra Administration, and Website Optimization.
Currently learning about OpenStack and Container Technology.