Category Archives: Monitoring

How to install Datadog Agent on Ubuntu 22.04

In this tutorial, we are going to learn how to install Datadog Agent on Ubuntu 22.04.

What is Datadog?

Datadog is an infrastructure monitoring service, it empowers users to keep track of the cloud infrastructure. It gives analytics for all services running on your infrastructure, with the help of dashboards making it easy for one to escalate errors whenever it occurs.

Datadog helps you monitor servers, databases, and all the applications running on your infrastructure. Datadog’s seamless integration with many products makes its unique saas application. Currently, Datadog can integrate easily with over 500 products. It also supports the integration of different APIs. Another thing also is it supports other apps written in other languages.

In summary, Datadog has the following great features.

  • It supports other apps written in other languages.
  • Dashboards can easily be customized.
  • Has real-time alerting services.
  • It automatically collects and analyzes logs and errors.
  • It has seamless integration with many APIs
  • It can easily integrate with many products out there.

Datadog Agent Architecture.

Here we need to talk about what makes up Datadog Agent. Let’s start with Components.

Agent Components

The Datadog Agent is made up of the following components:

  • The Collector– This is responsible for gathering system and application metrics from the machine by temporarily executing standard utilities such iostat, vmstat etc or connecting to applications monitoring interfaces over TCP and HTTP.
  • The Forwarder– This is responsible for buffering and communicating with Datadog hq love SSL. It does this by listening over HTTP for any incoming requests then buffer them and forward to Datadog HQ over HTTPs protocol.
  • The Dogstatsd- This is responsible for aggregating local metrics sent from your code. Dogstatsd is a python implementation of etsy’s statsD metric aggregation daemon.
  • The supervisord- This is responsible for keeping all previous processes up and running.

Installing Datadog Agent on Ubuntu 22.04

To install Datadog Agent you need to have the account in order to give you an API for the free trial version. So go ahead and create your account.

1. Agent setup

Once you have created your account, you will be taken to a page like the figure below where you will choose your operating system to install the agent. For us here we will choose Ubuntu. It will then gives you step by step guide on how to install the Datadog Agent for the first time and when upgrading.

Nextgentips: Datadog agent

2. Install Datadog

To install Datadog Agent, copy the easy install script onto your terminal and press enter.

$ sudo -i # to take you to root user
$ DD_AGENT_MAJOR_VERSION=7 DD_API_KEY=7b8f7f1e565c731ccb40f86834b51024 DD_SITE="datadoghq.com" bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)"

If you are successful with installation, you should be in a position to see something like this:

/usr/bin/systemctl
* Starting the Datadog Agent...



Your Datadog Agent is running and functioning properly. It will continue
to run in the background and submit metrics to Datadog.

If you ever want to stop the Datadog Agent, run:

     systemctl stop datadog-agent

And to run it again run:

     systemctl start datadog-agent

Check the version of the Datadog installed.

$ datadog-agent version
Agent 7.38.2 - Commit: ba442fd - Serialization version: v5.0.23 - Go version: go1.17.11

Also, the finish icon at the bottom will automatically become active because the system will sense the existence of the agent. Press finish to take you to your Datadog dashboard.

nextgentips: Datadog Dashboard

How to install Monit 5 on Ubuntu 22.04

Monit is a small open source utility for monitoring and managing Unix systems. It performs automatic maintenance whenever there is downtime in your system. From this tutorial, you are going to learn how to install Monit on Ubuntu 22.04.

Uses of Monit.

Monit can have many use cases because of its versatility. Let’s look at the following:

  • Monit can be used to monitor files and directories, Monit monitor this system for any changes such as file timestamp, security changes or file size changes, etc.
  • Monit acts proactively, whereby in case of an error in the system functionality, Monit can send an alert to inform that such a process wasn’t complete.
  • Monit can be used to test programs and scripts such as cron jobs do. You can monitor and check the scripts you want to use in any scenario.
  • We use Monit to monitor any daemon processes or any other process running on the localhost such as sshd, Nginx, or MySQL processes.
  • Monit can be used to monitor general system functionality such as CPU and RAM usage.
  • It can be used to monitor network connections on various servers because Monit has built-in tests for Internet protocols such as SMTP, and HTTP.

How to install Monit on Ubuntu 22.04

1. Run system updates.

Before we begin the installation, let’s start by updating our system repositories to make them up to date.

sudo apt update && apt upgrade -y

2. Install Monit from the packages.

Because Monit is available on the Ubuntu package repository, we are only going to use the following command to do the install apt install monit.

$ sudo apt install monit

You should be in a position to see the following output.

Suggested packages:
  default-mta | postfix | mail-transport-agent sysvinit-core
The following NEW packages will be installed:
  monit
0 upgraded, 1 newly installed, 0 to remove and 304 not upgraded.
Need to get 399 kB of archives.
After this operation, 1,100 kB of additional disk space will be used.
Get:1 http://ke.archive.ubuntu.com/ubuntu jammy/universe amd64 monit amd64 1:5.31.0-1 [399 kB]
Fetched 399 kB in 1s (497 kB/s)
Selecting previously unselected package monit.
(Reading database ... 330871 files and directories currently installed.)
Preparing to unpack .../monit_1%3a5.31.0-1_amd64.deb ...
Unpacking monit (1:5.31.0-1) ...
Setting up monit (1:5.31.0-1) ...
Processing triggers for man-db (2.10.2-1) ...

After the installation is complete, we can check the version with the following command monit --version.

$ monit --version
This is Monit version 5.31.0
Built with ssl, with ipv6, with compression, with pam and with large files
Copyright (C) 2001-2022 Tildeslash Ltd. All Rights Reserved.

3. Configure Monit service

To configure Monit to start on boot we use the following command sudo systemctl enable monit

$ systemctl enable monit

To start Monit immediately we use the following command.

$ sudo systemctl start monit 

To check the status of Monit we use the following command.

$ sudo systemctl status monit 
● monit.service - LSB: service and resource monitoring daemon
     Loaded: loaded (/etc/init.d/monit; generated)
     Active: active (running) since Thu 2022-08-11 08:47:50 EAT; 15min ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 1 (limit: 9355)
     Memory: 2.6M
        CPU: 141ms
     CGroup: /system.slice/monit.service
             └─16979 /usr/bin/monit -c /etc/monit/monitrc

