Select Page

NETWAYS Blog

Mein erstes Icinga Web 2 Modul

Im Laufe meiner Ausbildung habe ich nun ein PHP Projekt bekommen. Ich soll ein Modul für unser heiß begehrtes Icinga Web 2 schreiben. Thema des Modules, ist die Darstellung deiner aktuellen System und Icinga 2 Daten. Von Zonen bis Firewall eine komplette Übersicht.

Das Thema des Blogposts soll aber nicht das Modul sein. Sondern möchte ich euch einen kurzen und einfachen Überblick darüber geben, wie ein solches Modul aufgebaut ist:

Das wichtigste was du wissen musst: Icinga Web 2 Module basieren auf dem icinga Web 2 Framework! Was das für dich als Modul Entwickler bedeutet, möchte ich dir kurz erläutern.

Icinga Web 2 Framework

Bei dem Icinga Web 2 Framework handelt es sich um ein objektorientiertes Framework für PHP. So ist es zum Beispiel nötig, einen Controller und eine View, pro Anzeigeseite zu erstellen.
Die Ordnerstruktur dazu kann wie folgt aussehen:


└── example
|      └── application
|         ├── controllers
|         |   ├── BaseController.php
|         |   └── IndexController.php
|         └── views
|            └── scripts
|               ├── base
|               |   ├── config.phtml
|               |   └── index.phtml
|               └── index
|                  └── index.phtml
└── configuration.php

Durch den Controller und die view wird automatisch die URL gebaut: localhost/icingaweb2/”Modulname”/”Controllername”/”viewname”.

Controller

Was ist ein Controller im Icinga Web 2 Framework?

Der Controller ist der Ort an dem all deine Magie passiert. Also die ‘main’ der jeweiligen Seite.

Um einen Controller richtig zu definieren, hier einige wichtige Tipps, die unbedingt zu beachten sind:

Neben der korrekten Ordnerstruktur deines Modules und der richtigen Groß und Kleinschrebung, muss auch ein eindeutiges Namensschema deiner Dateiein eingehalten werden. Die Dateien müssen beispielsweise das dazu gehörige Schlagwort beinhalten.
Solltest du also einen Controller Index bauen wollen, besteht dein Filename aus dem ‘Controller Namen’ und dem Schlagwort ‘Controller’: IndexController.php

In deinem Controller werden Actions´s erstellt. Innerhalb dieser Actions wird der Quellcode geschrieben und deine Seitentabs erstellt.
Auch hier ist wieder auf Namensgebung und Groß und Kleinschreibung zu achten.

Beispielcode:

views

Was ist eine view?

Damit der Endbenutzer eine Ausgabe in seinem Icinga Web 2 erhält, werden die Ergebnisse deines Controllers an eine view weitergegeben.

Der Ordnername deiner view ist nicht frei wählbar. Er wird aus dem Namen deines Controller´s abgeleitet. Solltest du einen Controller namens Base haben, muss der Ordnername ebenfalls den Namen base haben (Man beachte, den Ordner klein zu schreiben).

In deinem Ordner werden nun die eigentlichen Views erstellt.
Die Standart Seite ist deine index.phtml. Solltest du eine Unterseite erstellen wollen, ist die view genauso zu nennen wie deine Action.

Ein Beispiel dafür wäre wie folgt:

configuration.php

In deiner configuration.php werden die Menüpunkte und sections erstellt. Solltest du für dein Modul also einen Reiter oder Unterreiter haben wollen, sind diese also hier zu definieren.

 

Solltest du ein eigenes Modul entwickeln wollen, oder dich nun mehr für das Thema interessieren, findest du unter dem Training-Module einen ausführlicheren Guide.

Tobias Bauriedel
Tobias Bauriedel
Junior Consultant

Tobias ist ein offener und gelassener Mensch, dem vor allem der Spaß an der Arbeit wichtig ist. Bei uns macht er zurzeit seine Ausbildung zum Fachinformatiker. In seiner Freizeit ist er viel unterwegs und unternimmt gern etwas mit Freunden.

