Merge branch 'master' of github.com:blasebast/monitoring-grafana-influxdb-telegraf-prometheus
This commit is contained in:
commit
50da5b4f55
30
README.md
30
README.md
@ -1 +1,29 @@
|
|||||||
# monitoring-grafana-influxdb-telegraf-prometheus
|
# What is in this repository?
|
||||||
|
|
||||||
|
This repository contains easily deployable monitoring solution which uses:
|
||||||
|
- Grafana (frontend for monitoring + alerts)
|
||||||
|
- Prometheus (monitoring solution pulling metrics from exporter)
|
||||||
|
- Node Exporter for Prometheus (metrics exporter-exposer for Prometheus)
|
||||||
|
- Telegraf (monitoring agent)
|
||||||
|
- InfluxDB (persistent timeseries storage)
|
||||||
|
- cAdvisor (containers monitoring)
|
||||||
|
- alertmanager (alerting)
|
||||||
|
|
||||||
|
|
||||||
|
# How to use it?
|
||||||
|
|
||||||
|
If you have docker and docker-compose installed, this will take roughly 1 minute to have it up and running.
|
||||||
|
If not - it will still take mentioned ~ 1 minute + time needed for docker installation.
|
||||||
|
|
||||||
|
## Here is how to install:
|
||||||
|
|
||||||
|
* $ clone the repository
|
||||||
|
* $ cd to cloned dir
|
||||||
|
* $ chmod +x ./deploy_all.sh; ./deploy_all.sh
|
||||||
|
|
||||||
|
|
||||||
|
Monitoring should be up and running http://_**hostname**_:3001/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
10
alertmanager/config.yml
Normal file
10
alertmanager/config.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
route:
|
||||||
|
receiver: 'slack'
|
||||||
|
|
||||||
|
receivers:
|
||||||
|
- name: 'slack'
|
||||||
|
slack_configs:
|
||||||
|
- send_resolved: true
|
||||||
|
username: 'sebastian.blasaik'
|
||||||
|
channel: '#channel_name'
|
||||||
|
api_url: 'https://hooks.slack.com/services/'
|
@ -1,10 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
RED='\033[00;31m'
|
||||||
|
GREEN='\033[00;32m'
|
||||||
|
YELLOW='\033[00;33m'
|
||||||
|
BLUE='\033[00;34m'
|
||||||
|
PURPLE='\033[00;35m'
|
||||||
|
CYAN='\033[00;36m'
|
||||||
|
LIGHTGRAY='\033[00;37m'
|
||||||
|
MAGENTA='\033[00;35m'
|
||||||
|
LRED='\033[01;31m'
|
||||||
|
LGREEN='\033[01;32m'
|
||||||
|
LYELLOW='\033[01;33m'
|
||||||
|
LBLUE='\033[01;34m'
|
||||||
|
LPURPLE='\033[01;35m'
|
||||||
|
LCYAN='\033[01;36m'
|
||||||
|
WHITE='\033[01;37m'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## INSTALL docker-ce
|
## INSTALL docker-ce
|
||||||
read -r -p "Do you want to install docker? [y/N] " response
|
read -r -p "Do you want to install docker? [y/N] " response
|
||||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
||||||
then
|
then
|
||||||
|
logout=1
|
||||||
curl -fsSL get.docker.com -o get-docker.sh
|
curl -fsSL get.docker.com -o get-docker.sh
|
||||||
sudo sh get-docker.sh
|
sudo sh get-docker.sh
|
||||||
sudo usermod -aG docker $(whoami)
|
sudo systemctl enable docker
|
||||||
else
|
else
|
||||||
echo -e "'no' chosen for docker installation - docker assummed to be already installed"
|
echo -e "'no' chosen for docker installation - docker assummed to be already installed"
|
||||||
fi
|
fi
|
||||||
@ -13,16 +36,43 @@ fi
|
|||||||
read -r -p "Do you want to install docker-compose? [y/N] " response
|
read -r -p "Do you want to install docker-compose? [y/N] " response
|
||||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
||||||
then
|
then
|
||||||
|
logout=1
|
||||||
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
|
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
|
||||||
sudo chmod +x /usr/local/bin/docker-compose
|
sudo chmod +x /usr/local/bin/docker-compose
|
||||||
else
|
else
|
||||||
echo -e "'no' chosen for docker-compose installation - docker-compose assummed to be already installed"
|
echo -e "'no' chosen for docker-compose installation - docker-compose assummed to be already installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## LOGOUT IF NEEDED
|
||||||
|
if [[ "$logout" -eq 1 ]]; then
|
||||||
|
if [[ $(whoami) != "root" ]]; then
|
||||||
|
if [[ ! $(groups $(whoami) | egrep -oh 'docker') == "docker" ]]; then
|
||||||
|
echo -e "${BLUE}your login ${YELLOW}$(whoami)${NC}${BLUE} will be added to "docker" group...${NC}"
|
||||||
|
if [[ ! $(cat /etc/group | egrep -oh 'docker:') == "docker:" ]]; then
|
||||||
|
sudo groupadd docker
|
||||||
|
echo -e "${BLUE}creating group: ${YELLOW}docker${NC}${BLUE}${NC}"
|
||||||
|
fi
|
||||||
|
sudo usermod -aG docker $(whoami)
|
||||||
|
echo -e "${BLUE}you need to logout and login again...${NC}"
|
||||||
|
echo -e "${BLUE}start the same script and skip docker related part (answer 'no' two times).${NC}"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo -e "${YELLOW}docker was installed, you need to logout and login${NC}"
|
||||||
|
echo -e "${RED}login again and start deploy script without docker* installation part (answer no)${NC}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# START docker-compose
|
# START docker-compose
|
||||||
docker-compose up -d --remove-orphans
|
docker-compose up -d --remove-orphans
|
||||||
|
|
||||||
# ADD DATASOURCES AND DASHBOARDS
|
# ADD DATASOURCES AND DASHBOARDS
|
||||||
|
sudo systemctl restart docker
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
# ADD DATASOURCES AND DASHBOARDS
|
||||||
|
sleep 5
|
||||||
echo "adding datasources..."
|
echo "adding datasources..."
|
||||||
docker exec -it -u 0 grafana /var/lib/grafana/ds/add_datasources.sh
|
docker exec -it -u 0 grafana /var/lib/grafana/ds/add_datasources.sh
|
||||||
|
|
||||||
@ -32,8 +82,8 @@ docker exec -it -u 0 grafana /var/lib/grafana/ds/add_dashboards.sh
|
|||||||
|
|
||||||
## NOW LET'S SECURE GRAFANA
|
## NOW LET'S SECURE GRAFANA
|
||||||
# CHECKING OUT ORIGINAL FILE
|
# CHECKING OUT ORIGINAL FILE
|
||||||
#echo -e "checking out original docker-compose.yml"
|
echo -e "checking out original docker-compose.yml"
|
||||||
#git checkout docker-compose.yml
|
git checkout docker-compose.yml
|
||||||
|
|
||||||
## STOPPING and REMOVING GRAFANA CONTAINER
|
## STOPPING and REMOVING GRAFANA CONTAINER
|
||||||
echo -e "stopping & removing grafana container"
|
echo -e "stopping & removing grafana container"
|
||||||
|
@ -80,9 +80,9 @@ install_dashboards() {
|
|||||||
echo "}" >> ${dashboard}.wrapped
|
echo "}" >> ${dashboard}.wrapped
|
||||||
|
|
||||||
if grafana_api POST /api/dashboards/db "" "${dashboard}.wrapped"; then
|
if grafana_api POST /api/dashboards/db "" "${dashboard}.wrapped"; then
|
||||||
echo -e "\n** ${GREEN}installed ok **${NC}"
|
echo -e "\n** ${GREEN}installed ok **${NC}"
|
||||||
else
|
else
|
||||||
echo -e "\n** ${RED}installation of: ${PURPLE}\"${dashboard}\"${RED} failed **${NC}"
|
echo -e "\n** ${RED}installation of: ${PURPLE}\"${dashboard}\"${RED} failed.**${NC}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
2175
grafana/dashboards/docker-system-monitoring.json
Normal file
2175
grafana/dashboards/docker-system-monitoring.json
Normal file
File diff suppressed because it is too large
Load Diff
1488
grafana/dashboards/node_exporter_metrics.json
Normal file
1488
grafana/dashboards/node_exporter_metrics.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -36,3 +36,10 @@ scrape_configs:
|
|||||||
scrape_interval: "15s"
|
scrape_interval: "15s"
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['cadvisor:8080']
|
- targets: ['cadvisor:8080']
|
||||||
|
|
||||||
|
alerting:
|
||||||
|
alertmanagers:
|
||||||
|
- scheme: http
|
||||||
|
static_configs:
|
||||||
|
- targets:
|
||||||
|
- "alertmanager:9093"
|
||||||
|
Loading…
Reference in New Issue
Block a user