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
|
||||
read -r -p "Do you want to install docker? [y/N] " response
|
||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
||||
then
|
||||
logout=1
|
||||
curl -fsSL get.docker.com -o get-docker.sh
|
||||
sudo sh get-docker.sh
|
||||
sudo usermod -aG docker $(whoami)
|
||||
sudo systemctl enable docker
|
||||
else
|
||||
echo -e "'no' chosen for docker installation - docker assummed to be already installed"
|
||||
fi
|
||||
@ -13,18 +36,43 @@ fi
|
||||
read -r -p "Do you want to install docker-compose? [y/N] " response
|
||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
||||
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 chmod +x /usr/local/bin/docker-compose
|
||||
else
|
||||
echo -e "'no' chosen for docker-compose installation - docker-compose assummed to be already installed"
|
||||
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
|
||||
sudo systemctl restart docker
|
||||
docker-compose up -d
|
||||
|
||||
# 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..."
|
||||
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"]
|
||||
|
||||
telegraf:
|
||||
image: telegraf:latest
|
||||
image: telegraf:1.6-alpine
|
||||
container_name: telegraf
|
||||
network_mode: "host"
|
||||
volumes:
|
||||
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||
- /var/run/utmp:/var/run/utmp:ro
|
||||
environment:
|
||||
# real influx host
|
||||
INFLUXDB_URI: "http://localhost:8086"
|
||||
@ -60,8 +61,12 @@ services:
|
||||
container_name: prometheus
|
||||
volumes:
|
||||
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
links:
|
||||
- cadvisor:cadvisor
|
||||
- alertmanager:alertmanager
|
||||
networks:
|
||||
- private
|
||||
- public
|
||||
command: "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus"
|
||||
ports:
|
||||
- 9090:9090
|
||||
@ -80,12 +85,41 @@ services:
|
||||
- public
|
||||
- private
|
||||
environment:
|
||||
DOGSNAME: "Gula&Bodka"
|
||||
command:
|
||||
- "--collector.textfile"
|
||||
- "--collector.textfile.directory=/var/lib/node_exporter/textfile_collector/"
|
||||
PURPOSE: "PERFORMANCE_MONITORING"
|
||||
expose:
|
||||
- 9100
|
||||
ports:
|
||||
- 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'
|
||||
|
@ -82,7 +82,7 @@ install_dashboards() {
|
||||
if grafana_api POST /api/dashboards/db "" "${dashboard}.wrapped"; then
|
||||
echo -e "\n** ${GREEN}installed ok **${NC}"
|
||||
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
|
||||
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"
|
||||
static_configs:
|
||||
- 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
|
||||
|
||||
|
||||
read -r -p "Do you want to delete all docker \"bridge\" networks? [y/N] " response
|
||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
||||
then
|
||||
for n in $(docker network ls | grep "bridge" | awk '/ / { print $1 }'); do
|
||||
echo -e "attempting to delete network: $n"
|
||||
docker network rm $n || echo "cannot remove: $n"
|
||||
done
|
||||
else
|
||||
echo -e "'no' chosen"
|
||||
fi
|
||||
# read -r -p "Do you want to delete all docker \"bridge\" networks? [y/N] " response
|
||||
# if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
||||
# then
|
||||
# for n in $(docker network ls | grep "bridge" | awk '/ / { print $1 }'); do
|
||||
# echo -e "attempting to delete network: $n"
|
||||
# docker network rm $n || echo "cannot remove: $n"
|
||||
# done
|
||||
# else
|
||||
# echo -e "'no' chosen"
|
||||
# fi
|
||||
|
||||
read -r -p "Do you want to delete all docker dangling images? [y/N] " response
|
||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
|
||||
|
Loading…
Reference in New Issue
Block a user