Ago 11 08:47:50 zx-pc systemd[1]: Starting LSB: service and resource monitoring>
Ago 11 08:47:50 zx-pc monit[16966]:  * Starting daemon monitor monit
Ago 11 08:47:50 zx-pc monit[16966]:    ...done.
Ago 11 08:47:50 zx-pc systemd[1]: Started LSB: service and resource monitoring >
lines 1-14/14 (END)

Conclusion

We have successfully installed and configured Monit on Ubuntu 22.04. For further reference check the Monit documentation.

How to install Zabbix 6 on Ubuntu 20.04 step by step

In this tutorial I will be showing you how to install Zabbix 6 step by step on Ubuntu 20.04.

Zabbix is an open-source tool for monitoring IT infrastructure like networking, servers, cloud services and virtual machines.

Zabbix collects and display basic metrics on a dashboard. It uses a flexible notification mechanisms that allows users to configure email based alerts for all the events that happened. This allows fast reaction to server problems. Zabbix offers excellent data visualization and reporting using stored data. Zabbix reports and configurations are accessed via a web based frontend.

Features of Zabbix 6

  • Zabbix 6 now supports monitoring of over 100k Zabbix instances, which is now great whenever you want to monitor your instances.
  • You can now in a position to define your user permission on any business service provided.
  • Now you are in a position to define read-write or read-only permissions to your specific business services.
  • You are now in a position to receive alerts and be able to react to any business changes thanks to Zabbix 6 capability.
  • You are now capable of assigning weight to each of your business services
  • Empowering your business service monitoring is now possible with root cause analysis. You can gather all the root cause analysis using the Zabbix API.
  • Its now possible to have out of the box high availability cluster for Zabbix server.
  • They have embedded new way of learning in the context of machine learning and Kubernetes monitoring capability.

Zabbix Architecture

What are the components of Zabbix?

Server: It is the central component which agents reports the availability and integrity of the information.

Storage: All information are stored in a database mostly MySQL.

Web interface: Its where you monitor your Zabbix server activities

Zabbix proxy: It helps to distribute the load of any Zabbix server

Agents: They are deployed on monitoring targets to actively monitor local resources and reports gathered data to Zabbix server.

Installing Zabbix 6 from packages.

There a few ways you can install Zabbix, i.e. installing from the sources, from packages and installing from containers. We will be installing from the Ubuntu packages.

So this is how we are going to achieve this

  1. OS distribution will be Ubuntu 20.04
  2. Database will be PostgreSQL
  3. Web server will be NGINX

Lets begin our installation.

1. Update system repositories.

The first step is to update system repositories, this will make our system repositories up to date and also avoid running into errors.

sudo apt update && apt upgrade

2. Install Zabbix repository.

We are going to download Zabbix .deb packages and later install it. Make sure you run system wide updates to enable the changes take effect.

wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu20.04_all.deb

After the download is complete we need to install it using the following command.

dpkg -i zabbix-release_6.0-1+ubuntu20.04_all.deb

Then we need to update our repositories again before installing the frontend, server and the agent.

sudo apt update

3. Install Zabbix server, Frontend and agent

Let’s now proceed to install Zabbix server, frontend and agent. Use the following command.

apt install zabbix-server-pgsql zabbix-frontend-php php7.4-pgsql zabbix-nginx-conf zabbix-sql-scripts zabbix-agent

When installation is complete, we can verify the Zabbix server installed using the following command.

apt-cache policy zabbix-server-pgsql

4. Install Postgresql database

To install Postgresql check out this article How to install PostgreSQL 14 on Ubuntu 20.04|21.10

Create a file repository for Postgresql

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Next is to import GPG key

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

After this, we need to update our system again.

apt update

And lastly install Postgresql 14 with the following command;

sudo apt install postgresql-14 -y

Once installed login into Postgresql shell;

sudo -i -u postgres

We now need to create a database user with permissions like this:

sudo -u postgres createuser --pwprompt zabbix

Setup the database Zabbix with previously created user.

sudo -u postgres createdb -O zabbix -E Unicode -T template0 zabbix

After this we now need to import initial schema and data. Enter your initial created password when prompted.

zcat /usr/share/doc/zabbix-sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix

5. Configure database for Zabbix server

Open your preferred text editor and edit the following /etc/zabbix/zabbix_server.conf. I am using vim as text editor.

sudo vi /etc/zabbix/zabbix_server.conf

Add this

DBPassword=password

6. Configure PHP for Zabbix frontend

To configure PHP we need to edit /etc/zabbix/nginx.conf, uncomment and set listen and server_name directives.

sudo vi /etc/zabbix/nginx.conf

Make sure listen is in port 80 and server_name set to your ip address

Lastly you need to start Zabbix server and agent

#restart
systemctl restart zabbix-server zabbix-agent nginx php7.4-fpm
# enable
systemctl enable zabbix-server zabbix-agent nginx php7.4-fpm

7. Configure Zabbix frontend

To configure frontend head over to http://<server ip/domain> and follow the instructions.

Conclusion

I hope this tutorial have gave you more insight about Zabbix. Head over to the Zabbix documentation for more information.

How to run Prometheus with Podman

Prometheus is an open-source system monitoring and alerting toolkit. Prometheus collects and stores its metrics as time-series data. Metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels.

In this tutorial we are going to learn how to run Prometheus with Podman.

Components of Prometheus

  • Has an alertmanager to handle alerts
  • Has a push gateway for supporting short-lived jobs
  • Has main Prometheus server which scrapes and stores time series data
  • Client libraries for instrumenting application code
  • Special purpose exporters for services like HAProxy, statD, Graphite etc

Related Articles

Prerequisites

  • Have a basic understanding of Linux terminal
  • Make sure you have access to internet

Table of Contents

  • Run system updates
  • Install podman
  • Pull Prometheus image
  • Start Prometheus

Run system updates

Running system updates are mandatory if you expect your system packages to be up to date every time. Let’s run updates with the following command; I am using Fedora 35, you can use any distro you like.

$ sudo dnf update -y

When the updates are complete, we can proceed to install podman.

2. Install Podman

Podman is a daemon-less, open-source, Linux native tool designed to make it easy to find, run, build, share and deploy applications using Open Container Initiative (OCI) containers and container images. Containers can be run as root or as a regular users. Podman = Docker

Let’s install Podman with the following command;

$ sudo dnf install podman -y

You have successfully installed podman on Fedora 35.

You will see the following sample output.

