Smokeping unter Red Hat Linux
Hier eine Anleitung wie man unter Red Hat Linux bzw. CentOS das Tool Smokeping zum Laufen bekommt. Ich habe dies anhand eines Red Hat Linux 6 64bit durchgeführt.
Abhängigkeiten erfüllen
Es wird das EPEL Repository benötigt! Mehr Infos wie man dies nutzt findet man hier:
Zuerst müssen die Abhängigkeiten für smokeping installiert werden: <source lang=bash> yum install httpd php php-common perl perl-CPAN perl-YAML rrdtool rrdtool-perl perl-libwww-perl perl-Socket6 perl-FCGI perl-CGI perl-Net-Telnet fping curl perl-Net-OpenSSH perl-Net-DNS perl-Test-Simple perl-CGI-SpeedyCGI perl-IO-Socket-SSL perl-LDAP </syntaxhighlight> dann den apache Server in den Autostart befördern: <source lang=bash> chkconfig httpd on </syntaxhighlight> Nun noch ein paar PERL Module via cpan nachinstallieren: <source lang=bash> cpan </syntaxhighlight> dann im cpan:
Config::Grammar
Installation Smokeping
Das neuste Paket bekommt ihr hier:
<source lang=bash> cd /usr/src/ wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz tar -xzvf smokeping-2.6.8.tar.gz cd smokeping-2.6.8 ./configure --prefix=/opt/smokeping make install ln -s /opt/smokeping/etc /etc/smokeping mkdir /opt/smokeping/htdocs/cache chmod 777 -R /opt/smokeping/htdocs/cache mkdir /opt/smokeping/data mkdir /opt/smokeping/var chmod o-r /opt/smokeping/etc/smokeping_secrets.dist </syntaxhighlight>
Konfiguration
<source lang=bash> cd /opt/smokeping cp bin/smokeping_cgi htdocs/smokeping.cgi mv etc/config.dist etc/config </syntaxhighlight>
Ich werde hier nur auf die Basics eingehen, die Konfiguriert werden sollten, alle weiteren Einstellungen kann man in der Dokumentation von smokeping nachlesen:
/etc/smokeping/config
*** General ***
*** General *** owner = YOURName contact = yourmail@domain.tld mailhost = localhost imgcache = /opt/smokeping/htdocs/cache imgurl = cache cgiurl = http://YOURSERVERIP/smokeping/smokeping.cgi
*** Alerts ***
*** Alerts *** to = yourmail@domain.tld from = smokealert@hostname.tld
*** Probes ***
*** Probes *** + FPing binary = /usr/sbin/fping + DNS binary = /usr/bin/dig lookup = domain-to-lookup.com pings = 5 step = 180 + Curl # probe-specific variables binary = /usr/bin/curl step = 60 follow_redirects = yes include_redirects = yes # a default for this target-specific variable urlformat = http://%host%/
*** Targets ***
# Ping Tests + PING probe = FPing menu = Ping Tests title = Ping Tests ++ SERVER1 menu = Server1 title = Ping Latency Server1 host = server1.domain.tld # HTTP Tests + HTTP probe = Curl menu = HTTP Tests title = Ping Tests ++ SERVER1 menu = Server1 title = HTTP Latency Server1 host = server1.domain.tld # DNS Tests + DNS probe = DNS menu = DNS Latency title = DNS Latency ++ SERVER1 host = server1.domain.tld
Nun sollte noch das Smokeping CGI über den Apache verfügbar gemacht werden. Hierfür sollte man folgende Zeilen der Apache Konfiguration anhängen. Will man das Ganze nur für einen vhost verfügbar machen, sollte man dies in der Vhost Konfiguration einfügen, ansonsten kann man einfach eine Datei /etc/httpd/conf.d/smokeping.conf mit dem folgenden Inhalt anlegen.
ScriptAlias /smokeping/smokeping.cgi /opt/smokeping/htdocs/smokeping.cgi
Alias /smokeping /opt/smokeping/htdocs
<Directory /opt/smokeping/htdocs>
Options -Indexes ExecCGI FollowSymLinks
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
Anschließend muss der Apache neugestartet werden: <source lang=bash> apachectl configtest apachectl restart </syntaxhighlight> Nun sollte unter folgender URL ein erster Preview möglich sein:
- http://IPorSERVERNAME/smokeping/smokeping.cgi
Test und Init Skript
Der erste Test kann nun wie folgt erfolgen, hier sollte nun einmalig ein smokeping Durchlauf stattfinden.
<source lang=bash>./bin/smokeping --config=/opt/smokeping/etc/config --debug</syntaxhighlight>
der folgende Aufruf startet smokeping
<source lang=bash>
./bin/smokeping --config=/opt/smokeping/etc/config --logfile=smoke.log
</syntaxhighlight>
Läuft alles wie gewollt, kann man das folgende INIT Script verwenden. Als vorlage diente hier das original INIT Script von Michel Tokic.
/etc/init.d/smokeping
<source lang=bash>
</syntaxhighlight> nun noch in den Autostart und starten: <source lang=bash> chkconfig --add smokeping chkconfig smokeping on /etc/init.d/smokeping start </syntaxhighlight> mit dem folgenden Befehl kann der Autostart geprüft werden: <source lang=bash> chkconfig --list smokeping </syntaxhighlight>
smokeping 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Die folgenden Optionen sind beim init Script verfügbar:
/etc/init.d/smokeping usage: /etc/init.d/smokeping (start|stop|restart|status|strace_debug|help) start - start smokeping stop - stop smokeping restart - restart smokeping if running or start if not running status - show status if smokeping is running or not help - this screen