System monitoring with Gkrellm

Gkrellm is perhaps the best known system monitor for Linux, and is widely regarded as best of breed. It can trigger alarms and run scripts to perform actions such as automatically shutting down the box under certain conditions. It works out of the box for most users and, as a linux.com review puts it, “is so popular it may have more plugins than other projects have users.” Uses GTK.

Gkrellm is available for multiple operating systems. These notes are Linux-centric but should be applicable to other platforms.

What follows assumes you have already set up hardware monitoring.

INSTALLATION
On Linux, many distributions have gkrellm in their package manager. While there, consider any optional plugins or themes. You can also install plugins and themes manually, which is handy if you want something your package manager does not carry.

Plugins
I find gkrellm’s built-in abilities adequate for my needs and don’t use plugins. The following is what little I know about them, but I don’t speak from experience.

On Linux, the user’s plugin directory is ~/.gkrellm2/plugins/, and the system-wide directory is (depending on your distribution) /usr/local/lib/gkrellm2/plugins/ or /usr/lib/gkrellm2/plugins/. If you install plugins while gkrellm is running, you will have to restart gkrellm for them to be detected.

The gkrellm project site has a good list of plugins. Many of the links on that list are obsolete, however, so be ready to do some searching once you find something interesting.

Themes
Copy uncompressed themes into the themes directory, each theme going into its own subdirectory. On Linux, the user’s themes directory is ~/.gkrellm2/themes/, and the system-wide directory is (depending on your distribution) /usr/local/share/gkrellm2/themes/ or /usr/share/gkrellm2/themes/. If you have the gkrellm configuration editor open when you install a theme, you will have to close and reopen it before it will appear.

One good source for themes is the Gkrellm theme repository.

SETUP
Gkrellm can be run from the command line with gkrellm. Many users, myself included, prefer to have it automatically started by the desktop environment or window manager at startup. How this is done is environment-specific.

Once running, gkrellm will appear on your desktop. Select it with alt-click and press F1 to open the configuration editor, where you will find many options. I like to tweak things, so I have a long list of preferred non-default settings:

General

  • Options – Remember screen location: Enabled
  • Options – Gkrellm width: 75
  • Properties – Set sticky state: Enabled
  • Properties – Set on top of other windows: Disabled
  • Properties – Do not include on a taskbar: Disabled

Builtins – Sensors

  • Setup – Temperatures – coretemp-hwmon0/temp2: Enabled
  • Setup – Temperatures – coretemp-hwmon0/temp2 – Label: cpu0
  • Setup – Temperatures – coretemp-hwmon0/temp2 – Location: cpu0
  • Setup – Temperatures – coretemp-hwmon0/temp3: Enabled
  • Setup – Temperatures – coretemp-hwmon0/temp3 – Label: cpu1
  • Setup – Temperatures – coretemp-hwmon0/temp3 – Location: cpu1
  • Setup – Temperatures – hddtemp/sda: Enabled
  • Setup – Temperatures – hddtemp/sda – Label: sda
  • Setup – Temperatures – hddtemp/sda – Location: Default
  • Setup – Fans – fan2: Enabled
  • Setup – Fans – fan2 – Alerts – Low warn limit: 1300
  • Setup – Fans – fan2 – Alerts – Low alarm limit: 1000

Builtins – CPU

  • Options – Apply any CPU chart config height change to all CPU charts: Yes
  • Options – SMP Charts Select: Real CPUs
  • Setup – Format String for Chart Labels: $T
  • Setup – Launch Commands – cpu command: xfce4-terminal –title htop –execute htop –sort-key PERCENT_CPU
  • Setup – Launch Commands – comment: View CPU load

Builtins – Net

  • eth0 – Enable eth0: Yes
  • eth0 – Launch Commands – Command: xfce4-terminal –title iftop –execute sudo iftop
  • eth0 – Launch Commands – Comment: View bandwidth use

Builtins – Memory

  • Options – Swap – Enable swap meter: Yes
  • Options – Swap – Alerts – TODO
  • Options – Memory – Enable memory meter: Yes
  • Setup – Launch Commands – Memory Command: xfce4-terminal –title htop –execute htop –sort-key PERCENT_MEM
  • Setup – Launch Commands – Comment: View memory use

Builtins – Mail

  • Setup – Mailcheck: Enable
  • Setup – Mail reading program: xfterm4 mailx
  • Setup – Notify (sound) program: /usr/lib/libreoffice/basis-link/share/gallery/sounds/apert.wav
  • Mailboxes – Local mailbox: mbox protocol, path /var/spool/mail/USER
  • Mailboxes – Remote mailbox: Do not use; see “security considerations” below
  • Animation – Select: Envelope; run animation continuously as long as there is new mail

