HAProxy provides a socket file which can be used to do maintenance (enable/ disable backends, retrieve information and statistics, …). The statistics part contains quite some interesting information for monitoring and alerting. The below Perl code snippit will loop over a glob of socket files (for instance when you have multiple HAProxy configurations running as…
Tag: Monitoring
A Prometheus Exporter framework written in Perl
I released a small project I wrote a while ago, to create quick Prometheus exporters in Perl for providing some custom data. The project itself can be found at https://github.com/insani4c/prometheus-exporter. Back then I decided not to use Net::Prometheus as I wanted to use HTTP::Daemon with threads and not Plack. A small example of how to…
IPTables Logs in Loki and Grafana (with Promtail)
In the previous article (Logging in IPTables with NFLog and ulogd2) rules were created to log certain IPTables rules with the use of NFLOG and ulogd2 to a file in JSON format. With Promtail (https://grafana.com/docs/loki/latest/clients/promtail/), the above created log files can be sent to Loki so that they can finally be displayed in Grafana. The…
Postgresql: Monitor sequence scans with Perl
Not using indexes or huge tables without indexes, can have a very negative impact on the duration of a SQL query. The query planner will decide to make a sequence scan, which means that the query will go through the table sequentially to search for the required data. When this table is only 100 rows…
Postgresql: Monitor unused indexes
Working on large database systems, with many tables and many indexes, it is easy to loose the overview on what is actually being used and what is just consuming unwanted disk space.If indexes are not closely monitored, they could end up using undesired space and moreover, they will consume unnecessary CPU cycles. Statistics about indexes…
PostgreSQL 9.2 Master – Slave Monitoring
Nagios plugin script written in Bash to check the master-slave replication in PostgreSQL (tested on PostgreSQL 9.2.4) (executed on the slave). The script will report how many bytes the slave server is behind, and how many seconds ago the last replay of data occurred. The script must be executed as ‘postgres’ user. #!/bin/bash # $Id:…