After a rather long hiatus, here’s a bit of a technical brain dump while I have all the details in my mind.
I like graphs, and I like having them displayed on dedicated screens. My preferred way of doing this is to use Chrome on Linux to display the monitoring web page (generated by the likes of naglite2/nagdash or cactiview/graphview):
Whenever I set one of these machines up, I always spend an inordinate amount of time looking up obscure incantations on the internet. So here’s the comprehensive guide to setting one of these machines up. (Where these things are distribution-specific, they’re Debian/Ubuntuisms.)
Starting X up
You don’t want to fiddle with these machines using VNC/RDP, so
forget about window managers. Remove the desktop manager
(apt-get remove [mdm|gdm|xdm|...]
), and give your non-root
user the rights to start an X server in /etc/X11/Xwrapper.config
.
Now we can get X11 to run Chrome in the root window directly, by
editing ~/.Xinitrc
:
We’re using --no-default-browser-check
to suppress the initial welcome dialog,
and --kiosk
full-screens Chrome by default. Nonetheless, depending on your
Chrome version, you might still need to feed it a pre-existing profile
(in ~/.config/google-chrome
) to stop it from popping things up which
you need to click on.
To start X11, I use a short looping wrapper script, passing the
-nocursor
X option to stop the annoying cursor:
I run this backgrounded from a crontab @reboot
task. If you need to reload
Chrome for any reason, pkill chrome
will force an X restart (and without
a window manager that’s a pleasingly swift operation).
Dealing With Screen Blanking
You’ll probably find that the screen blanks after 15 minutes, which is
pretty annoying. Disabling this completely when you have no window
manager is fiddly, but the best way is to alter your xorg.conf
like so:
Section "ServerFlags"
Option "blank time" "0"
Option "standby time" "0"
Option "suspend time" "0"
Option "off time" "0"
EndSection
That inhibits screen power saving completely, but we like the environment so
we should probably switch it off when everyone’s gone home. You can do this
using the xset
command, through cron or similar:
DISPLAY=:0 xset dpms force [off|on]
Multiple Displays
Perhaps you want to attach multiple displays to one machine. As you’d expect, X makes this appropriately difficult. The default state for Xorg these days is to create a single desktop spanning both displays, but when you want to maximize a window on each screen, and without the assistance of a window manager which supports some kind of scripting, this isn’t ideal.
What we want is a separate X screen on each physical display, which is
(of course) called “Zaphod Mode”. In the xorg.conf
:
Section "Device"
Option "ZaphodHeads" "DVI-0"
Identifier "Card0"
Driver "radeon"
BusID "PCI:1:0:0"
Screen 0
EndSection
Section "Device"
Option "ZaphodHeads" "VGA-0"
Identifier "Card1"
Driver "radeon"
BusID "PCI:1:0:0"
Screen 1
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
EndSection
Section "Screen"
Identifier "Screen1"
Device "Card1"
EndSection
Section "ServerLayout"
Identifier "default"
Screen "Screen0" 0 0
Screen "Screen1" LeftOf "Screen0"
EndSection
Once this ugly deed is done, instead of one X display called :0
you’ll have two,
called :0.0
and :0.1
. To take advantage of both, you’ll need to use two separate
Chrome profiles (or it’ll try and be clever, and open a new window on the same
display as the existing session). Copy ~/.config/google-chrome
to
~/.config/google-chrome-2
and alter your .Xinitrc as follows:
Conclusion
This should be a chef cookbook. I’m planning on putting one together for our next monitoring project (which involves the six Raspberry Pis currently on my desk…).
I'm currently looking for contract work in London or remote — if you're interested, get in touch.
To comment on this post, mention me on twitter, or drop me an email.