Sample output
Installing:
 podman                                 x86_64            3:3.4.2-1.fc35                updates             12 M
Installed:
  catatonit-0.1.7-1.fc35.x86_64                        conmon-2:2.0.30-2.fc35.x86_64                             
  container-selinux-2:2.170.0-2.fc35.noarch            containernetworking-plugins-1.0.1-1.fc35.x86_64           
  containers-common-4:1-32.fc35.noarch                 criu-3.16.1-2.fc35.x86_64                                 
  criu-libs-3.16.1-2.fc35.x86_64                       crun-1.3-1.fc35.x86_64                                    
  dnsmasq-2.86-3.fc35.x86_64                           fuse-common-3.10.5-1.fc35.x86_64                          
  fuse-overlayfs-1.7.1-2.fc35.x86_64                   fuse3-3.10.5-1.fc35.x86_64                                
  fuse3-libs-3.10.5-1.fc35.x86_64                      iptables-legacy-1.8.7-13.fc35.x86_64                      
  libbsd-0.10.0-8.fc35.x86_64                          libnet-1.2-4.fc35.x86_64                                  
  libnftnl-1.2.0-2.fc35.x86_64                         libslirp-4.6.1-2.fc35.x86_64                              
  nftables-1:1.0.0-1.fc35.x86_64                       podman-3:3.4.2-1.fc35.x86_64                              
  podman-gvproxy-3:3.4.2-1.fc35.x86_64                 podman-plugins-3:3.4.2-1.fc35.x86_64                      
  shadow-utils-subid-2:4.9-7.fc35.x86_64               slirp4netns-1.1.12-2.fc35.x86_64                          
  yajl-2.1.0-17.fc35.x86_64                           

Complete!

You can check the version of Podman installed.

$ podman --version
podman version 3.4.2

If you get the version of Podman, then you have successfully installed Podman.

Now we can proceed to pull Prometheus image.

3. Pull Prometheus image.

To pull Prometheus, use the podman pull command. Let’s see how we can do that;

$ podman pull prom/prometheus

You will get the following sample output. Choose where you could pull your image from.

Sample output
? Please select an image: 
    registry.fedoraproject.org/prom/prometheus:latest
    registry.access.redhat.com/prom/prometheus:latest
    docker.io/prom/prometheus:latest
  ▸ quay.io/prom/prometheus:latest
✔ docker.io/prom/prometheus:latest
Trying to pull docker.io/prom/prometheus:latest...
Getting image source signatures
Copying blob 620e8dfd5447 done  
Copying blob 21b2df964046 done  
Copying blob ddd09594f788 done  
Copying blob aa2a8d90b84c done  
Copying blob b45d31ee2d7f done  
Copying blob 7d3b94bc0edd done  
Copying blob ddbba1a8341e done  
Copying blob ceb78b2ad8d8 done  
Copying blob cf4a6b37f5be done  
Copying blob ae4192f5013d done  
Copying blob f87c90634d35 done  
Copying blob 1860fdfbca21 done  
Copying config c10e9cbf22 done  
Writing manifest to image destination
Storing signatures
c10e9cbf22cd70dc656320cffe4f42347f114702a061395d586b492386720be0

From the above choices, you can only pull from docker.io

We can verify our image like this;

$ podman images 
REPOSITORY                 TAG         IMAGE ID      CREATED      SIZE
docker.io/prom/prometheus  latest      c10e9cbf22cd  2 weeks ago  196 MB

We can see that our imge is there. To confirm use the image ID.

4. Start Prometheus Container

To start Prometheus, we would first need to create a directory where we will store our data.

$ sudo mkdir data
cd data

Once inside data directory run the following command power up the Prometheus.

$ podman run --name myprometheus -d -p 9090:9090 -v $(pwd):/data/db:Z prometheus 

You can use podman ps command to know if it running;

$ podman ps
CONTAINER ID  IMAGE                             COMMAND               CREATED         STATUS             PORTS                   NAMES
64779f0e23f6  docker.io/prom/prometheus:latest  --config.file=/et...  22 seconds ago  Up 22 seconds ago  0.0.0.0:9090->9090/tcp  myprometheus

From the above, it shows it is up

Now let’s open prometheus in our preferred browser.

http://<Your_IP_Address>:9090

You will get the following from the browser

Prometheus Dashboard

Move to status and click configuration to see the Prometheus.yml file.

The following is a sample output.

Sample output
global:
  scrape_interval: 15s
  scrape_timeout: 10s
  evaluation_interval: 15s
alerting:
  alertmanagers:
  - follow_redirects: true
    scheme: http
    timeout: 10s
    api_version: v2
    static_configs:
    - targets: []
scrape_configs:
- job_name: prometheus
  honor_timestamps: true
  scrape_interval: 15s
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
  follow_redirects: true
  static_configs:
  - targets:
    - localhost:9090

5. Conclusion

You have learned how to run Prometheus with Podman. Don’t hesitate to contact us in case of any difficulty. Also, you can read more on Podman Documentation.

How to install and configure Grafana with Podman on Rocky LInux.

In this tutorial guide we are going to install and configure Grafana with Podman on a Rocky LInux server.

Grafana is a complete observability stack that allows you to monitor and analyze logs, metrics and traces.

Grafana allows you to query, visualize, alert on and understand your data insight. Grafana can create, explore and create beautiful dashboards that can be shared with your teams.

Podman is a daemonless, open source, Linux native tool designed to make it easy to find, run, build, share and deploy applications using Open Container Initiative (OCI) containers and container images. Containers can be run as root or as a regular user.

Related Content

  1. How to install Grafana 8 on Ubuntu 21.04
  2. How to install Podman 3 on Debian 11
  3. How to Install MongoDB with Podman on Rocky Linux 8

Prerequisites

  • Rocky Linux server
  • User with sudo privileges
  • Have Podman running on your system.

Table of Contents

  1. Update your Rocky Linux repositories
  2. Install Podman
  3. Pull Grafana from the container registry
  4. Create Grafana container
  5. Run Tests to confirm installation
  6. Run Grafana in web browser
  7. Configuring Grafana web interface
  8. Conclusion.

1. Update Rocky Linux Repositories

To begin our installation we need to update our Rocky Linux repositories in order to update any changes which might have occured with the operating System. Use the update command below;

$ sudo dnf update -y

When updates are complete, you can proceed to install podman into our system to enable us create containers.

2. Install Podman

