My custom tricks!

Created: April 25, 2020, 2:37 p.m.
Update: Feb. 28, 2021, 6:18 a.m.
Command line for monitoring

My custom tricks! I love line commands for monitoring something!

Usually enviromment

Linux Debian OR Ubuntu
Python
Bash

How to monitoring a total of register from a table? Total COUNT in postgreSQL
create a file with the command content

$ echo "SELECT COUNT(*) FROM client_client WHERE confirmed=1;"  > /tmp/command.sql

Print date time and total of occurences 5 to 5 minutes, sleep command work's in seconds

$ su - postgres 
$ while [ -z ]; do date && psql -d mydatabase < /tmp/command.sql; sleep 300; done
crtl+c to out
output
Sat 25 Apr 2020 02:22:58 PM -03
count 
-------
7608
(1 row)
Sat 25 Apr 2020 02:27:58 PM -03
count 
-------
7613
(1 row)
Sat 25 Apr 2020 02:32:58 PM -03
count 
-------
7620
(1 row)

Merge PDF files

$ gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dAutoRotatePages=/None -sOutputFile=finished.pdf  rg2020.pdf rg2020-ver.pdf 

Fail2Ban - UnBan

$ iptables -L -n | grep Chain
$ fail2ban-client set $JAIL unbanip $IP
#example with a jail named ssh
$ fail2ban-client set ssh unbanip 10.0.0.20

The best traffic monitoring

iptraf-ng

Tiago de Souza Moraes - teago.futuria.com.br - 2021 // CSS by UIKIT CSS