prymitive / karma

Alert dashboard for Prometheus Alertmanager
https://demo.karma-dashboard.io/
Apache License 2.0
2.33k stars 175 forks source link

How to Change Port Number in prymitive/karma #3253

Closed MohdRashid01 closed 3 years ago

MohdRashid01 commented 3 years ago

Hi All,

I try to change port number in docker-compose.yml file but its not working it taking default port number only. Here is the docker-compose.yml

 cat docker-compose.yml 
version: '3.2'

services:

  prometheus:
       image: prom/prometheus:latest
#       container_name: monitoring_prometheus
       command:
         - '--config.file=/etc/prometheus/prometheus.yml'
         - '--storage.tsdb.path=/prometheus'
         - '--web.console.libraries=/usr/share/prometheus/console_libraries'
         - '--web.console.templates=/usr/share/prometheus/consoles'
       volumes:
         - /home/Prometheus/alert.rules:/etc/prometheus/alert.rules
         - /home/Prometheus/container.yml:/etc/prometheus/container.yml
         - /home/Prometheus/diskusage.yml:/etc/prometheus/diskusage.yml
         - /home/Prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
       ports:
         - 9090:9090

  node-exporter:       
       image: prom/node-exporter:latest
#       container_name: monitoring_node_exporter       
       volumes:       
         - /proc:/host/proc:ro       
         - /sys:/host/sys:ro       
         - /:/rootfs:ro       
       ports:
         - 9100:9100
       command:       
         - '--path.procfs=/host/proc'       
         - '--path.sysfs=/host/sys'       
         - '--path.rootfs=/host'       
         - '--collector.filesystem.ignored-mount-points="^(/rootfs|/host|)/(sys|proc|dev|host|etc)($$|/)"'       
         - '--collector.filesystem.ignored-fs-types="^(sys|proc|auto|cgroup|devpts|ns|au|fuse\.lxc|mqueue)(fs|)$$"'       

  cadvisor:
       image: google/cadvisor:latest
       privileged: true
#       container_name: monitoring_cadvisor
       ports:
         - 8080:8080
       volumes:
         - /var/run/docker.sock:/var/run/docker.sock:ro
         - /:/rootfs:ro
#         - /var/run:/var/run:rw
         - /sys:/sys:ro
         - /var/lib/docker/:/var/lib/docker:ro

  grafana:
       image: grafana/grafana:latest
#       image: grafana-custom:latest
#       container_name: monitoring_grafana   
       volumes:
         - grafana-data:/var/lib/grafana
#         - ./data/grafana:/var/lib/grafana
#         - ./grafana/provisioning:/etc/grafana/provisioning
#         - ./defaults.ini:/usr/share/grafana/conf/defaults.ini
       ports:
         - 3000:3000
       environment:
         - "GF_SMTP_ENABLED=true" 
         - "GF_SMTP_HOST=smtp.gmail.com:465" 
         - "GF_SMTP_USER=test@gmail.com" 
         - "GF_SMTP_PASSWORD=xxxxx" 

  alertmanager:
       image: prom/alertmanager
#        privileged: true
       volumes:
         - ./alertmanager.yml:/alertmanager.yml
       command:
         - '--config.file=/alertmanager.yml'
       ports:
         - '9093:9093'

  karma-alert-dashboard:
#       image: cloudflare/unsee
       image: lmierzwa/karma:latest
       environment:
#         - "ALERTMANAGER_URIS=default:http://alertmanager:9093"
         - "ALERTMANAGER_URI=http://alertmanager:9093"
       ports:
         - '8081:9094'

volumes:
  grafana-data:

and Here is the prometheus.yml file

cat prometheus.yml 
# 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).       
  # Attach these labels to any time series or alerts when communicating with       
  # external systems (federation, remote storage, Alertmanager).       

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.       
rule_files:       
  - "/etc/prometheus/alert.rules"
  - "/etc/prometheus/container.yml"
  - "/etc/prometheus/diskusage.yml"
  # - "first.rules"       
  # - "second.rules"       

# Alerting specifies settings related to the Alertmanager
alerting:
 alertmanagers:
   - static_configs:
     - targets:
       # Alertmanager's default port is 9093
       - alertmanager:9093

# A scrape configuration containing exactly one endpoint to scrape:       
# Here it's Prometheus itself.       
scrape_configs:       

#  - job_name: 'prometheus'
#    static_configs:
#      # the targets listed here must match the service names from the docker-compose file       
#      - targets: ['prometheus:9090']

  - job_name: 'node-exporter'       
    static_configs:       
      # the targets listed here must match the service names from the docker-compose file       
      - targets: ['node-exporter:9100']       

  - job_name: 'cadvisor'       
    static_configs:                       
      # the targets listed here must match the service names from the docker-compose file       
      - targets: ['cadvisor:8080']

Here is the screenshot which u can see port number is showing different in docker container image

Just help me How to change port number in cadvisor, node-exporter, karma-alert-dashboard.

prymitive commented 3 years ago

All the config options are documented on https://github.com/prymitive/karma/blob/main/docs/CONFIGURATION.md Pass --listen.port N or export LISTEN_PORT=N env variable.

MohdRashid01 commented 3 years ago

U mean below one like that ....i have added in environment docker-compose.yml file Is that correct or not let me know

karma-alert-dashboard:

image: cloudflare/unsee

   image: lmierzwa/karma:latest
   environment:
     - "export LISTEN_PORT=9094"
     - "ALERTMANAGER_URI=http://alertmanager:9093"
   ports:
     - '9094:9094'