In order for us to create Grafana container, we are using Podman container engine to accomplish this. To install Podman running the following command in your terminal;

$ sudo dnf install podman -y

Sample output will look like this;

Installing:
 podman                           x86_64      3.3.1-9.module+el8.5.0+710+4c471e88           appstream       12 M
Installing dependencies:
 conmon                           x86_64      2:2.0.29-1.module+el8.5.0+710+4c471e88        appstream       51 k
 container-selinux                noarch      2:2.167.0-1.module+el8.5.0+710+4c471e88       appstream       53 k
 containernetworking-plugins      x86_64      1.0.0-1.module+el8.5.0+710+4c471e88           appstream       19 M
 containers-common                noarch      2:1-2.module+el8.5.0+710+4c471e88             appstream       78 k
 criu                             x86_64      3.15-3.module+el8.5.0+710+4c471e88            appstream      517 k
 fuse-common                      x86_64      3.2.1-12.el8                                  baseos          20 k
 fuse-overlayfs                   x86_64      1.7.1-1.module+el8.5.0+710+4c471e88           appstream       71 k
 fuse3                            x86_64      3.2.1-12.el8                                  baseos          49 k
 fuse3-libs                       x86_64      3.2.1-12.el8                                  baseos          93 k
 iptables                         x86_64      1.8.4-20.el8                                  baseos         584 k
 libnet                           x86_64      1.1.6-15.el8                                  appstream       66 k
 libnetfilter_conntrack           x86_64      1.0.6-5.el8                                   baseos          63 k
 libnfnetlink                     x86_64      1.0.1-13.el8                                  baseos          32 k
 libnftnl                         x86_64      1.1.5-4.el8                                   baseos          82 k
 libslirp                         x86_64      4.4.0-1.module+el8.5.0+710+4c471e88           appstream       69 k
 nftables                         x86_64      1:0.9.3-21.el8                                baseos         320 k
 podman-catatonit                 x86_64      3.3.1-9.module+el8.5.0+710+4c471e88           appstream      339 k
 protobuf-c                       x86_64      1.3.0-6.el8                                   appstream       36 k
 runc                             x86_64      1.0.2-1.module+el8.5.0+710+4c471e88           appstream      3.1 M
 slirp4netns                      x86_64      1.1.8-1.module+el8.5.0+710+4c471e88           appstream       50 k
Enabling module streams:
 container-tools                              rhel8                                                             

To be sure that Podman have been installed, run the following command. It will give you the Podman version you are running;

$ podman -v
podman version 3.3.1

From the time of this writing Podman 3.3.1 is the latest release.

When installation is complete you can proceed to pull Grafana from the Podman container registries.

3. Pull Grafana Image

To pull Grafana we use podman pull grafana command, it will ask you where you want to pull the image from as shown below.

$ podman pull grafana

Choose where you would like to pull your image from as shown;

? Please select an image: 
  ▸ registry.fedoraproject.org/grafana:latest
    registry.access.redhat.com/grafana:latest
    registry.centos.org/grafana:latest
    docker.io/library/grafana:latest

For my case I have selected fedora project, you can pull from any of the above. Press enter and you will see the following;

# podman pull grafana 
✔ registry.fedoraproject.org/grafana:latest
Trying to pull registry.fedoraproject.org/grafana:latest...
Getting image source signatures
Copying blob d2e5db905089 done  
Copying blob 7e7f471a8c74 done  
Copying config a7b3912622 done  
Writing manifest to image destination
Storing signatures
a7b391262240741224d21f5dce7f50925e53291d42750303ce7cd635e7f2eb5e

From here we have pulled the grafana image, we can check if we have really pull the image with the following command;

$ podman images 
REPOSITORY                          TAG         IMAGE ID      CREATED       SIZE
registry.fedoraproject.org/grafana  latest      a7b391262240  4 months ago  420 MB

4. Create Grafana container

We can now create our Grafana container after you have successfully pulled the image. To create the container we use the following command but first we need to create a directory where we can store Grafana data so that incase you delete the image by mistake the data will still be available.

$ sudo mkdir grafana_data
$ cd grafana_data

Once inside the directory, we can run run our container with podman run command.

$ podman run --name nextgentipsgrafana -d -p 3000:3000 -v $(pwd):/grafana_data/db:Z grafana 

ed7db43a447ff7b447faf5ca8ff1d5cd335242622613dc2ec72ae97adc5182c6

Let’s analyse the command in detail;

  • –name: describe the name of the project i.e nextgentipsgrafana
  • d: run your container in detached mode i.e in the background
  • -p 3000:3000: map port 3000 of the host to port 3000 on the container.
  • v (volume): create persisting data generated and used by podman containers.
  • $(pwd):/grafana_data/db: shows the directory to to store your data.
  • Z– tells podman that the volume content will be shared between containers

5. Run tests

To check if our container is set up correctly, we can run tests, if your tests can run without any error then the container was created successfully.

$ podman run --rm -it grafana

Sample output from the test will look like this;

INFO[11-18|12:04:39] Registering plugin                       logger=plugins id=pcp-redis-datasource
INFO[11-18|12:04:39] Registering plugin                       logger=plugins id=pcp-vector-datasource
INFO[11-18|12:04:39] Registering plugin                       logger=plugins id=pcp-breadcrumbs-panel
INFO[11-18|12:04:39] Registering plugin                       logger=plugins id=pcp-flamegraph-panel
INFO[11-18|12:04:39] Registering plugin                       logger=plugins id=pcp-notifygraph-panel
INFO[11-18|12:04:39] HTTP Server Listen                       logger=http.server address=[::]:3000 protocol=http subUrl= socket=

6. Start Grafana from the browser

Having successfully created the container, we now need to access our garafana from the browser.

To begin,choose your preferred browser and type the following

http://<your_IP_Address>:3000

3000 is the default port number for grafana. The default username and password is admin. You will have to change the password after your first login.

Grafana interface

7. Configuring Grafana web interface

To do Grafana configuration, create a new dashboard by clicking the plus sign on your left hand side then create panel to create graphical user interface as shown.

Grafana Dashboard

8. Conclusion

We have successfully installed Grafana with Podman on Rocky Linux server. Continue experimenting with the interface until you are conversant with it.

How to Install OpenLiteSpeed on Rocky Linux/AlmaLinux

In this tutorial guide we will learn how to install Openlitespeed server on Rocky Linux/Alma Linux

