Remote Server Monitoring with Cockpit

Published on September 24, 2022 at 6:37 pm by LEW

Introduction

The cockpit suit of programs/applications provides a method of monitoring/controlling remote Linux based computer systems through a web browser based Graphical User Interface. This can be very useful for monitoring multiple servers through one easy to use interface.

Information about the cockpit application can be found at the cockpit project page. Note that cockpit is available in most Linux Distribution (Distro) repositories, so it should be easy to install.

The cockpit application has to be installed on the computer (server) you want to monitor. It has its own web interface built in so you do not need to install a web server.

From the client side you can monitor multiple cockpit instances on different servers in a single web instance. Or you can open a web page for each server. Note that cockpit must be installed on a server for the client to connect.

Caveats

One thing to note from the cockpit project website, cockpit is regularly tested against Google Chrome and Firefox, while only periodicity tested against Microsoft Edge, Apple Safari and Epiphany. Other browsers are not mentioned. While not a recommendation for any specific browser, for initial testing you should probably stick to Chrome or Firefox. Once you have it working to your satisfaction, then you can confidently test some other browsers for their functionality with cockpit.

I have also found one dependency issue in Debian 11. This is with an add on, and not the core cockpit application. It is also based on how you use cockpit. In the Debian repositories, for the cockpit-pcp package, no archive utility is required, recommended, or suggested. If you are going to load pcp, and activate archiving of performance information, you will have non fatal log errors unless an archive application is installed. I am not sure what eh default should be, and will have to look into the code at some point..

In Debian 11 I have also found a call to a non existent directory error in the log files. This is on a standard Debian install. It is a non fatal error, and you can create the folder to hide the error. Specifically the missing folder is;

/usr/lib/x86_64-linux-gnu/udisks2/modules

Pre Install Configuration Recommendations

Clean Install: My first recommendation here is if at all possible, install cockpit on a clean initial server build. Then do your testing. After you are satisfied with the functionality, you can add your server application. This is not always possible, in which case I would recommend doing any testing on a clean install on a spare computer, before installing on a production server.

Firewall Settings: The cockpit application uses port 9090. If you have a firewall setup, you will need to open that port for a default cockpit install to work at all.

Data Archive: If you plan on using the data archiving functionality of cockpit-pcp, you will want to make sure that some arching utility is installed. Note this issue was observed on Debian 11 and may only be applicable there.

Missing Folder: You may want to create the folder “/usr/lib/x86_64-linux-gnu/udisks2/module” before the install to avoid a warning in the log files. Note this issue was observed on Debian 11 and may only be applicable there.

Installing

I will be working with Debian 11 for this install. Other distributions should be similar with the possible exception of package manager specific commands.

The first thing I want to do is check the Debian 11 cockpit package. This is a recent process I started practicing, but should have been doing all along. This can take some time, so how much of it you do will depend on your level of paranoia. I mainly do it with packages I have never used before.

To do that I do an Internet search, and get directed to https://packages.debian.org/bullseye/cockpit . Here you will find a list of required (depends) packages, recommended packages, and suggested packages. At the bottom of the page are links to download the package or just list the files in the package. I suggest you at least look at the file list, so you will know where things are going to be installed.

For those security minded individuals, you can download the package and unpack/examine its contents without installing (using an application like 7-zip on Windows). On the right side of the page you can download the source code and review it if you require more in depth analysis.

Because of the way apt (package manager) is setup, unless you change it, you will get all the recommended packages when you install cockpit. Note: if you do not want this behavior, you can add the –no-install-recommends flag to the apt command options.

Since I want the depends, my install command will look like this on Debian 11 (you will need to be logged in as root or use sudo). I install bzip2 (see above) and openssh so I can run the server headless. Then I install the cockpit application application. Note this includes updating and upgrading your system before installing, which you should be doing on a regular basis.

apt update
apt upgrade
apt install xz-utils openssh-server
apt install cockpit

Once everything is installed, I like to do a restart. This is not strictly necessary though.

Before disconnecting the monitor and keyboard, you will want to log in and check a few items. First if the ssh server is running, then if cockpit is running.

Operations

You access cockpit by pointing your web browser at your server, and using port 9090. Log in using your credentials (name and password) for existing accounts on the server.

The interface, for the most part is fairly simple and well laid out. The one part that might not be obvious is adding other instances to the interface. This is done form the upper left corner drop down, using the “Add new host” button. However I found that opening separate interfaces in a tabbed browser worked better for me. How useful you find it will vary.

Issues With PCP Modules

I tried installing the Cockpit-PCP module which uses the Performance Co-Pilot (PCP) suit of application. This is one of the main reasons I wanted to test out cockpit. The PCP suit allows you to collect and analyze performance data over time.

Generally speaking the PCP application ran well. The main issue I had was with the pmlogger_daily module, about fifty percent of the time it could not find the compression application. The pmlogger application rotates your log files, so is not critical to overall function.

Note, since both cockpit and pcp were created on Red hat, and ported to Debian, troubleshooting the problem can be confusing to say the least. I may come back to this someday when I have the time too dive into the packages and figure out how to alter the configuration to make it work properly I am pretty sure it is a configuration issue).

Conclusion

Since data logging and review was one of the reasons I wanted to try out cockpit, and it was extremely problematic on the Debian 11 build, I have decided to remove the cockpit application until I have the time to properly troubleshoot the problem with pmlogger_daily. Without the archiving function, I can achieve the same level of monitoring with a shell script, standard BASH utilities, and an ssh login.

My personal opinion, for what it is worth, cockpit (at least on Debian 11) needs a better configuration system. I believe if if I could have found the configuration file for pmlogger_daily, without digging around in the packages, I could have resolved the archive issue. I suspect since it works sometimes, it is a timing error of some sort.

 

Add New Comment

Your email address will not be published. Required fields are marked *