Skip to content

Commit

Permalink
Fixed arguments trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
vfarcic committed Jun 4, 2017
1 parent b2a782d commit 5729897
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 8 deletions.
3 changes: 0 additions & 3 deletions config/alertmanager/Dockerfile

This file was deleted.

3 changes: 3 additions & 0 deletions config/alertmanager/Dockerfile.slack
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM prom/alertmanager

COPY config-slack.yml /etc/alertmanager/config.yml
File renamed without changes.
6 changes: 4 additions & 2 deletions prometheus/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ func (s *RunTestSuite) Test_Run_ExecutesPrometheus() {
s.Equal([]string{"/bin/sh", "-c", "prometheus -config.file=/etc/prometheus/prometheus.yml -storage.local.path=/prometheus -web.console.libraries=/usr/share/prometheus/console_libraries -web.console.templates=/usr/share/prometheus/consoles"}, actualArgs)
}

func (s *RunTestSuite) Test_Run_AddsRoutePrefix() {
func (s *RunTestSuite) Test_Run_AddsArguments() {
cmdRunOrig := cmdRun
defer func() {
cmdRun = cmdRunOrig
os.Unsetenv("ARG_WEB_ROUTE-PREFIX")
os.Unsetenv("ARG_ALERTMANAGER_URL")
}()
os.Setenv("ARG_WEB_ROUTE-PREFIX", "/something")
os.Setenv("ARG_ALERTMANAGER_URL", "alertmanager")
actualArgs := []string{}
cmdRun = func(cmd *exec.Cmd) error {
actualArgs = cmd.Args
Expand All @@ -58,7 +60,7 @@ func (s *RunTestSuite) Test_Run_AddsRoutePrefix() {

Run()

s.Equal([]string{"/bin/sh", "-c", "prometheus -config.file=/etc/prometheus/prometheus.yml -storage.local.path=/prometheus -web.console.libraries=/usr/share/prometheus/console_libraries -web.console.templates=/usr/share/prometheus/consoles -web.route-prefix=/something"}, actualArgs)
s.Equal([]string{"/bin/sh", "-c", "prometheus -config.file=/etc/prometheus/prometheus.yml -storage.local.path=/prometheus -web.console.libraries=/usr/share/prometheus/console_libraries -web.console.templates=/usr/share/prometheus/consoles -web.route-prefix=/something -alertmanager.url=alertmanager"}, actualArgs)
}

func (s *RunTestSuite) Test_Run_AddsExternalUrl() {
Expand Down
2 changes: 1 addition & 1 deletion prometheus/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func getArgFromEnv(env, prefix string) (key, value string) {
if strings.HasPrefix(env, prefix + "_") {
values := strings.Split(env, "=")
key = values[0]
key = strings.TrimLeft(key, prefix + "_")
key = strings.Replace(key, prefix + "_", "", 1)
key = strings.ToLower(key)
value = values[1]
}
Expand Down
26 changes: 26 additions & 0 deletions scripts/dm-swarm-07.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

./scripts/dm-swarm.sh

eval $(docker-machine env swarm-1)

docker network create -d overlay proxy

docker stack deploy \
-c stacks/docker-flow-proxy-mem.yml \
proxy

docker network create -d overlay monitor

DOMAIN=$(docker-machine ip swarm-1) \
docker stack deploy \
-c stacks/docker-flow-monitor-am.yml \
monitor

docker stack deploy \
-c stacks/exporters-alert.yml \
exporter

docker stack deploy \
-c stacks/go-demo-alert.yml \
go-demo
1 change: 1 addition & 0 deletions stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DF_NOTIFY_CREATE_SERVICE_URL=http://monitor:8080/v1/docker-flow-monitor/reconfigure
- DF_NOTIFY_REMOVE_SERVICE_URL=http://monitor:8080/v1/docker-flow-monitor/remove
deploy:
labels:
- com.df.alertName=memlimit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3"
services:

alert-manager:
image: vfarcic/alert-manager:demo
image: vfarcic/alert-manager:slack
ports:
- 9093:9093
networks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ services:
- com.df.servicePath=/monitor
- com.df.serviceDomain=${DOMAIN:-localhost}
- com.df.port=9090
resources:
reservations:
memory: 500M
limits:
memory: 800M

alert-manager:
image: vfarcic/alert-manager:demo
image: vfarcic/alert-manager:slack
networks:
- monitor

Expand All @@ -38,6 +43,11 @@ services:
deploy:
placement:
constraints: [node.role == manager]
resources:
reservations:
memory: 5M
limits:
memory: 10M

networks:
monitor:
Expand Down

0 comments on commit 5729897

Please sign in to comment.