Computer Viren in der Cloud

Verschiedene Anbieter von Anti-Virus Produkten bieten mittlerweile SaaS Platformen an um eine zentrale Übersicht über den Status aller Systeme zu bekommen. Dort wird dann neben allen Details eine Übersicht von Alarmen bzw. Bedrohungen verfügbar.

Ein Kunde stellte mich vor die Herausforderung aus diesen Platformen per API die aktuellen Alarme und Probleme abzufragen, daraus sind zwei neue Plugins entstanden.

Hinweis: Wir machen hier keine Werbung für die Produkte, nur unsere Plugins. Wir stehen aktuell in keiner Geschäftsbeziehung zu beiden Anbietern.

read more…

Markus Frosch
Markus Frosch
Principal Consultant

Markus arbeitet bei NETWAYS als Principal Consultant und unterstützt Kunden bei der Implementierung von Nagios, Icinga und anderen Open Source Systems Management Tools. Neben seiner beruflichen Tätigkeit ist Markus aktiver Mitarbeiter im Debian Projekt.

Windows: One Framework to Monitor them all by Christian Stein | OSMC 2019

This entry is part 4 of 4 in the series OSMC 2019 | Recap

At the Open Source Monitoring Conference (OSMC) 2019 in Nuremberg, Christian Stein captivated the entire conference room with his presentation “Windows: One Framework to Monitor them all”. His demo was the highlight of his presentation, which ended up with enthusiastic applause. You have missed him speaking? We have got something for you: Watch the video of Christian’s presentation and read a short summary (below).

At OSMC international monitoring experts meet annually to set and discuss future trends and objectives. Since 2006 the event takes place every autumn in Nuremberg, Germany. Leading specialists present the full scope of Open Source monitoring and are ready to answer your hardest questions. Discuss with top developers, exchange knowledge and learn wen techniques.

You want more? In-depth workshops the day prior to the conference and a Hackathon provide further possibilities to extend your skills and deepen your knowledge in IT monitoring and management.

The next OSMC takes place in 2021 in Nuremberg.

More information and tickets at osmc.de.


Windows: One Framework to Monitor them all

Christian Stein signed up with a talk titled “Windows: One Framework to Monitor them all” and the intention to turn the Windows side of Icinga upside down. After giving a short run down of the the current issue with “Icinga for Windows” and his attempts at fixing them, we get to the good stuff.

An Icinga PowerShell Framework supported by Powershell 4.0 or higher, but let‘s get into the juicy details: The framework comes with a lot of features, to easily extend it within your environment and to simplify monitoring on Windows as well. Additionally, there is a dev-toolkit, which offers plenty of possibilities for developers to give the framework their own tweak. As of now, there are four repositories beyond the framework itself. Up first and most important to mention is icinga-powershell-kickstart, which provides a basic PowerShell script to interactively install the framework. Also rather essential for the framework is the icinga-powershell-plugins repository, which provides a collection of Windows check plugins.

Want to run the framework as a service? Glad you asked. There is a repository for that as well. It’s also covered by the kickstart wizard. Check icinga-powershell-service to find out more or to give some feedback. If you’ve always asked yourself why you should run appliances as a service, there are several benefits. Like the service running before a user logs on and continuing to run, without a logged on user.

Last but not least, even most essential, the framework itself. If we look at the current ways to make Icinga work on windows, they are good, but not great. The icinga-monitoring-framework provides tools and configuration to make icinga monitoring on windows possible, almost natively, except for said repositories.

Having said all that and more, Christian went on with a live demo of the Framework, gave some installation advice and by that I mean, delved deeper into the kickstart script. He also showed off some features and gave some best practice advice. So, all that was left to say is… whats next?

Christian announced, that it will be available on PowerShell Gallery, which will not only help the project grow, but make it even more available as is. And of course, there will be more plugins. For those eagerly waiting for one of these, the next release hopefully provides MSSQL, Active-Directory, Exchange and Hyper-V plugins.