Openlitespeed is an easy to use open source web server. It offers unbeatable features and performance to your website along with top notch security. The server understands all the Apache rewrite rules and has intelligent cache acceleration features that let you implement the fastest caching on your server.

Prerequisites

  • Rocky Linux 8 Server
  • User account with sudo privileges
  • Strong internet connection

Table of Contents

  1. Update our System
  2. Add OpenLiteSpeed to Rocky Linux 8 to the repository
  3. Install OpenLiteSpeed on Rocky Linux
  4. Install PHP
  5. Install and confiogure MySQL
  6. Set up OpenLiteSpeed login Admin credentials
  7. Test OpenLiteSpeed

Related Articles

1. Update Rocky Linux Repositories

First we need to update our system so that our repositories are up to date. This is the first step whenever you are doing any installation in the system. Type the following command into our terminal.

$ sudo dnf update -y

When the update is complete proceed to add OpenLiteSpeed to repository.

2. Add OpenLiteSpeed to EPEL repository

To add OpenLiteSpeed into our repository in Rocky 8 Linux, type the following into our terminal;

$ sudo dnf install epel-release

Sample output

....
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                         1/1 
  Installing       : epel-release-8-13.el8.noarch                                                            1/1 
  Running scriptlet: epel-release-8-13.el8.noarch                                                            1/1 
  Verifying        : epel-release-8-13.el8.noarch                                                            1/1 

Installed:
  epel-release-8-13.el8.noarch                                                                                   

Complete!

Add OpenLiteSpeed to our repository

$ sudo rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm

Retrieving http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:litespeed-repo-1.2-1.el8         ################################# [100%]

3. Install OpenLiteSpeed on Rocky Linux/AlmaLinux

Now that we have added the OpenLiteSpeed Repository to our system, we can now install OpenLiteSpeed with the following command:

$ sudo dnf install openlitespeed

After the installation is complete, you check the status of OpenLiteSpeed server with the following command;

