Install Graphite and Graphite-Web on CentOS 8 | RHEL 8

You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose

Graphite is a developer-friendly monitoring tool with low hardware resource usage. Graphite was created to have fault tolerance and high availability.As a developer, you can quickly create an application that collects digital time series data to be graphed and sends it to carbon Service, the processing backend of Graphite. The data is stored in Graphite’s dedicated database and drawn on demand for graphical display.

If the disk cannot keep up with the large number of lower write operations that occur (each data point is only a few bytes, but most standard disks cannot perform at most thousands of I/O operations per second), the Graphite backend caches the transfer Incoming data (if they are small).

If you are not writing a collector application from scratch, you can check tool Can be used for data collection and forwarding. In this article, we will guide you through the process of fully installing Graphite on CentOS 8. RHEL 8 server using Podman. The application will run in a container with Systemd services to manage its life cycle.

The main graphite components are:

  1. carbon -A Twisted A daemon that listens to time series data
  2. whisper -A simple database library for storing time series data (design similar to RRD)
  3. Graphite web -A Django A webapp that renders graphics on demand using the following commands Cairo

Install Graphite and Graphite-Web on CentOS 8 | RHEL 8

We will use the Podman container runtime to run Graphite on CentOS 8. RHEL 8. Unless you follow the recommendations in the official project documentation, you can proceed to the next steps without any customization.

The system needs to be up to date:

sudo dnf -y update
sudo systemctl reboot

Step 1: Install Container Tools on CentOS 8 | RHEL 8

Wait for the system to go online, then log in and install Container Tools.

sudo dnf module install container-tools -y

Check the installed version of Podman to confirm success.

$ podman version
Version:            1.6.4
RemoteAPI Version:  1
Go Version:         go1.13.4
OS/Arch:            linux/amd64

Other container management tools are installed, such as buildah and skopeo:

$ buildah version
Version:         1.11.6
Go Version:      go1.13.4
Image Spec:      1.0.1-dev
Runtime Spec:    1.0.1-dev
CNI Spec:        0.4.0
libcni Version:
image Version:   5.0.0
Git Commit:
Built:           Thu Jan  1 01:00:00 1970
OS/Arch:         linux/amd64

$ skopeo -version
skopeo version 0.1.40

Step 2: Run Graphite Container on CentOS 8 | RHEL 8 with Podman

For a detailed guide on using Graphite Docker images, see Graphite’s Docker repo. The first step will be for us to extract the latest Docker image.

Let’s switch to root use.

sudo -i

Download the latest Graphite and Statsd container images.

# podman pull docker.io/graphiteapp/graphite-statsd
Trying to pull docker.io/graphiteapp/graphite-statsd...
Getting image source signatures
Copying blob 700de820209a done
Copying blob df20fa9351a1 done
Copying blob f9a569415da5 done
Copying blob 8f0c7d0dc99e done
Copying config 875c7f22f4 done
Writing manifest to image destination
Storing signatures
875c7f22f4cd1b4da99fe6a3ab213e84567d42ed8f544655bfe8694c8d290345

List available images:

# podman images
REPOSITORY                              TAG      IMAGE ID       CREATED        SIZE
docker.io/library/ubuntu                latest   9140108b62dc   2 weeks ago    75.3 MB
docker.io/graphiteapp/graphite-statsd   latest   875c7f22f4cd   2 months ago   651 MB

The image we downloaded includes the following components:

Mapped port

HostContainerService
8080Nginx
Year 2003Year 2003Carbon Receiver-Plain Text
year 2004year 2004Carbon canister-pickled vegetables
20232023Carbon Accumulator-Plain Text
20242024Carbon Accumulator-Pickled
80808080Graphite internal Gunicorn port (no Nginx proxy).
81258125statistics
81268126statsd administrator

Create a data directory to keep container data. They will be mapped to the container volume when the container is started.

# mkdir -p /data/graphite/{data,logs,conf,statsd_config}

Before running the command, change the time zone to the correct setting.

