Seite wählen

NETWAYS Blog

March Snap 2018 > OSBConf2018, Icinga 2 Book Reloaded, OS Monitoring, OSDC, NETWAYS Monitoring


Hello Sunshine!! Blerim shared the most important things to consider while writing „the impact of voice and tone in writing“. Then followed Systemd- Unitfiles and Multi-Instanz- Setups by Dirk, Isabel ’s news on NETWAYS Monitor for Temperature and humidity, Keya’s insights on the Ceph training and Nicole`s stories about NETWAYS Web Services: Meet and greet at Icinga Camp Berlin 2018.
Here is the checklist to be a speaker at the OSBConf2018 and early bird discount said Keya. Marius let us know that Gitlab now supports Let’s Encrypt. Gunnar showed us how to play in the cloud. Killian talked about server maintenance for colleagues. Keya announced the NETWAYS upcoming April TrainingsJohannes taught us RT Extensions Made Easy. Lennart announced Icinga 2 Book Reloaded. Let’s talk about OS Monitoring said KeyaPhilips Brilliance 258B6 and macOS were brought to us by Tim. Markus talked about MSSQL databases from Icinga Web 2Daniel reported on Elastic {ON} 2018 Travel Report and Review.

Keya Kher
Keya Kher
Marketing Specialist

Keya ist seit Oktober 2017 in unserem Marketing Team. Nach ihrer Elternzeit ist sie seit Februar 2024 wieder zurück, um sich speziell um Icinga-Themen zu kümmern. Wenn sie sich nicht kreativ auslebt, entdeckt sie andere Städte oder schmökert in einem Buch. Ihr Favorit ist “The Shiva Trilogy”.  

MSSQL databases from Icinga Web 2

Disclaimer: This guide is only for RedHat and CentOS 7, using the PHP SCL packages with the official icingaweb2 package.
Often when we help customers implement Icinga 2, Icinga Web 2 and Director, they use custom imports to pull in data to their monitoring config. Whenever data is in need to be pulled from a MSSQL database, this can be challenging. Their are multiple guides around the Internet, even from Microsoft.
This post should clear things how to achieve this with the official Icinga packages and their requirements.

Requirements

Basic Installation Icinga Web 2

First of all icingaweb2 and PHP needs to be installed – usually you should have this already…

# on RedHat
subscription-manager repos --enable rhel-7-server-optional-rpms
subscription-manager repos --enable rhel-server-rhscl-7-rpms
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# on CentOS
yum install centos-release-scl epel-release
yum install httpd icingaweb2
systemctl start httpd.service
systemctl enable httpd.service
echo "date.timezone = Europe/Berlin" > /etc/opt/rh/rh-php71/php.d/timezone.ini
systemctl start rh-php71-php-fpm.service
systemctl enable rh-php71-php-fpm.service

Please also see the official documentation.

MSSQL PDO driver for PHP

Their are multiple ways to install a MSSQL compatible driver, but with icingaweb2 and the ZendFramework below in mind, we need to use pdo_dblib with FreeTDS as driver implementation. I prepared a RPM spec file for you to build and install, it is based on the php-extras packages shipped with Fedora’s EPEL, only updated for PHP 7.1 SCL.
You can setup a small RPM build environment on a RedHat or CentOS machine with the required repositories.

sudo yum install rpm-build rpmdevtools yum-utils gcc gcc-c++ scl-utils scl-utils-build
rpmdev-setuptree
cd ~/rpmbuild/SPEC
wget https://github.com/lazyfrosch/rpm-php-extras/raw/epel7/php-extras.spec
cd ../SOURCES
spectool -gf ../SPECS/php-extras.spec
cd ~/rpmbuild
rpmbuild -bs SPECS/php-extras.spec
sudo yum-builddep SRPMS/rh-php71-php-extras*.src.rpm
rpmbuild --rebuild SRPMS/rh-php71-php-extras*.src.rpm

With the built RPM files under RPMS/ you are good to go to your Icinga machine. Basically you only need to copy rh-php71-php-mssql*.rpm over and install it there.

yum install rh-php71-php-mssql*.rpm
scl enable rh-php71 -- php -m

After restarting php-fpm the driver has been loaded.

systemctl restart rh-php71-php-fpm.service

Patching Icinga Web 2

In Icinga Web 2.5.1 and before there is an error in detecting MSSQL correctly, detection only works in PHP 5.x. A fix has been suggested in PR#3400.
To manually patch this, you only need to fix a single line in /usr/share/php/Icinga/Application/Platform.php

--- /usr/share/php/Icinga/Application/Platform.php.orig 2018-03-27 06:02:59.454240788 -0400
+++ /usr/share/php/Icinga/Application/Platform.php 2018-03-27 00:38:15.967639651 -0400
@@ -351,7 +351,7 @@
 */
 public static function hasMssqlSupport()
 {
- return static::extensionLoaded('mssql') && static::classExists('Zend_Db_Adapter_Pdo_Mssql');
+ return static::extensionLoaded('pdo_dblib') && static::classExists('Zend_Db_Adapter_Pdo_Mssql');
 }
 /**

I hope this helps you getting started, feel free to ask questions in the comments.

NETWAYS offers professional support for Icinga and other Open Source tools, check our Website about Support.
The image used in this article is from johnmartel.blogspot.de, we assume fair use by mentioning the author.

Ein Buch über Icinga 2

Erscheint am 27. Juni 2016

 
41suqaLOyCL._SX336_BO1,204,203,200_April 2015, nach Monaten des Schwankens machten sich dann zwei verbliebene Möchtegernautoren doch auf ein Buch zum Thema Icinga 2 zu verfassen. Wir wollten ein sehr praxisnahes Werk mit vielen Beispielen wie und mit welchen Plugins etwas zu überwachen ist. Herausgekommen sind 344 Seiten von denen sich 100 mit Plugins und deren Verwendung in Icinga 2 befassen. Vorweg erfolgt eine generelle Einführung, die Vorstellung des neuen Webinterfaces Icingaweb 2 als auch eine ausführliche Erläuterung wie man lokale Werte wie Load bzw. CPU bei Windows oder Disk Usage mit NRPE/NSClient++, SSH und selbstverständlich mit dem neuen Icinga Agenten ermittelt.
Dem Kapitel über Plugins ist noch die Vorstellung einer fiktiven Firma vorangestellt. Diese betreibt ein zweigeteiltes Netzwerk mit einem internen Netz und eine durch Perimeter abgetrennte DMZ. Anhand dieses Beispiels wird eine verteilte Überwachung implementiert. Im internen Netz ist ein Icinga-Server (Master) für die Überwachung der dortig angesiedelten Server und Dienste zuständig. Für die DMZ wird ein weiterer Icinga-Server (Satellit) verwendet, der die ermittelten Ergebnisse an den Master meldet.
Diese Icinga-2-Infrastruktur wird dann im Folgenden benutzt, um eine Vielzahl von Diensten zu überwachen:

  • Host Erreichbarkeit
  • Zeitserver und lokale Zeit
  • Webservices incl. Apache und Ngnix
  • Domain Name Services
  • DHCP
  • Kerberos
  • Mailempfang und -versand
  • Proxy-Server
  • Generische Portüberwachung am Beispiel von Jabber
  • Javabasierte Application-Server
  • SAP
  • Kibana
  • Microsoft-Infrastrukturdienste: CIFS, Terminalservice, Domaincontroller, Exchange
  • Datenbanken: MySQL, PostgreSQL, MS SQL, Oracle
  • LDAP
  • Redis
  • Elasticsearch
  • VMware vSphere
  • Hardware: IPMI, HP, Oracle Solais, Thomas Krenn, Netzwerk, Festplatten
  • NetApp
  • Qnap

Das letzte Drittel ist Graphing mit PNP4Nagios und Graphite, Logmangement, Reporting und Businessprozessen gewidmet.
Teilbereiche werden von den beiden Autoren in einem Workshop vor der diesjährigen Open Source Monitoring Conference mit den Teilnehmern zusammen praktisch umgesetzt.

Lennart Betz
Lennart Betz
Senior Consultant

Der diplomierte Mathematiker arbeitet bei NETWAYS im Bereich Consulting und bereichert seine Kunden mit seinem Wissen zu Icinga, Nagios und anderen Open Source Administrationstools. Im Büro erleuchtet Lennart seine Kollegen mit fundierten geschichtlichen Vorträgen die seinesgleichen suchen.

MSSQL Überwachung

In heterogenen IT-Umgebungen kann man auf vieles treffen. Heute geht es um die Überwachung von MSSQL. Hier gibt es verschiedene Kanäle die man nutzen kann.
Zum einen ist da das Betriebssystem, das einem in Eventlog und WMI viele Infos bereitstellt. Hierzu benötigt man z.B. den NSClient, zu dem es in diesem Blog eine komplette Serie gibt. Über diesen kommt man an beides ran.
Des weiteren gibt es von Gerhard Lauser das Plugin check_mssql_health mit Hilfe dessen man z.B. an Werte wie connection-time, connected-users, lock-waits oder deadlocks bekommt. Informationen und eine genaue Anleitung gibt’s hier.
Was man allerdings über diese Mittel nicht überwachen kann sind die konkreten Jobs die auf dem DBMS laufen.
Hierzu bietet MSSQL eine stored Procedure name sp_help_job. Um diese benutzen zu können und die Jobs aller User zu sehen muss der Monitoring User die Rolle  SQLAgentReaderRole oder SQLAgentOperatorRole einnehmen.
Ruft man sp_help_job ohne alles auf, bekommt man eine Tabelle alles eingerichteten Jobs. Die sollte man prinzipiell mit ‚@enabled = 1‘ einschränken um nur aktive Jobs zu bekommen.
Reichen einem diese Informationen noch nicht, sollte man noch einen Blick auf die TARGETS Tabelle werfen. Hier befinden sich Informationen zu dem letzten Lauf wie die last_run_duration, last_run_outcome oder last_run_date. Aber Obacht: Die Formatierung des Datums und der Zeit ist sehr gewöhnungsbedürftig. Die Zahl 113300 bedeutet z.B. 11:33 Uhr. Führende Nullen werden weggelassen.
Der Aufruf in Transact SQL lautet: sp_help_job @job_name = ‚<jobname>‘, @job_aspect = ‚TARGETS‘
Möchte man das ganze jetzt automatisieren stehen einem auch wieder mehrere Wege offen. Hat man Perl in sein NSClient integriert kann man dieses benutzen. Dank DBD:Sybase kann man einfach auf alle Daten von MSSQL zugreifen.
Denkbar wäre aber auch ein Powershellscript oder eine beliebige andere Sprache die auf Windows ausführbar ist.

Christoph Niemann
Christoph Niemann
Senior Consultant

Christoph hat bei uns im Bereich Managed Service begonnen und sich dort intensiv mit dem internen Monitoring auseinandergesetzt. Seit 2011 ist er nun im Consulting aktiv und unterstützt unsere Kunden vor Ort bei größeren Monitoring-Projekten und PERL-Developer-Hells.