Programmiersprachen

Alles zu diesem Thema

5 essenzielle Tipps für robustes Bash-Scripting

5 essenzielle Tipps für robustes Bash-Scripting

Wir schreiben bei NETWAYS häufig Bash-Skripte für Prototyping und komplexe Ablaufsteuerungen. Da sich die Skriptsprache über die Jahre hinweg entwickelt hat, nehme ich gelegentlich etwas Zeit, um meinen Stil zu verbessern. Um die Beispiele zu verdeutlichen, habe ich folgendes TestSkript erstellt. Dieses nimmt Daten entgegen, schreibt sie in eine temporäre Datei und benennt diese dann in die Zieldatei um (Atomic Commit). #!/bin/bash # 1. Bashoptionen anpassen set -o errexit set -o pipefail set...

check_prometheus ist jetzt öffentlich verfügbar!

check_prometheus ist jetzt öffentlich verfügbar!

Monitoring ist komplex, das wissen wir hier bei NETWAYS leider zu gut. Deswegen laufen in der Infrastruktur auch mal gerne mehrere Tools für die Überwachung. Zwei gern gesehene Kandidaten sind dabei Icinga und Prometheus. Icinga und Prometheus erfüllen unterschiedliche Rollen im Monitoring, daher besteht oft Bedarf für eine Integration beider Tools. Genau dafür haben wir check_prometheus geschrieben, was wir nun der Öffentlichkeit zur Verfügung stellen....

Ansible – How to create reusable tasks

Ansible – How to create reusable tasks

Ansible is known for its simplicity, lightweight footprint and flexibility to configure nearly any device in your infrastructure. Therefore it's used in large scale environments shared between teams or departments. Often tasks could be used in multiple playbooks to combine update routines, setting downtimes at an API or update data at the central asset management. To use external tasks in Ansible we use the include_task module. This module dynamically includes the tasks from the given file....

HUGO: Statische Websites generieren aus Markdown-Dateien

HUGO: Statische Websites generieren aus Markdown-Dateien

Im Studium hatte ich ein Seminar zur Webentwicklung - da haben wir einfache Websites in reinem HTML-Text mit etwas CSS drum herum geschrieben. Alternativ dazu wurde uns da noch die Benutzung des CMS (Content-Management-Systems) Wordpress erklärt. Im Zuge meiner Ausbildung bei der NETWAYS Professional Services durfte ich mich nun mit dem Static Site Generator Hugo auseinandersetzen. Ein Static Site Generator ist im Prinzip ein Tool das auf Basis von Rohdaten und Templates eine ganze statische...

Ansible – Loop over multiple tasks

Ansible – Loop over multiple tasks

The last time I wrote about Ansible and the possibility to use blocks to group multiple tasks. Which you can read here. Sadly this feature does not work with loop, so there is no clean way to loop over multiple tasks in a play without writing the same loop statement at tasks over and over. But when we come across the need of tasks which depend on each other, for example, we execute a script with a certain parameter and its result is necessary for the upcoming tasks. Let's go through a common...

Ansible – Use Blocks and Rescue Errors

Ansible is a widely used and powerful open-source configuration and deployment management tool. It can be used for simple repetitive daily tasks or complex application deployments, therefore Ansible is able to cover mostly any situation. Since version 2.0.0 Ansible introduced the usage of blocks, they provide the possibility to group or rescue failed tasks. On blocks we can assign most directives which are available for any other task at block level, only loops aren't available. - name: Update...

Ansible – should I use omit filter?

When we talk about Ansible, we more and more talk about AWX or Tower. This Tool comes in handy when you work with Ansible in a environment shared with colleagues or multiple teams.In AWX we can reuse the playbooks we developed and share them with our colleagues on a GUI Platform.Often we need a bit of understanding how a playbook is designed or if a variable need to be defined for the particular play. This can be much more tricky when sharing templates to people unaware of your work. This is...

Temperatur und Feuchtigkeit in Telegram vom RaspberryPI

Ich möchte hier beschreiben, wie man mit einem RaspberryPI die Temperatur und Feuchtigkeitswerte sich aufs Handy per Telegram schickt. Verraussetzung ist ein RaspberryPI 3 b+ und ein Temperatur / Feuchtigkeitssensor, ich habe folgendes verwendet: DSD TECH DHT22 AM2302 Temperatur und Luftfeuchtigkeit Sensor Modul für Arduino Raspberry Pi RaspberryPI 3 B+ Anleitung wie man den Sensor an den RaspberryPI ansteckt, findet man reichlich im Netz z.B. Sensor-Einbau RaspberryPI/ Da in diesem Artikel...

Modern C++ programming: Coroutines with Boost

We're rewriting our network stack in Icinga 2.11 in order to to eliminate bugs with timeouts, connection problems, improve the overall performance. Last but not least, we want to use modern library code instead of many thousands of lines of custom written code. More details can be found in this GitHub issue. From a developer's point of view, we've evaluated different libraries and frameworks before deciding on a possible solution. Alex created several PoCs and already did a deep-dive into...

NFC-Leser mit einem Raspberry Pi

In meinem letzten Blogpost habe ich schon etwas über NFC und RFID geschrieben. In diesem Blog erstellen wir einen Leser, mit dem man beispielsweise auch NFC-fähige Karten oder Chips auslesen kann. Was brauchen wir? Einen Raspberry Pi Female-Female Jumperkabel RFID-Reader MFRC522 Modul Hier benutze ich das zurzeit das aktuellste Modell des Raspberrys, den 3 B+. Natürlich sind auch ältere Pi Modelle für dieses Projekt ausreichend. Die Jumperkabel sowie das Modul können sehr leicht und...

Tracing PHP memory usage with Xdebug

In addition to Xdebug's great profiling and debugging features it also supports tracing memory usage. This helps to find functions which consume a lot of memory or to identify memory leaks. The following options enable tracing right away: xdebug.auto_trace=1 xdebug.trace_format=1 Traces are written to /tmp by default. You may change this via the xdebug.trace_output_dir setting. With xdebug.trace_format=1 you tell Xdebug to write traces in an easy-to-parse tab separated format. The logged...