podman run -d 
 --name graphite 
 --restart=always 
 -p 80:80 
 -p 2003-2004:2003-2004 
 -p 2023-2024:2023-2024 
 -p 8125:8125/udp 
 -p 8126:8126 
 -v /data/graphite/data:/opt/graphite/storage 
 -v /data/graphite/conf:/opt/graphite/conf 
 -v /data/graphite/statsd_config:/opt/statsd/config 
 -v /data/graphite/logs:/var/log 
 -e GRAPHITE_TIME_ZONE='Africa/Nairobi' 
 graphiteapp/graphite-statsd

List the running containers to see if the graphite container is running.

# podman ps
CONTAINER ID  IMAGE                                         COMMAND  CREATED         STATUS             PORTS                                       NAMES
0a79ef44ad59  docker.io/graphiteapp/graphite-statsd:latest           18 seconds ago  Up 17 seconds ago  0.0.0.0:80->80/tcp, 0.0.0.0:8125->8125/udp  graphite

Check the published and occupied ports.

# podman port -l
8125/udp -> 0.0.0.0:8125
8126/tcp -> 0.0.0.0:8126
80/tcp -> 0.0.0.0:80
2003/tcp -> 0.0.0.0:2003
2004/tcp -> 0.0.0.0:2004
2023/tcp -> 0.0.0.0:2023
2024/tcp -> 0.0.0.0:2024

Step 3: Open Graphite Web interface

Pu SELinux in permissive mode:

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

Use the server IP address on port 80 to access the Graphite Web console.

The default login credentials are:

Username: root
Password: root

Install Graphite and Graphite-Web on CentOS 8 | RHEL 8

After the first login, please change this login credentials http: // ip-address / admin / auth / user / 1 /. Click “change the password“Link to initiate the root user password change.

Install Graphite and Graphite-Web on CentOS 8 | RHEL 8

Log out and return with the new password setting.

Install Graphite and Graphite-Web on CentOS 8 | RHEL 8

Step 4: Use Systemd to manage graphite containers

To ensure that our container starts when the system boots, let’s create a new Systemd service unit file.

sudo tee /etc/systemd/system/graphite-podman.service<<EOF
[Unit]
Description=Graphite Docker Container
Documentation=https://github.com/graphite-project/docker-graphite-statsd

[Service]
Type=simple
TimeoutStartSec=0
Restart=on-failure
RestartSec=30s
ExecStartPre=-/usr/bin/podman kill graphite
ExecStartPre=-/usr/bin/podman rm graphite
ExecStartPre=/usr/bin/podman pull graphiteapp/graphite-statsd
ExecStart=/usr/bin/podman run 
            --name graphite 
            --restart=always 
            -p 80:80 
            -p 2003-2004:2003-2004 
            -p 2023-2024:2023-2024 
            -p 8125:8125/udp 
            -p 8126:8126 
            -v /data/graphite/data:/opt/graphite/storage 
            -v /data/graphite/conf:/opt/graphite/conf 
            -v /data/graphite/statsd_config:/opt/statsd/config 
            -v /data/graphite/logs:/var/log 
            -e GRAPHITE_TIME_ZONE='Africa/Nairobi' 
            graphiteapp/graphite-statsd

SyslogIdentifier=graphite
ExecStop=/usr/bin/podman stop graphite

[Install]
WantedBy=multi-user.target
EOF

Reload Systemd to get new units.

sudo systemctl daemon-reload

Confirm that the graphite-podman unit file is created.

# systemctl list-unit-files graphite-podman.service
UNIT FILE               STATE
graphite-podman.service disabled

1 unit files listed.

Start the service when you start the server.

# systemctl enable graphite-podman.service
Created symlink /etc/systemd/system/multi-user.target.wants/graphite-podman.service → /etc/systemd/system/graphite-podman.service.

Terminate the running container to confirm that the service is running.

# podman rm -f graphite
0a79ef44ad5979ade39a3f0c14ca5351771106b429a8318b7912cc9323e3da20

Confirm that the container has been killed.

# podman ps
CONTAINER ID  IMAGE  COMMAND  CREATED  STATUS  PORTS  NAMES

Start the graphite system service.

# systemctl start graphite-podman.service

Check service status:

# systemctl status graphite-podman.service
● graphite-podman.service - Graphite Docker Container
   Loaded: loaded (/etc/systemd/system/graphite-podman.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2020-10-11 05:50:04 CEST; 22s ago
     Docs: https://github.com/graphite-project/docker-graphite-statsd
  Process: 7182 ExecStartPre=/usr/bin/podman pull graphiteapp/graphite-statsd (code=exited, status=0/SUCCESS)
  Process: 7171 ExecStartPre=/usr/bin/podman rm graphite (code=exited, status=1/FAILURE)
  Process: 7160 ExecStartPre=/usr/bin/podman kill graphite (code=exited, status=125)
 Main PID: 7194 (podman)
    Tasks: 13 (limit: 24402)
   Memory: 32.3M
   CGroup: /system.slice/graphite-podman.service
           └─7194 /usr/bin/podman run --name graphite --restart=always -p 80:80 -p 2003-2004:2003-2004 -p 2023-2024:2023-2024 -p 8125:8125/udp -p 8126:8126 -v /d>

Oct 11 05:50:16 centos-01.computingforgeeks.com graphite[7194]: 11/10/2020 03:50:16 :: [tagdb] Tagging carbon.aggregator.45793992f2ac-a.memUsage, carbon.aggregat>
Oct 11 05:50:16 centos-01.computingforgeeks.com graphite[7194]: 11/10/2020 03:50:16 :: [tagdb] Tagged carbon.aggregator.45793992f2ac-a.memUsage, carbon.aggregato>
Oct 11 05:50:16 centos-01.computingforgeeks.com graphite[7194]: 11/10/2020 03:50:16 :: [tagdb] Tagging carbon.aggregator.45793992f2ac-a.blacklistMatches, carbon.>
Oct 11 05:50:17 centos-01.computingforgeeks.com graphite[7194]: 11/10/2020 03:50:17 :: [tagdb] Tagged carbon.aggregator.45793992f2ac-a.blacklistMatches, carbon.a>
Oct 11 05:50:26 centos-01.computingforgeeks.com graphite[7194]: 11/10/2020 03:50:26 :: [listener] MetricLineReceiver connection with 127.0.0.1:60582 established
Oct 11 05:50:26 centos-01.computingforgeeks.com graphite[7194]: 11/10/2020 03:50:26 :: [listener] MetricLineReceiver connection with 127.0.0.1:60582 closed clean>
Oct 11 05:50:26 centos-01.computingforgeeks.com graphite[7194]: 11/10/2020 03:50:26 :: [tagdb] Tagging carbon.aggregator.45793992f2ac-a.destinations.127_0_0_1:20>
Oct 11 05:50:26 centos-01.computingforgeeks.com graphite[7194]: 11/10/2020 03:50:26 :: [tagdb] Tagged carbon.aggregator.45793992f2ac-a.destinations.127_0_0_1:200>
Oct 11 05:50:26 centos-01.computingforgeeks.com graphite[7194]: 11/10/2020 03:50:26 :: [tagdb] Tagging carbon.agents.45793992f2ac-a.avgUpdateTime, stats.timers.v>
Oct 11 05:50:26 centos-01.computingforgeeks.com graphite[7194]: 11/10/2020 03:50:26 :: [tagdb] Tagged carbon.agents.45793992f2ac-a.avgUpdateTime, stats.timers.vi>

Use Podman CLI to list the running containers.

# podman ps
CONTAINER ID  IMAGE                                         COMMAND  CREATED             STATUS                 PORTS                                       NAMES
45793992f2ac  docker.io/graphiteapp/graphite-statsd:latest           About a minute ago  Up About a minute ago  0.0.0.0:80->80/tcp, 0.0.0.0:8125->8125/udp  graphite

If the server has been rebooted, perform a system reboot to ensure that the container has started.

sudo reboot

We can confirm that the container is started with a different ID:

# podman ps
CONTAINER ID  IMAGE                                         COMMAND  CREATED         STATUS             PORTS                                       NAMES
c57a157a3600  docker.io/graphiteapp/graphite-statsd:latest           34 seconds ago  Up 33 seconds ago  0.0.0.0:80->80/tcp, 0.0.0.0:8125->8125/udp  graphite

Go to Graphite file Next steps after installing Graphite.

More monitoring guidelines:

Install and configure Nagios 4 on RHEL 8 / CentOS 8

How to install LibreNMS on CentOS 8 / RHEL 8

How to install Zabbix Server 5 on CentOS 8 / RHEL 8

You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose

Sidebar