Themes

  • Theme: As desired
  • Fonts – Large font: Sans 9
  • Fonts – Normal font: Sans 8
  • Fonts – Small font: Sans 7

Each monitor’s chart can be additionally configured. Right clicking on it will open the respective chart config dialog. Non-default settings I prefer are:

CPU (applied to each core’s chart)

  • Number of Grids: 4
  • Chart height: 40

eth0

  • Resolution per Grid: Fixed; as appropriate
  • Number of Grids: 4
  • Chart height: 40

ALERTS AND COMMANDS
Many monitors can have alerts configured to notify you of data readings which range outside of configurable limits. Where available, press the “Alerts” button to configure them. A warning is a first order alert, and by default highlights the out of bound reading with an animated yellow background. An alarm is a second order alert and is highlighted in red. Optionally a command can be run on warning and/or alarm. The ability for an alert to call a command is, to my mind, the single most important feature of gkrellm.

As an example of the use of alerts, I have the following set up for each core of my processor, which has a rated maximum operating temperature of 73.3°C:

  • High alarm limit: 73°C
  • High warn limit: 70°C
  • Seconds limit conditions must exist to have an alert: 5
  • Alarm command: ~/sensor-hibernate.sh
  • Warn command: none

The dialog to enter this alert is found at Monitors – Builtins – Sensors – Temperatures. Select the particular sensor and temperature to set alerts for (in my case that was coretemp@0/temp1) and select “Alerts”.

Another example monitors the temperature of my hard disk, which has a rated maximum operating temperature of 60°C but ideally should not be run above 45°C:

  • High alarm limit: 60°C
  • High warn limit: 45°C
  • Seconds limit conditions must exist to have an alert: 5
  • Alarm command: ~/sensor-hibernate.sh
  • Warn command: none

This sensor is found at the same location and is named hddtemp/sda. Naturally your available sensors, their names, and the locations of their alert dialogs will vary.

A third example monitors the CPU fan velocity, which in my case should be about 1500 RPM:

  • Low alarm limit: 1000 RPM
  • Low warn limit: 1300 RPM
  • Seconds limit conditions must exist to have an alert: 5
  • Alarm command: ~/sensor-hibernate.sh
  • Warn command: none

The alarm command called in the examples above, ~/sensor-hibernate.sh, is a simple script I wrote that hibernates the system after mailing a report for diagnostic purposes.

COMMAND LAUNCHING
A command can be configured to be launched for most monitors. This is set in Monitors – Builtins – (Monitor name) – Setup – Launch Commands. If configured, a button will appear when the mouse enters the panel of that monitor. Clicking the button will launch the command. Three examples are seen above in my configuration settings for the CPU, net, and memory monitors.

Regarding the net monitor command, I use iftop, which in this context requires that the user running gkrellm has sudo privileges and the root password. That is not a problem for me, but if you are rolling out gkrellm for users who shouldn’t have the keys to the kingdom, you can use a tool such as etherape, ntop, or trisul.

BACKING UP
Gkrellm’s per-user files and data are found in ~/.gkrellm2/. I back up the files sensor-config, theme_config, and user-config.

SECURITY CONSIDERATIONS
If you choose to have Gkrellm check a remote mailbox for mail, your mail credentials including password will be stored unencrypted in plain text in ~/.gkrellm2/user-config.

REFERENCES
Gkrellm project site
Linux.com review

Advertisements

About Warren Post

So far: Customer support guy, jungle guide, IT consultant, beach bum, entrepreneur, teacher, diplomat, over-enthusiastic cyclist. Tomorrow: who knows?
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

7 Responses to System monitoring with Gkrellm

  1. anonymous says:

    Anonymous writes:HOW DO YOU BACK UP YOUR GKrellM SYS MONITOR SETTINGS SO THAT YOU CAN XFER THEM TO ANOTHER PC WITH GKrellM ON IT .. (LINUX )

  2. wpost says:

    On Linux, gkrellm's per-user files are found in ~/.gkrellm2/, and the fies sensor-config, theme_config, and user-config are probably what you're looking for. I haven't tried it, but presumably just copying those files from the original to the destination box should get you going.

  3. Pingback: System monitoring with Conky | Warren's tech notes

  4. Pingback: Hardware monitoring on Linux | A maze of twisty little passages

  5. Pingback: Setting up a lightweight workstation | A maze of twisty little passages

  6. Pingback: Hard disk temperature monitoring on Linux | A maze of twisty little passages

  7. Pingback: Hardware monitoring on Windows | A maze of twisty little passages

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s