Category Archives: tech

timeout

I can’t believe I’ve missed this: the timeout command of coreutils. It kills a job if it runs longer than a specific time. So if you want to make sure your long_running_job is furnished the next day, when production hours start again:

timeout --kill-after 12h --signal 9 long_running_job

Opsview and large check results (patch NSCA)

Ton posted how to increase the NRPE data load to 16k. But if you use Opsview in a distributed environment (got slaves) you also have to adjust NSCA for large output.

That’s quite easy. Patch and recompile nsca-2.7.2 and change the nsca binary on the master and send_nrpe on the slaves. So the now-up-to-16k check results are sent to, and recieved by, the master. Here’s the NSCA-2.7.2 16k patch containing the necessary changes to common.h.

Visualize your nagios configuration

It’s unfair: The database admin got his DB layout, net network admin the network diagram. The sysadmin looses.

Now you’re able to plot the Nagios configuration with plot-config.pl to compete with others!  And it comes in handy to show it off, search for errors or documentation.

plot-config.pl walks through nagios configuration files and draws depencies between hosts (parent-child) and (optionally) shows the services per host. You can plot the graphviz graph bottom-up or left-right and even neato or circo graphs. Though the output is a colored SVG it’s jut a quick & dirty hack.

Here an example output of plot-config.pl (without services):

very minimal output of plog-config.pl
very minimal output of plog-config.pl

gentoo: stablize a ~x86 system

Of course I run gentoo and I like it to stick to the latest (masked) Gnome version. As it is quite a task to control every package prior to adding it to package.keywords, I worte upgrade_all.

‘upgrade_all’ walks through ‘world’ and finds all packages that would be downgraded on next emerge, shows the according eix-stanza and prompts before adding a stablilizing line to package.keywords. Though it’s a quick shot it works for me, so feel free to edit and extend it, but don’t forget to let me know.

SFTP without chroot

Today I needed to configure a sftp server as replacement for the standard ftpd. I was shocked as alomst any documentation can be found via google. But it’s rather simple so here’s what I’ve done on AIX:

Install openssh (have a look at the IBM LinuxToolbox), sftp should be activated per default. Check /etc/ssh/sshd_config for the line http://www-1.ibm.com/servers/aix/products/aixos/linux/download.html

Now you have to configure sftp-server as login-command:

  • add /usr/sbin/sftp-server as allowed login shell to /etc/security/login.cfg
  • assign sftp-server as login-command to the sftp-user
    • per smit: look for Initial PROGRAM
    • manually: edit /etc/passwd, so the sftp-users line looks like
      sftp-user:!:1010:1010:mailto.sftp@localhost:/home/sftp:/usr/sbin/sftp-server
  • If you changed the sshd_config restart the sshd-subsystem:

    stopsrc -s sshd
    startsrc -s sshd

That’s it! The sftp-user should be able to login via sftp, like sftp sftp-user@localhost and end up in its home-directory with no shell, just sftp.

Kurzeinführung in die Bedienung von Atlas.ti

Eine gute Freundin meiner sitzt gerade an ihrer Diplomarbeit und wird dabi Atlas.ti, eine Software, die qualitative Inhaltsanalyse unterstützt, einsetzten. Dazu steht ihr eine ältere Version von Atlas.ti zur Verfügung. Ich wurde gebeten, ihr das Programm zu erklären.

Dazu habe ich gleich ein kleines Dokument verfasst, dass trotz seiner Kürze vielleicht auch anderen beim Einstieg in Atlas.ti behilflich ist, daher stelle ich es gleich hier rein: Kurzeinführung in die Bedienung von Atlas.ti (pdf)

LaTeX Tips & Tricks

utf8

  • usepackage[utf8]{inputenc}

keine umlaute im pdf

  • cm-super fonts installieren (bei gentoo über ebuild aus bugs.gentoo.org)
  • usepackage[T1]{fontenc}