The community’s and the customer’s interest in better windows monitoring is undeniable, but we depend on your feedback and support on this, the respective repository is the place to be, and if you can’t figure, which one it fits, just post your issue at: https://github.com/Icinga/icinga-powershell-framework/issues

Alexander Stoll
Alexander Stoll
Junior Consultant

Alexander ist ein Organisationstalent und außerdem seit Kurzem Azubi im Professional Services. Wenn er nicht bei NETWAYS ist, sieht sein Tagesablauf so aus: Montag, Dienstag, Mittwoch Sport - Donnerstag Pen and Paper und ein Wochenende ohne Pläne. Den Sportteil lässt er gern auch mal ausfallen.

Tornado – Extend Icinga 2 for Active and passive Monitoring of complex heterogeneous IT Environments by Francesco Cina & Patrick Zambelli | OSMC 2019

This entry is part 3 of 4 in the series OSMC 2019 | Recap

At the Open Source Monitoring Conference (OSMC) 2019 in Nuremberg, Francesco Cina and Patrick Zambelli whirled up a „Tornado – Extend Icinga 2 for active and passive Monitoring of complex heterogeneous IT Environments”. If you missed their presentation: See the video of their introduction to Tornado and its use cases, and read a summary (below).

The OSMC is the annual meeting of international monitoring experts, where future trends and objectives are set. Since 2006 the event takes place every autumn in Nuremberg, Germany. Leading specialists present the full scope of Open Source monitoring and be ready to answer your hardest questions. Learn new techniques, exchange knowledge and discuss with top developers.

In-depth workshops the day prior to the conference and a Hackathon provide further possibilities to extend your skills and deepen your knowledge in IT monitoring and management.

The next OSMC takes place in 2021 in Nuremberg.
More information at osmc.de.


 

Tornado – Extend Icinga 2 for Active and passive Monitoring of complex heterogeneous IT Environments

Monitoring Challenges: Pool vs. Event.

First of all we have to explain the difference between Pool and Event approach. Icinga and nagios use the polling approach, which is scheduling monitoring or checks in a static time interval to get a specific state. You can derive from this state if the status from monitored device or service is critical or ok. That means, we know not only the results of monitoring but also the monitored systems. By Polling we have centralized configuration and control. This will be performed either agentless e.g. SHH, SNMP or through an agent for example Icinga, NSClient++.

Contrarily to this historical approach is the event based approach. On the one side we accept the matrix all the time from the remote system and we don’t know exactly what will come, but on another side we have to understand the incoming protocol and derive if there is a problem or not.

 

Advantages and disadvantages of polling and event:

Polling Pros

  • Control when a check should be executed
  • Get only the data which you are interested in
  • Knowing the context from the system you are interacting with (context = host, service, performance data)

Polling Cons

  • Static configuration for monitored architecture (not good for a changeable one e.g. micro services)
  • Continuously usage of resources day and night
  • Not all data is retrievable via polling

 

Event Pros

  • No delay to react when event happens
  • No need to know what to receive but understand it
  • Dynamic on fast changing architecture
  • Listen to channel => new added hosts are integrated

Event Cons 

  • Need to face large amount of data (peaks)
  • Lack for filtering at source. We can lose information specially when the protocol is not reliable e.g. UDP or SNMP
  • Risk to lose information
  • Not the right approach for host alive and service availability  

Combination of both Polling (Icinga 2) and event (Tornado) will definitive a winning:

With Icinga 2 we have the advantage to start a project very quickly and easily. We have a wide range of checks in the community. Through Templates we can create a reusable monitoring. We can adapt to changes in the architecture by interacting with CMDB or domain controller for example.

With Tornado we listen on the monitored host to the output of a service on a specific channel then we convert this output via collector to Json, which is the only recognized language by Tornado. After that we compare the flow with by regular expression created rules. In the end we forward an action to Icinga 2 – “Critical” for example. 

