Install Prometheus and Grafana

31 07 2017

These are the steps to install Prometheus and Grafana in a standalone Linux Debian box for monitor their system with a nice dashboard.

Install the package server and exporter from the repo:

apt-get install prometheus prometheus-node-exporter

Change Prometheus to listen only in localhost and the sync strategy (if you want to save battery) /etc/default/prometheus:

ARGS="-web.listen-address=localhost:9090 -storage.local.series-sync-strategy 'never'"

Assure that there is a target in /etc/prometheus/prometheus.yml:

- job_name: node
# If prometheus-node-exporter is installed, grab stats about the local
# machine by default.
- targets: ['localhost:9100']

Restart it and enable in systemd:

systemctl restart prometheus
systemctl enable prometheus

Change the listen address too in the node exporter /etc/default/prometheus-node-exporter:

ARGS="-collector.diskstats.ignored-devices=^(ram|loop|fd)\d+$ \
-collector.filesystem.ignored-mount-points=^/(sys|proc|dev|run)($|/) \ -web.listen-address="

Restart it and enable in systemd:

systemctl restart prometheus-node-exporter
systemctl enable prometheus-node-exporter

Download Grafana from their website and install it:

mkdir /opt/grafana
cd /opt/grafana
dpkg -i grafana_4.4.1_amd64.deb

Enable and start it in systemd:

systemctl daemon-reload
systemctl enable grafana-server
systemctl start grafana-server

Use the browser and enter this address (user/password: admin/admin):


Add the Prometheus datasource as in the image:

Add a new dashboard following this path in the menu:

Type the id “1860” inside “ Dashboard”. It automatically get it:

Confirm the import fetching the values from localhost:


Change tab size in xfce 4

8 07 2017

If you use Debian 9 in a small screen with xfce 4, maybe you suffer the big tab size of some desktop elements.

For fix that, create a file under ~/.config/gtk-3.0/gtk.css with the following content:

/* reduce padding of tabs */
notebook tab {
min-height: 0;
padding-top: 1px;
padding-bottom: 2px;
/* reduce padding of buttons */
notebook tab button {
min-height: 0;
min-width: 0;
padding: 1px;
margin-top: 1px;
margin-bottom: 2px;

Netns different outgoing source ip address

7 07 2017

Using three network interfaces, assign each one a different address as source ip address for outgoing traffic:

ip netns add blue
ip link set eth1 netns blue
ip netns add green
ip link set eth2 netns green
ip netns exec blue dhclient eth1
ip netns exec green dhclient eth2
echo "IP eth0: "
echo "IP eth1: "
ip netns exec blue curl
echo "IP eth2: "
ip netns exec green curl

Enable autologin in Debian with Systemd

19 05 2017

For allow autologin in a Debian system with systemd (very usefull with testing virtual machines):

Create dir:
mkdir /etc/systemd/system/getty@tty1.service.d/

Create file /etc/systemd/system/getty@tty1.service.d/override.conf with the following content:
ExecStart=-/sbin/agetty --autologin root --noclear %I $TERM

More info:

Disable time sync between host and guest in Linux VirtualBox

19 05 2017

To the following files:

/home/[your_user]/VirtualBox\ VMs/[VM_Name]/[VM_Name].vbox

Add the line:

<ExtraDataItem name="VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" value="1"/>

More info:

Deny ssh access to one user

18 05 2017

If you want to deny the access of one user (or group) to a server via ssh, these are the steps for a Debian/Ubuntu server:

Add the user to /etc/security/access.conf
- : user1 : ALL

Assure that “/etc/ssh/sshd_config” have the following line (by default yes):
UsePAM yes

Assure that “/etc/pam.d/sshd” have uncommented the following line:
account required

Configure phpmyadmin for connect to RDS AWS MariaDB

30 03 2017

Ensure that “/etc/phpmyadmin/config-db.php” doesn’t haven any configured values:


Create a new file with for your particular values in “/etc/phpmyadmin/conf.d/myconf.php”

<?phpConfigure phpmyadmin for connect to RDS AWS MariaDB
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['host'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = TRUE;

Go to the phpmyadmin website and log with the administrative account.

More info: