Zum Inhalt springen

Smokeping unter Red Hat Linux: Unterschied zwischen den Versionen

Aus LHlab Wiki
Keine Bearbeitungszusammenfassung
K Textersetzung - „</source>“ durch „</syntaxhighlight>“
Zeile 6: Zeile 6:
<source lang=bash>
<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
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
</source>
</syntaxhighlight>
dann den apache Server in den Autostart befördern:
dann den apache Server in den Autostart befördern:
<source lang=bash>
<source lang=bash>
chkconfig httpd on
chkconfig httpd on
</source>
</syntaxhighlight>
Nun noch ein paar PERL Module via cpan nachinstallieren:
Nun noch ein paar PERL Module via cpan nachinstallieren:
<source lang=bash>
<source lang=bash>
cpan
cpan
</source>
</syntaxhighlight>
dann im cpan:
dann im cpan:
<pre>
<pre>
Zeile 36: Zeile 36:
mkdir /opt/smokeping/var
mkdir /opt/smokeping/var
chmod o-r /opt/smokeping/etc/smokeping_secrets.dist
chmod o-r /opt/smokeping/etc/smokeping_secrets.dist
</source>
</syntaxhighlight>


== Konfiguration ==
== Konfiguration ==
Zeile 43: Zeile 43:
cp bin/smokeping_cgi htdocs/smokeping.cgi
cp bin/smokeping_cgi htdocs/smokeping.cgi
mv etc/config.dist etc/config
mv etc/config.dist etc/config
</source>
</syntaxhighlight>


Ich werde hier nur auf die Basics eingehen, die Konfiguriert werden sollten, alle weiteren Einstellungen kann man in der Dokumentation von smokeping nachlesen:
Ich werde hier nur auf die Basics eingehen, die Konfiguriert werden sollten, alle weiteren Einstellungen kann man in der Dokumentation von smokeping nachlesen:
Zeile 138: Zeile 138:
apachectl configtest
apachectl configtest
apachectl restart
apachectl restart
</source>
</syntaxhighlight>
Nun sollte unter folgender URL ein erster Preview möglich sein:
Nun sollte unter folgender URL ein erster Preview möglich sein:
* <nowiki>http://IPorSERVERNAME/smokeping/smokeping.cgi</nowiki>
* <nowiki>http://IPorSERVERNAME/smokeping/smokeping.cgi</nowiki>
Zeile 144: Zeile 144:
== Test und Init Skript ==
== Test und Init Skript ==
Der erste Test kann nun wie folgt erfolgen, hier sollte nun einmalig ein smokeping Durchlauf stattfinden.
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</source>
<source lang=bash>./bin/smokeping --config=/opt/smokeping/etc/config --debug</syntaxhighlight>
der folgende Aufruf startet smokeping
der folgende Aufruf startet smokeping
<source lang=bash>
<source lang=bash>
./bin/smokeping --config=/opt/smokeping/etc/config --logfile=smoke.log
./bin/smokeping --config=/opt/smokeping/etc/config --logfile=smoke.log
</source>
</syntaxhighlight>
Läuft alles wie gewollt, kann man das folgende INIT Script verwenden. Als vorlage diente hier das original [http://oss.oetiker.ch/smokeping/pub/contrib/smokeping-start-script INIT Script von Michel Tokic].<br>
Läuft alles wie gewollt, kann man das folgende INIT Script verwenden. Als vorlage diente hier das original [http://oss.oetiker.ch/smokeping/pub/contrib/smokeping-start-script INIT Script von Michel Tokic].<br>
<code>/etc/init.d/smokeping</code>
<code>/etc/init.d/smokeping</code>
Zeile 155: Zeile 155:




</source>
</syntaxhighlight>
nun noch in den Autostart und starten:
nun noch in den Autostart und starten:
<source lang=bash>
<source lang=bash>
Zeile 161: Zeile 161:
chkconfig smokeping on
chkconfig smokeping on
/etc/init.d/smokeping start
/etc/init.d/smokeping start
</source>
</syntaxhighlight>
mit dem folgenden Befehl kann der Autostart geprüft werden:
mit dem folgenden Befehl kann der Autostart geprüft werden:
<source lang=bash>
<source lang=bash>
chkconfig --list smokeping
chkconfig --list smokeping
</source>
</syntaxhighlight>
<pre>smokeping      0:off  1:off  2:on    3:on    4:on    5:on    6:off</pre>
<pre>smokeping      0:off  1:off  2:on    3:on    4:on    5:on    6:off</pre>
Die folgenden Optionen sind beim init Script verfügbar:
Die folgenden Optionen sind beim init Script verfügbar:

Version vom 1. Januar 2021, 21:18 Uhr

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

Quellen