That means, when our infrastructure grows with new hosts we can monitor the availability from these hosts and their services with Icinga 2. We can control the output from services with Tornado.

 

How to handle the increased load?

01. Scale the monitoring system horizontally

When our servers and services grow, we can increase the number of monitoring instances. This is not good because it doesn’t work out of the box and too many problems will appear. Moreover the throughput does not go linearly. At a number of scaled nodes the overhead of communication and sycronization between them will take more time than analyzing the traffic itself.

02.  Use a big data system

We put a big data system between events and the monitoring system, for example kafka, spark, cassandra. The idea is, we reprocess the messages or the events and send only the important ones to the monitoring system. In this way we will reduce the flow against our monitoring system. This will definitely lead to reduce the load as well. It is a real solution but terribly expensive and needs a lot of knowledge with the used data system.

03. Tornado

Why is Tornado the solution?

  • Can handle millions of events per second per CPU
  • Stateless: the nodes don’t need to communicate to each other
  • Cloud-ready
  • Has collectors which translate events from format X to Tornado format (Json)
  • Take decision based on the event content
  • Cheap because it doesn’t need too much resources 

Tornado decides to pass the events to Icinga when they match the pipelines and the rules we defined in Tornado. Not suitable events will be dropped.

 

You liked this blog post and want to read more about different monitoring solutions? Then browse through our blog series, visit our YouTube channel or just contact us.

 

Afeef Ghannam
Afeef Ghannam
Support Engineer

Afeef hat seine Ausbildung Als Fachinformatiker in Richtung Systemintegration im Juli 2020 bei NETWAYS absolviert, seitdem unterstützt er die Kollegen im Support und bei der Betriebsunterstützung. Nach der Arbeit macht er gerne Sport, trifft Freunde oder mag es Filme zu schauen.

OSMC 2020 | GET ON STAGE!

Hey folks, listen up!

OSMC’s call for papers is about to close. So prepare yourselves for the big monitoring stage and submit your paper.
We are looking for the latest trends, how-tos, case studies, best practices, future developments and anything that can help practitioners in their daily work. You can read more about CfP 2020 here.

The conference is aimed at professionals from the open source monitoring scene. The Open Source Monitoring Conference OSMC is about networking and meeting the international community. The lecture program provides up-to-date expert knowledge, and the workshops offer deep insights into various specialist areas. At the Hackathon, you build together with like-minded people on the project you always wanted to tackle.

So be there when the international open source scene meets in November at the monitoring hotspot Nuremberg! The conference will take place for the 15th time from November 16 to 19. You can find the ticket details here.

What are you waiting for? See you!

Pamela Drescher
Pamela Drescher
Head of Marketing

Pamela hat im Dezember 2015 das Marketing bei NETWAYS übernommen. Sie ist für die Corporate Identity unserer Veranstaltungen sowie von NETWAYS insgesamt verantwortlich. Die enge Zusammenarbeit mit Events ergibt sich aus dem Umstand heraus, dass sie vor ein paar Jahren mit Markus zusammen die Eventsabteilung geleitet hat und diese äußerst vorzügliche Zusammenarbeit nun auch die Bereiche Events und Marketing noch enger verknüpft. Privat ist sie Anführerin einer vier Mitglieder starken Katzenhorde, was ihr den absolut...

Veranstaltungen

Dec 01

Icinga 2 Fundamentals Training | Online

December 1 @ 09:00 - December 4 @ 17:00
Dec 03

DevOps Meetup

December 3 @ 17:30 - 20:30
Dec 08

Terraform mit OpenStack Training | Online

December 8 @ 09:00 - December 9 @ 17:00
Dec 08

Icinga 2 Advanced Training | Online

December 8 @ 09:00 - December 10 @ 17:00
Dec 15

GitLab Training | Online

December 15 @ 09:00 - December 16 @ 17:00