Image for post
Image for post
Prometheus Query Range

Ubuntu

Recently when working with docker-compose, I met an issue:

No space left on device

The first solution comes up to my mind is add disk space from different partition to the partition that holds docker. But this is difficult. Turns out we have easier problem that we can mount the directory that holds docker data to different directory.

Check the /var/lib/docker, we will see that it belongs to /dev/sdb3

user:/var/lib/docker$ df .
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb3 58795996 53734356 2045244 97% /

And /dev/sdb3 is about to full.

Check the home directory

user:/home$ df .
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb4 892956360 429285640 418241268 51%…

Prometheus

Image for post
Image for post
Photo by Christian Paul Stobbe on Unsplash

Install Prometheus in Ubuntu

Get Prometheus package from https://prometheus.io/download/

tar xvzf prometheus*
cd prometheus*

Config prometheus yaml file

vim prometheus.yml

Example prometheus.yml file

# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. …

Image for post
Image for post
Photo by Alexander Ant on Unsplash

Example error

go: github.com/account/project-utils@v0.0.0-20201015040921-5f23d1a17a73: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/cuongld/go/pkg/mod/cache/vcs/asshfsfsd: exit status 128: git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make…

Example error

go: github.com/abc/xyz-utils@v0.0.0-20201015040921-5f23d1a17a73: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/cuongld/go/pkg/mod/cache/vcs/eb83eaf537e0aebe864ffaf3709762d4d27c7d31480b965e40fa5ad2d1145e2d: exit status 128: fatal: could not read Username for 'https://github.com': terminal prompts disabled…

About

Donald Le

A passionate automation engineer who strongly believes in “A man can do anything he wants if he puts in the work”.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store