Euler Skript verwenden

  • z.b. $mathfrak{P}$ um das Euler-P für die Potenzmenge zu erhalten

Limits kann nicht verwedet werden
( Fehlermeldung: “! Limit controls must follow a math operator.”)

  • Das Zeichen, welche mit limits verwehen werden soll, in mathop{} einschließen

keine Zeichen für Zahlenbereiche verfügbar

  • amsfonst laden
  •  usepackage{amsfonts}
  • gewünschte symbole deklarieren
  • DeclareMathSymbol{N}{mathord}{AMSb}{“4E}
  • DeclareMathSymbol{Z}{mathord}{AMSb}{“5A}
  • DeclareMathSymbol{Q}{mathord}{AMSb}{“51}
  • DeclareMathSymbol{C}{mathord}{AMSb}{“43}

statt {n atop k} sollte binom{n}{k} verwendet werden!

Acer AL1916W: running Xorg at 1440×900

I recently purchased an Acer AL1916W, a nice Widescreen TFT with an unusual resolution of 1440×900 px, which was at first a challenge to configure. I tried various setups in xorg.conf, en- and disabled DDC, even wrote my own modelines. The best I got was an 1440×900 resolution with black broders (~ 3 cm) on the left and right.

Until i read the manual (RTFM!), which I couldn’t find at the Acer Worldwide Homepage, so i provide it here: Acer AL1916W Handbook. At the end of the manual the reference signalmodes are listed:

Display Mode: WXGA 1440×900
Horizontal Frequency (kHz): 55.935
Vertical Frequency (Hz): 55.887
Pixel Frequency (MHz): 106.5
SYNC Polarity (H/V): -/+

At first i was puzzeld, because the refreshrate isn’t an integer (as I thought it should be). Nevertheless I used gtf, a small xorg-tool to calculate VESA Modlines, with this values:

~ # gtf 1440 900 55.887

# 1440x900 @ 55.89 Hz (GTF) hsync: 51.97 kHz; pclk: 98.96 MHz
Modeline "1440x900_55.89" 98.96 1440 1520 1672 1904 900 901 904 930 -HSync +Vsync

Using this ModeLine in xorg.conf, the Acer detects a 60 Hz refresh rate, and the auto-adjust works fine, the borders are gone.

awstats under debian

While setting up awstats und debian, I ran into some errors. Here’s what happened, and how to get over it.

Get awstats

~# apt-get install awstats

Configure awstats

~# cd /usr/local/awstats/
/usr/local/awstats# perl awstats_configure.pl

answer the questions, and the configure script failes with

Error: Failed to open '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf' for read.

Hmm … the awstats.model.conf and the wwwroot directory don’t exist, so I ran

~# gunzip -v /usr/share/doc/awstats/examples/awstats.model.conf.gz

And beacuse the debian installer doens’t adapt the configure script, edit the head of /usr/share/doc/awstats/examples/awstats_configure.pl to

$AWSTATS_PATH='/usr/share/awstats';
$AWSTATS_ICON_PATH='/usr/share/awstats/icon';
$AWSTATS_CSS_PATH='/usr/share/awstats/css';
$AWSTATS_CLASSES_PATH='/usr/share/awstats/lib';
$AWSTATS_CGI_PATH='/usr/lib/cgi-bin';
$AWSTATS_MODEL_CONFIG='/usr/share/doc/awstats/examples/awstats.model.conf';
$AWSTATS_DIRDATA_PATH='/var/lib/awstats';

Now awstats_configure.pl works!

Because I use apache2, i had to edit /etc/awstats/awstats.yourdomain.com.conf

LogFile="/var/log/apache2/access.log"

Before the awstats-Site is viewable, the perlscript has to be executable by the apache2 user

~# chown www-data /usr/lib/cgi-bin/awstats.pl

That’s it, awstats is up. It has just a minimal configuration, but works. Everybody should read the available documentation, to get awstats with all the features.