due improvements
This commit is contained in:
parent
0d34d60b40
commit
73297e1fa6
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,18 +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
|
||||||
|
sudo systemctl restart docker
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
|
|
||||||
# ADD DATASOURCES AND DASHBOARDS
|
# ADD DATASOURCES AND DASHBOARDS
|
||||||
|
sleep 5
|
||||||
|
echo "adding datasources..."
|
||||||
|
docker exec -it -u 0 grafana /var/lib/grafana/ds/add_datasources.sh
|
||||||
|
|
||||||
echo "adding dashboards..."
|
echo "adding dashboards..."
|
||||||
docker exec -it -u 0 grafana /var/lib/grafana/ds/add_dashboards.sh
|
docker exec -it -u 0 grafana /var/lib/grafana/ds/add_dashboards.sh
|
||||||
|
|
||||||
echo "adding datasources..."
|
|
||||||
docker exec -it -u 0 grafana /var/lib/grafana/ds/add_datasources.sh
|
|
||||||
|
@ -46,11 +46,12 @@ services:
|
|||||||
command: ["bash", "/var/lib/grafana/ds/add_datasources.sh"]
|
command: ["bash", "/var/lib/grafana/ds/add_datasources.sh"]
|
||||||
|
|
||||||
telegraf:
|
telegraf:
|
||||||
image: telegraf:latest
|
image: telegraf:1.6-alpine
|
||||||
container_name: telegraf
|
container_name: telegraf
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
volumes:
|
volumes:
|
||||||
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||||
|
- /var/run/utmp:/var/run/utmp:ro
|
||||||
environment:
|
environment:
|
||||||
# real influx host
|
# real influx host
|
||||||
INFLUXDB_URI: "http://localhost:8086"
|
INFLUXDB_URI: "http://localhost:8086"
|
||||||
@ -60,8 +61,12 @@ services:
|
|||||||
container_name: prometheus
|
container_name: prometheus
|
||||||
volumes:
|
volumes:
|
||||||
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
|
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||||
|
links:
|
||||||
|
- cadvisor:cadvisor
|
||||||
|
- alertmanager:alertmanager
|
||||||
networks:
|
networks:
|
||||||
- private
|
- private
|
||||||
|
- public
|
||||||
command: "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus"
|
command: "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus"
|
||||||
ports:
|
ports:
|
||||||
- 9090:9090
|
- 9090:9090
|
||||||
@ -80,12 +85,41 @@ services:
|
|||||||
- public
|
- public
|
||||||
- private
|
- private
|
||||||
environment:
|
environment:
|
||||||
DOGSNAME: "Gula&Bodka"
|
PURPOSE: "PERFORMANCE_MONITORING"
|
||||||
command:
|
|
||||||
- "--collector.textfile"
|
|
||||||
- "--collector.textfile.directory=/var/lib/node_exporter/textfile_collector/"
|
|
||||||
expose:
|
expose:
|
||||||
- 9100
|
- 9100
|
||||||
ports:
|
ports:
|
||||||
- 9100:9100
|
- 9100:9100
|
||||||
|
|
||||||
|
#
|
||||||
|
cadvisor:
|
||||||
|
image: google/cadvisor:v0.28.3
|
||||||
|
container_name: cadvisor
|
||||||
|
volumes:
|
||||||
|
- /:/rootfs:ro
|
||||||
|
- /var/run:/var/run:rw
|
||||||
|
- /sys:/sys:ro
|
||||||
|
- /var/lib/docker/:/var/lib/docker:ro
|
||||||
|
#- /cgroup:/cgroup:ro #doesn't work on MacOS only for Linux
|
||||||
|
restart: unless-stopped
|
||||||
|
expose:
|
||||||
|
- 8080
|
||||||
|
networks:
|
||||||
|
- private
|
||||||
|
- public
|
||||||
|
labels:
|
||||||
|
org.label-schema.group: "monitoring"
|
||||||
|
|
||||||
|
alertmanager:
|
||||||
|
image: prom/alertmanager
|
||||||
|
container_name: alertmanager
|
||||||
|
ports:
|
||||||
|
- 9093:9093
|
||||||
|
volumes:
|
||||||
|
- ./alertmanager/:/etc/alertmanager/
|
||||||
|
networks:
|
||||||
|
- private
|
||||||
|
restart: unless-stopped
|
||||||
|
command:
|
||||||
|
- '--config.file=/etc/alertmanager/config.yml'
|
||||||
|
- '--storage.path=/alertmanager'
|
||||||
|
@ -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
@ -32,3 +32,15 @@ scrape_configs:
|
|||||||
scrape_interval: "15s"
|
scrape_interval: "15s"
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['node_exporter:9100']
|
- targets: ['node_exporter:9100']
|
||||||
|
|
||||||
|
- job_name: 'cadvisor'
|
||||||
|
scrape_interval: 5s
|
||||||
|
static_configs:
|
||||||
|
- targets: ['cadvisor:8080']
|
||||||
|
|
||||||
|
alerting:
|
||||||
|
alertmanagers:
|
||||||
|
- scheme: http
|
||||||
|
static_configs:
|
||||||
|
- targets:
|
||||||
|
- "alertmanager:9093"
|
||||||
|
@ -13,16 +13,16 @@ do_cleanup () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
read -r -p "Do you want to delete all docker \"bridge\" networks? [y/N] " response
|
# read -r -p "Do you want to delete all docker \"bridge\" networks? [y/N] " response
|
||||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
# if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
||||||
then
|
# then
|
||||||
for n in $(docker network ls | grep "bridge" | awk '/ / { print $1 }'); do
|
# for n in $(docker network ls | grep "bridge" | awk '/ / { print $1 }'); do
|
||||||
echo -e "attempting to delete network: $n"
|
# echo -e "attempting to delete network: $n"
|
||||||
docker network rm $n || echo "cannot remove: $n"
|
# docker network rm $n || echo "cannot remove: $n"
|
||||||
done
|
# done
|
||||||
else
|
# else
|
||||||
echo -e "'no' chosen"
|
# echo -e "'no' chosen"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
read -r -p "Do you want to delete all docker dangling images? [y/N] " response
|
read -r -p "Do you want to delete all docker dangling images? [y/N] " response
|
||||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
||||||
|
Loading…
Reference in New Issue
Block a user