As https://learn.microsoft.com/en-us/windows-server/networking/technologies/pktmon/pktmon puts it: Packet Monitor (Pktmon) is an in-box, cross-component network diagnostics tool for Windows. It can be used for packet capture, packet drop detection, packet filtering and counting. Nice thing about it is that it is present by default on all modern Windows versions, so you can do a quick packet capture when […]
Parametrizing Test Functions with Pytest
I will first create a class that is used for representing the Zabbix protocol flags (zabbix_flags.py): Subclassing enum.IntFlag is very suitable for this purpose, and enum.auto() can be used to represent the flag values. I have four test functions to check that the flag values work as expected (test_zabbix_flags.py): Let’s create a virtual environment and […]
Python Versions
Even though I’ve used Python programming language on-and-off since about year 2000, I only started paying more attention to specific Python versions around 2016 when I gradually started using Python more seriously in devops. When dealing with different runtime environments it is crucial to know which features are available in which Python versions. This page […]
Using Tmux
A long time ago I discovered screen. It made it possible to start applications in Linux and then disconnecting the SSH session, without stopping the applications. It was magic: otherwise the the applications just terminated if the SSH connection was lost. Then I heard about tmux. It was like screen on steroids! I could split […]
Serial Console Server on Raspberry Pi
Short one: How to make a serial console server (or terminal server) with a Raspberry Pi and USB-serial adapter. Connect the serial port to whatever device you want to use for testing, and use any telnet-compatible client (like PuTTY) to connect to your Pi’s IP address and the configured port (2000, 3000 or 4000 in […]
Data Buffering in Zabbix Proxy
One of the features of Zabbix proxy is that it can buffer the collected monitoring data if connectivity to Zabbix server is lost. In this post I will show it happening, using packet capture, or packet analysis. Zabbix setup and capturing Zabbix proxy traffic This is the setup in this demo: For simplicity, the agent […]
LLD Filtering with Macros in Zabbix
When configuring monitoring and using templates in Zabbix you often see low-level discovery (LLD) used for finding out the monitored components or features of a host. In this post I will explain how user macros and regular expressions are used in LLD for filtering the discovery results. I’m using the Network Generic Device by SNMP […]
Count Lines of Python Code
I have created a new application called lopc (Lines of Python Code). It is available for install with pip on PyPI (https://pypi.org/project/lopc/), and the source code is available on GitHub: https://github.com/markkuleinio/lopc The app really only counts the number of non-empty and non-comment lines of *.py files in the given directories. These are some features of […]
Python f-String Formatting Codes
Here is my short list about the common f-string formatting codes in Python: >>> score = 123.728 >>> f”{score}” ‘123.728’ Minimum field length: >>> f”{score:>10}” ‘ 123.728’ >>> f”{score:<10}” ‘123.728 ‘ >>> f”{score:^10}” ‘ 123.728 ‘ Number of decimals: >>> f”{score:.2f}” ‘123.73’ >>> f”{score:10.2f}” ‘ 123.73’ >>> f”{score:<10.2f}” ‘123.73 ‘ Padded with a character: >>> […]
Zabbix Active Agent Autoregistration
Let’s see how the Zabbix active agent autoregistration works in the communication. I have configured the Zabbix agent (version 6.2.3) on the Linux host at 192.168.7.17 with this configuration: ServerActive=192.168.7.15 Hostname=Test-agent After restarting the agent, the Zabbix server (version 6.2.3) at 192.168.7.15 logged immediately in /var/log/zabbix/zabbix_server.log: cannot send list of active checks to “192.168.7.17”: host […]