$ # sudo systemctl status lsws
● lshttpd.service - OpenLiteSpeed HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/lshttpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-11-12 12:22:52 UTC; 1min 41s ago
  Process: 63411 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
 Main PID: 63435 (litespeed)
   CGroup: /system.slice/lshttpd.service
           ├─63435 openlitespeed (lshttpd - main)
           ├─63439 openlitespeed (lscgid)
           └─63452 openlitespeed (lshttpd - #01)

Nov 12 12:22:49 rockylinux systemd[1]: Starting OpenLiteSpeed HTTP Server...
Nov 12 12:22:50 rockylinux lswsctrl[63411]: [OK] litespeed: pid=63435.
Nov 12 12:22:52 rockylinux systemd[1]: Started OpenLiteSpeed HTTP Server.

It must show the status as active for us to continue with this tutorial. If not start your server first with the following command

$ /usr/local/lsws/bin/lswsctrl start.

4. Install PHP for OpenLiteSpeed

PHP is not embedded in OpenLiteSpeed as is the case with Apache. OpenLiteSpeed delegates PHP execution to external PHP executables. This will allows for better security, stability and handling of multiple connections.

Begin installation of PHP74 with the following command

$ sudo dnf -y install lsphp74 lsphp74-common lsphp74-mysqlnd lsphp74-gd lsphp74-process lsphp74-mbstring lsphp74-xml lsphp74-mcrypt lsphp74-pdo lsphp74-imap lsphp74-soap lsphp74-bcmath

Once the installation of PHP74 is complete, we can now move to install MySQL server

5. Install MySQL server

You can run the following command to install MySQL server

$ sudo dnf install mysql mysql-server

Run secure installation script to make MyQL safe, but first you need to start mysqld service;

$ sudo systemctl start mysqld
$ sudo systemctl enable mysqld

Check the status now with the following command;

$ sudo systemctl status mysqld

Sample Output

● mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-11-12 12:56:55 UTC; 2min 48s ago
 Main PID: 66270 (mysqld)
   Status: "Server is operational"
    Tasks: 37 (limit: 11189)
   Memory: 458.0M
   CGroup: /system.slice/mysqld.service
           └─66270 /usr/libexec/mysqld --basedir=/usr

Nov 12 12:56:47 rockylinux systemd[1]: Starting MySQL 8.0 database server...
Nov 12 12:56:47 rockylinux mysql-prepare-db-dir[66189]: Initializing MySQL database
Nov 12 12:56:55 rockylinux systemd[1]: Started MySQL 8.0 database server.

It is now time to run our secure installation, do the following;

$ sudo mysql_secure_installation

For easy logging into the system it is better you do not set validate password. Type N and the consequent prompts you can type Y to allow installation to continue.

When it is complete we can now move forward to set up OpenLiteSpeed administration panel.

5. Configure OpenLiteSpeed Admin panel

To change the default password in the OpenLiteSpeed dashboard, we need to run the following command;

$ /usr/local/lsws/admin/misc/admpass.sh

Sample output

# 
Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: admin

Please specify the administrator's password.
This is the password required to login the administration Web interface.

Password: 
Retype password: 
Administrator's username/password is updated successfully!

We have successfuly added the administrator, it is now good we configure firewall to allow OpenLiteSpeed run successfully.

6. Configure Firewall Settings

OpenLiteSpeed listens on port 8088 and 7080, so we must allow this ports access. To do so we can do the following;

$ firewall-cmd --zone=public --permanent --add-port=8088/tcp

Do the same for port 7080

$ firewall-cmd --zone=public --permanent --add-port=7080/tcp

Then you need to reload the system for changes to take effect

$ sudo firewall-cmd --reload

If incase you run into issues with the following please ensure that firewalld is up and running. Run the folllowing command to enable it.

$ systemctl enable --now firewalld

Lastly we can test our OpenLiteSpeed to see if it is running with the following on your prefered browser;

http://<Your_IP_address:8088>
OpenLiteSpeed on port 8088

To access the admin site we need to use port 7080 like this

http://<Your_IP_address:7080>
openLiteSpeed login screen
OpenLiteSpeed Dashboard

Conclusion

I am glad you have learned how to install OpenLiteSpeed on Rocky Linux/Alma Linux. Continue playing around with the configuration to learn more. In case of problem don not hesitate to contact us or consult OpenLiteSpeed Documentation

How to install Grafana 8 on Ubuntu 21.04

In this tutorial guide we are going to learn how to install Grafana 8 on Ubuntu 21.04 server. Grafana is a complete observability stack that allows you to monitor and analyze logs, metrics and traces.

Grafana allows you to query, visualize, alert on and understand your data insight. Grafana can create, explore and create beautiful dashboards that can be shared with your teams.

Related Contents

Grafana Components

  • Grafana Open source. This is an open source visualization and analytics software. It allows one to query, visualize, alert on and check for traces every where. It provides you with tools to turn your time series database to impactful graphs which are easy to interpret.
  • Grafana Loki. It is an open source set of components that can be composed into a fully featured logging stack.
  • Grafana Tembo. This is an open source easy to use and high volume distributed tracing backend

Why Grafana?

Grafana have been widely adopted by big companies due to the following reasons:

  • Grafana provides data for everyone. Grafana was built with a philosophy that data should be accessible to everyone. By providing data to everyone it provides a way that everyone can give opinion and recommendations of what should be done with regard to the datasets available to everyone.
  • Grafana unify your data, not databases. Grafana provides a way of unifying all your data wherever it exists and show them in a single dashboard.
  • Grafana provides for data flexibility and versatility. Grafana translates and transform any of your data into flexible and versatile dashboards. Grafana allows you to build dashboards specifically for you according to data available. You can create customized data according to your needs.
  • Grafana provides dashboards for everyone. Grafana provides you with an option to share your dashboard with every team, providing good decision making.

Grafana Features

Grafana has many features such as:

  • Dashboard templating. Dashboards allows users to build visualization graphs that is shareable with other groups. Dashboard is the most convenient way to create all the data pool that can be adhered easily.
  • Annotations. This feature allows you to mark graphs so that in case of a problem you know where to return to. This features helps a lot in case their error with your tabulations.
  • Kiosk mode and playlist. playlist is good for rolling coverage. Let’s say you want to display your contents on a bigger screen, you will use playlist to do that, it can play all what you have all the time required. Kiosk mode on the other hand lets you show the interface elements that is needed in view-mode only.
  • Alerting. Grafana alerting is the most important feature because it let you know when something went wrong. Think of database error, it will alert you on the severance of the error and what measures need to be taken care of.
  • Plugins. You can extend grafana functionalities with the help of plugins. Get interface with other products through plugins. This has made it possible for grafana to be widely used.

Installing Grafana on Ubuntu 21.04

1. Run system update

To install grafana, we have to run system updates, to do that use the following command:

$ sudo apt update

Afer the update is complete do run upgrade every package which might have been outdated. Use the following command to do so.

$ sudo apt upgrade -y

Install Software-properties-common

Software properties allow for easy management of PPA in the system. Use the following command to do so

$ sudo apt install software-properties-common
# sudo apt install software-properties-common
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
software-properties-common is already the newest version (0.99.10).
software-properties-common set to manually installed.
The following package was automatically installed and is no longer required:
  net-tools
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

From the above we can see that software-properties-common is there by default on Ubuntu 21.04. Let’s go ahead and add GPG keys to Grafana.

2. Add Grafana to APT Repository

First we will need to add GPG keys to our APT sources keyring. Use the following command to accomplish this

$ wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -

You will get ok as the ouput. After this we can now add Grafana to the APT repository. Use the following command to do so

$ sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"

Press Enter to continue with the installation.

# sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
Repository: 'deb https://packages.grafana.com/oss/deb stable main'
Description:
Archive for codename: stable components: main
More info: https://packages.grafana.com/oss/deb
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.

It is now high time to install Grafana into our system. We have completed all the prerequisites, but first we need to update our system for the new changes to take effect.

$ sudo apt update

Then after the updates are complete install Grafana. Do this on the terminal

3. Install Grafana

$ sudo apt install grafana -y

-y instructs the system continue with installation without asking you to press enter in order to accept the installation.

4. Verify the installation

Use the following to verify your installation

$ grafana-server -v

Sample output

# grafana-server -v
Version 8.2.2 (commit: 6232fe07c0, branch: HEAD)

Start Grafana Service

Grafana needs to up and running for it to help us with monitoring, do start the service with the following command

$ sudo systemctl start grafana-server

Enable the service to run on start with the following command:

$ sudo systemctl enable grafana-server 

Sample Output

# sudo systemctl enable grafana-server
Synchronizing state of grafana-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable grafana-server
Created symlink /etc/systemd/system/multi-user.target.wants/grafana-server.service → /lib/systemd/system/grafana-server.service.

You can verify the status of the Grafana with the following comand:

$ sudo systemctl status grafana-server

Sample Output

# sudo systemctl status grafana-server
● grafana-server.service - Grafana instance
     Loaded: loaded (/lib/systemd/system/grafana-server.service; disabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-10-30 19:42:42 UTC; 2min 40s ago
       Docs: http://docs.grafana.org
   Main PID: 2000 (grafana-server)
      Tasks: 8 (limit: 2330)
     Memory: 26.9M
     CGroup: /system.slice/grafana-server.service
             └─2000 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/run/grafana/grafana-se>

Oct 30 19:42:44 ubuntu-21 grafana-server[2000]: t=2021-10-30T19:42:44+0000 lvl=info msg="Executing migration" lo>
Oct 30 19:42:44 ubuntu-21 grafana-server[2000]: t=2021-10-30T19:42:44+0000 lvl=info msg="migrations completed" l>
Oct 30 19:42:44 ubuntu-21 grafana-server[2000]: t=2021-10-30T19:42:44+0000 lvl=info msg="Created default admin" >
Oct 30 19:42:44 ubuntu-21 grafana-server[2000]: t=2021-10-30T19:42:44+0000 lvl=info msg="Created default organiz>
Oct 30 19:42:44 ubuntu-21 grafana-server[2000]: t=2021-10-30T19:42:44+0000 lvl=info msg="Starting plugin search">
Oct 30 19:42:44 ubuntu-21 grafana-server[2000]: t=2021-10-30T19:42:44+0000 lvl=info msg="Registering plugin" log>
Oct 30 19:42:44 ubuntu-21 grafana-server[2000]: t=2021-10-30T19:42:44+0000 lvl=info msg="External plugins direct>
Oct 30 19:42:44 ubuntu-21 grafana-server[2000]: t=2021-10-30T19:42:44+0000 lvl=info msg="Live Push Gateway initi>
Oct 30 19:42:44 ubuntu-21 grafana-server[2000]: t=2021-10-30T19:42:44+0000 lvl=info msg="Writing PID file" logge>
Oct 30 19:42:44 ubuntu-21 grafana-server[2000]: t=2021-10-30T19:42:44+0000 lvl=info msg="HTTP Server Listen" log>

Installation is complete for now but where do we from here.. You are wondering what if i want to access the user interface of the Grafana. Don’t worry. Grafana can be accessed through port 3000 on the browser. But wait will it work really? Check it out first: Type your IP address:3000 on your browser to see what happens.

It shows an errror because we have not allowed the rules on the firewall. So let’s allow tcp access to the firewall. We can use the following command:

$ sudo ufw allow proto tcp from any to any port 3000
# sudo ufw allow proto tcp from any to any port 3000
Rules updated
Rules updated (v6)

when you type your address:3000 this time round Grafana interface will pop up as show below

Default username and password is admin, you will be created with the following Grafana interface.

Grafana Dashboard

Conclusion

Congratulations! You have installed Grafana monitoring tool and now you can start working on your project because you are covered with alerting tool. In case you find any problem always consult Grafana Documentation.

How to install Nagios Core on Ubuntu 20.04

In this article, we are going to install Nagios Core on Ubuntu 20.04 server. Nagios core formally known as Nagios is a free and open-source software application that monitors systems, networks, and infrastructure. Nagios offers monitoring and alerting services for servers, switches, applications, and services. It alerts users when something goes wrong and alerts again when it has been rectified.

Here is what you will end up with

  • Nagios and Nagios plugins will be installed underneath /usr/local/nagios.
  • Nagios will be installed to monitor few aspects of your system (cpu load, disk usage, etc.)
  • The nagios web interface will be accesible at http://localhost/nagios/

Required packages

  • PHP
  • Apache2
  • GCC compiler and development libraries
  • GD development libraries

Check out this article on how to install Apache 2 and PHP on Ubuntu 20.04 Ubuntu server

Step 1: Update Ubuntu 20.04 server

Login to your server using the following command.

$ ssh username@IP_Address

Once logged in issue the following commands to update the package list

$ sudo apt update 

Next, we can install the packages necessary for building Nagios 4 and Nagios plugins.

$ sudo apt install nagios4 nagios-plugins-contrib nagios-nrpe-plugin
Sample output

Setting up libmonitoring-plugin-perl (0.40-1) ...
Setting up ruby (1:2.7+1) ...
Setting up rake (13.0.1-4) ...
Setting up liblwp-protocol-https-perl (6.07-2ubuntu2) ...
Setting up libwww-perl (6.43-1) ...
Setting up libruby2.7:amd64 (2.7.0-5ubuntu1.5) ...
Setting up liblwp-useragent-determined-perl (1.07-1) ...
Setting up libxml-parser-perl (2.46-1) ...
Setting up ruby2.7 (2.7.0-5ubuntu1.5) ...
Setting up libwebinject-perl (1.94-1) ...
Setting up libxml-sax-expat-perl (0.51-1) ...
update-perl-sax-parsers: Registering Perl SAX parser XML::SAX::Expat with priority 50...
update-perl-sax-parsers: Updating overall Perl SAX parser modules info file...
Replacing config file /etc/perl/XML/SAX/ParserDetails.ini with new version
Processing triggers for install-info (6.7.0.dfsg.2-5) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for rsyslog (8.2001.0-1ubuntu1.1) ...
Processing triggers for ufw (0.36-6ubuntu1) ...
Processing triggers for systemd (245.4-4ubuntu3.13) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for php7.4-cli (7.4.3-4ubuntu2.7) ...
Processing triggers for libapache2-mod-php7.4 (7.4.3-4ubuntu2.7) ...

The above command will install a bunch of commands including Apache2, postfix mail servers if you require, Nagios core, Nagios plugins.

We have an Apache configuration file that comes with Nagios depending on mod_authz_groupfile and mod_auth_digest modules, which are not enabled by default. mod_authz_groupfile module provides authorization capabilities so that authenticated users can be allowed or denied access to portions of the website by group membership. mod_auth_digest implements HTTP digest authentication and provides an alternative to mod_auth_basic where the password is not transmitted as cleartext.

The following command enables the mod_authz_groupfile and mod_auth_digest modules on our system

$ sudo a2enmod authz_groupfile auth_digest
Sample output
Considering dependency authz_core for authz_groupfile:
Module authz_core already enabled
Enabling module authz_groupfile.
Considering dependency authn_core for auth_digest:
Module authn_core already enabled
Enabling module auth_digest.
To activate the new configuration, you need to run:
  systemctl restart apache2

Apache default configuration allows Nagios access from the localhost and private IPs only. Now we need to change the configuration so that only authenticated users can view the interface and issue commands.

Open your preferred text editor to make the necessary changes

$ sudo nano /etc/apache2/conf-enabled/nagios4-cgi.conf
Sample output
#Require ip  ::1/128 fc00::/7 fe80::/10 10.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16
    <Files "cmd.cgi">
        AuthDigestDomain "Nagios4"
        AuthDigestProvider file
        AuthUserFile    "/etc/nagios4/htdigest.users"
        AuthGroupFile   "/etc/group"
        AuthName        "Nagios4"
        AuthType        Digest
        #Require all     granted
        Require        valid-user
    </Files>
</DirectoryMatch>

<Directory /usr/share/nagios4/htdocs>
    Options     +ExecCGI
</Directory>

From the above comment outline starting with Require IP, <Files “cmd.cgi”> and Require all granted. Uncomment the line containing Require valid-user. Save the file and exit nano.

The final results will look like the above

Now restart Apache for changes to take effect

$ sudo systemctl restart apache2

You can now verify that both Apache and Nagios4 are running by using the following commands:

$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-11-20 13:14:03 UTC; 16s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 31569 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 31590 (apache2)
      Tasks: 6 (limit: 2344)
     Memory: 10.1M
     CGroup: /system.slice/apache2.service
             ├─31590 /usr/sbin/apache2 -k start
             ├─31591 /usr/sbin/apache2 -k start
             ├─31592 /usr/sbin/apache2 -k start
             ├─31593 /usr/sbin/apache2 -k start
             ├─31594 /usr/sbin/apache2 -k start
             └─31595 /usr/sbin/apache2 -k start

Nov 20 13:14:03 ubuntu-20 systemd[1]: Starting The Apache HTTP Server...
Nov 20 13:14:03 ubuntu-20 apachectl[31587]: AH00558: apache2: Could not reliably determine the server's fully qu>
Nov 20 13:14:03 ubuntu-20 systemd[1]: Started The Apache HTTP Server.
$ sudo systemctl status nagios4
● nagios4.service - LSB: nagios host/service/network monitoring and management system
     Loaded: loaded (/etc/init.d/nagios4; generated)
     Active: active (running) since Sat 2021-11-20 13:04:30 UTC; 11min ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 6 (limit: 2344)
     Memory: 3.7M
     CGroup: /system.slice/nagios4.service
             ├─26535 /usr/sbin/nagios4 -d /etc/nagios4/nagios.cfg
             ├─26536 /usr/sbin/nagios4 --worker /var/lib/nagios4/rw/nagios.qh
             ├─26537 /usr/sbin/nagios4 --worker /var/lib/nagios4/rw/nagios.qh
             ├─26538 /usr/sbin/nagios4 --worker /var/lib/nagios4/rw/nagios.qh
             ├─26539 /usr/sbin/nagios4 --worker /var/lib/nagios4/rw/nagios.qh
             └─26561 /usr/sbin/nagios4 -d /etc/nagios4/nagios.cfg

Nov 20 13:09:52 ubuntu-20 nagios4[26535]: SERVICE ALERT: localhost;Swap Usage;CRITICAL;SOFT;2;SWAP CRITICAL - 0%>
Nov 20 13:10:52 ubuntu-20 nagios4[26535]: SERVICE ALERT: localhost;Swap Usage;CRITICAL;SOFT;3;SWAP CRITICAL - 0%>
Nov 20 13:11:52 ubuntu-20 nagios4[26535]: SERVICE ALERT: localhost;Swap Usage;CRITICAL;HARD;4;SWAP CRITICAL - 0%>
Nov 20 13:11:52 ubuntu-20 nagios4[26535]: SERVICE NOTIFICATION: nagiosadmin;localhost;Swap Usage;CRITICAL;notify>
Nov 20 13:11:52 ubuntu-20 postfix/sendmail[31551]: fatal: open /etc/postfix/main.cf: No such file or directory
Nov 20 13:11:52 ubuntu-20 nagios4[26535]: wproc: NOTIFY job 4 from worker Core Worker 26539 is a non-check helpe>
Nov 20 13:11:52 ubuntu-20 nagios4[26535]: wproc:   host=localhost; service=Swap Usage; contact=nagiosadmin
Nov 20 13:11:52 ubuntu-20 nagios4[26535]: wproc:   early_timeout=0; exited_ok=1; wait_status=256; error_code=0;
Nov 20 13:11:52 ubuntu-20 nagios4[26535]: wproc:   stderr line 01: send-mail: fatal: open /etc/postfix/main.cf: >
Nov 20 13:11:52 ubuntu-20 nagios4[26535]: wproc:   stderr line 02: Can't send mail: sendmail process failed with>

Postfix is not running because I did not want to send emails but you can allow that when prompted during installation.

Creating a User Account

Nagios is configured by default to grant administrative privileges to the user called nagiosadmin. We use htdigest to create users.

Use the following command to create a new user:

$ sudo htdigest -c /etc/nagios4/htdigest.users Nagios4 nagiosadmin
Adding password for nagiosadmin in realm Nagios4.
New password: <password>
Re-type new password: <password>

Restart Apache service for effects to take place

Configure Firewall

Configure a firewall with UFW configuration tool and allow HTTP and HTTPS to pass through to allow Apache to be reachable.

$ sudo ufw allow Apache
Rules updated
Rules updated (v6)

Accessing Nagios Web Interface

To access Nagios from the web interface use the following command:

$ http://<IP_Address>/nagios4

Conclusion

From the above tutorial you are now in a position to install Nagios in your server to help you monitor your services. You can read more by reading Nagios Documentation

How to install Prometheus 2.30.3 Server in Ubuntu 20.04

In this guide, we will learn how to install the Prometheus server on Ubuntu 20.04. Prometheus is an open-source system monitoring and alerting toolkit. Prometheus collects and stores its metrics as time-series data. Metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels.

And now you are wondering what are metrics? Metrics are numeric measurements and time series mean that the changes are recorded over time.

Components

Related Article

Install Prometheus 2.30

Let us update the system first:

$ sudo apt update

Download and install Prometheus

Download the latest release of 2.30.3 into our system.

$ wget https://github.com/prometheus/prometheus/releases/download/v2.30.3/prometheus-2.30.3.linux-amd64.tar.gz

After the download is complete, the next step is to extract the archive:

$ tar xvf prometheus-2.30.3.linux-amd64.tar.gz

For convenience, we can change the directory for the extracted archive

$ cd prometheus-2.30.3.linux-amd64

From there we can create a configuration file directory

$ sudo mkdir -p /etc/prometheus

Then we can create the data directory

$sudo mkdir -p /var/lib/prometheus

Let’s now move the binary files Prometheus and promtool to /usr/local/bin/

Use the following code snippet

$ sudo mv prometheus promtool /usr/local/bin/

Move the template configuration file prometheus.yml to /etc/prometheus/ directory

$ sudo mv prometheus.yml /etc/prometheus/prometheus.yml

We have installed Prometheus. Lets verify the version

$ prometheus --version

Create Prometheus System group

The following code can help create the Prometheus system group.

$ sudo groupadd --system prometheus

We can then create Prometheus system user and assign the primary group created

$ sudo useradd -s /sbin/nologin --system -g prometheus prometheus

Set the ownership of Prometheus files and data directories to the Prometheus group and user.

$ sudo chown -R prometheus:prometheus /etc/prometheus/  /var/lib/prometheus/

$ sudo chmod -R 775 /etc/prometheus/ /var/lib/prometheus/

Lastly, we can create a systemd service to run at boot time

$ sudo nano /etc/systemd/system/prometheus.service

Add the following content to prometheus.service

[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

Start the Prometheus service

$ sudo systemctl start prometheus

Now we can check if our Prometheus is up and running

$ sudo systemctl status prometheus

Add firewall rules to allow Prometheus to run on TCP port 9090

$ ufw allow 9090/tcp

Access your server from the browser.

http://<ip address>or<hostname>:9090

for example

http://192.0.1.1:9090

Conclusion

Congratulations! you have successfully installed Prometheus on Ubuntu 20.04. To read more consult Prometheus documentation.