How To Use GeoIP2 (mmdb) Database With Perl

Published on Author gryzli

This article is the result of my struggles to properly use GeoIP v2 database within Perl.    TL;DR  The FASTEST way to use the database is by installing and utilizing the “MaxMind::DB::Reader::XS” perl module.  And here is a tiny example: use MaxMind::DB::Reader::XS ;  use Data::Dumper;  my $geoip_country = MaxMind::DB::Reader::XS->new( file => ‘/usr/share/GeoIP/GeoIP2-Country.mmdb’ ); print Dumper… Continue reading How To Use GeoIP2 (mmdb) Database With Perl

Calculate Maximum MySQL Memory Usage

Published on Author gryzli

Recently I found the following script pretty handy for calculating the maximum amount of memory mysql could use, based on the current buffers configuration.   This is the source: #!/bin/sh# you might want to add some user authentication here mysql -e “show variables; show status” | awk ‘ { VAR[$1]=$2 } END { MAX_CONN =… Continue reading Calculate Maximum MySQL Memory Usage

Rotating Indexes in ElasticSearch with Curator

Published on Author gryzli

At certain point in time, you will want to rotate (delete) your old indexes in ElasticSearch. Most of the time people are using time based naming convention for their index names like: index_name-Year-Month-Day or index_name-Year.Month.Day. Tools like Filebeat/Logstash can also use such naming conventions. Before you go and write your own script that will do… Continue reading Rotating Indexes in ElasticSearch with Curator

Configure Nginx Reverse Proxy For Grafana Access

Published on Author gryzli

Proxying Grafana with Nginx is easy, but there are some small thins that needs to be considered. If you have already tried this and received strange errors like: 192.168.1.1 – – [09/May/2019:10:26:58 +0300] “-” 000 0 “-” “-” “-“ or 499 errors in your nginx proxy logs or Grafana dashboard graphics not being loaded most… Continue reading Configure Nginx Reverse Proxy For Grafana Access

Nginx Proxying Long URL Addresses

Published on Author gryzli

If you are using Nginx as reverse proxy, you may encounter some of the following behaviors Receiving Empty Lines In Nginx Log 192.168.1.1 – – [09/May/2019:10:26:58 +0300] “-” 000 0 “-” “-” “-” 192.168.1.1 – – [09/May/2019:10:09:55 +0300] “-” 000 0 “-” “-” “-” Receiving 499 Status Code While Proxying I was observing such behavior… Continue reading Nginx Proxying Long URL Addresses

How To Use Ansible For Centos 5 / RHEL 5

Published on Author gryzli

If you try to run some of your playbooks over old Centos/Rhel 5 host, you might be ending with weird message like this: {“changed”: false, “module_stderr”: ” File \”<stdin>\”, line 39\n with open(module, ‘wb’) as f:\n ^\nSyntaxError: invalid syntax\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1} Without going into too… Continue reading How To Use Ansible For Centos 5 / RHEL 5

Detailed CPU Usage Overview With psacct

Published on Author gryzli

If you ever asked yourself the following questions, this might be the right place for you: How to check how much cpu is consuming each system user ? How to check how much cpu is consumed by each command ? Check when a command has been executed and how much cpu it did ? How… Continue reading Detailed CPU Usage Overview With psacct

Working With Ingest Pipelines In ElasticSearch And Filebeat

Published on Author gryzli

What are ingest pipelines and why you need to know about them ? Ingest Pipelines are powerful tool that ElasticSearch gives you in order to pre-process your documents, during the Indexing process. In fact they are integrating pretty much of the Logstash functionality, by giving you the ability to configure grok filters or using different… Continue reading Working With Ingest Pipelines In ElasticSearch And Filebeat

Tuning Ansible For Maximum Performance

Published on Author gryzli

I hate stuff running slow and I love Ansible.  In this guide, I will share how achieved more than 50x speedup for executing simple ansible playbooks (which are meant to be fast , but they was not ).   Measuring Ansible Tasks Execution Time Before optimizing whatever it is, we should have some good baseline… Continue reading Tuning Ansible For Maximum Performance