Monitoring with GKrellm Server Over SSH…


I thought I would post how I got gkrellm server set up to monitor the health of my son’s computer upstairs. I first set up certificate-based SSH logins (restricted on each computer to disallow root logins, of course):

  • Make sure sshd is running on the server you wish to login to, and using version 2 (by now, there should be no need to use version1).
  • ssh-keygen – t rsa : This makes the public/private key pair. Press <ENTER> twice to them with no passphrase (simplifies logins, but there is a security trade-off, so do this in an environment you trust – like a protected home network). Look for the files id_rsa and id_rsa.pub in your /home/username/.ssh directory.
  • scp /home/username/.ssh/id_rsa.pub <server IP>:/home/username/.ssh : Copies the public key from the ssh directory on the client to the same directory on the server.
  • cat id_rsa.pub >> authorized_keys2 : Appends the key to the server’s authorized keys file.
  • chmod 0600 authorized_keys2 : Log into the server and set the permissions on the file. Be sure to remove the id_rsa.pub file.
  • Test by logging into the server from the client with ssh <server name or IP>. If it works, you should not be prompted for a password.

Reference link: http://www.securitydocs.com/library/3385

Next, I made sure gkrellm was installed: urpmi -a gkrellm- works nicely (Mandriva).  It gets the client, server, and lots of handy plugins and themes. For other distros, use your specific update method.

Then I edited the /etc/gkrellmd.conf file on the server:

  • update-hz 5
  • max-clients 2
  • port 52873 – set this to any unsused port if you do not want to use the default port
  • allow-host <client IP>

and restarted the service – service gkrellmd restart – to ensure the new settings were in effect.

Next, I tested it using the following command on the client: ssh -f -L <any unused port, can be the same as the gkrellmd port>:<server IP>:<gkrellmd port> <server IP> “gkrellm -f -s 127.0.0.1 -P <gkrellmd port>”.

Example: ssh -f -L 54352:192.168.0.4:52873 192.168.0.4 “gkrellm -f -s 127.0.0.1 -P 52873″

If successful, a gkrellm screen should appear on your desktop, displaying the stats (name, kernel version, load, etc.) of the remote server.

GKrellm Server

The shorter bar on the left is the upstairs server. The longer bar on the right is the local machine.

To ensure it started each time I logged into my desktop, I placed the command inside an executable script, which I copied into my .kde/Autostart/ directory. Now I can see how many users are logged in upstairs, the CPU and network load, uptime, drive activity, and partition space, all at a glance.

About these ads

One Response

  1. just had a go at this…

    the ssh command that you list above actually seems to run an X client on my server box and connect to my client box’s X server – not what I wanted – and I don’t see why this should need to run the gkrellm daemon for this…

    however, simply running ‘gkrellm –server ‘ seems to work fine, running the X client on my client box and receiving stats from the gkrellm daemon on the server box !

    …but I may have misunderstood…

    thanks for pointing me at gkrellmd – just what I was looking for :-)

    Jules

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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: