Alertmanager: Alertmanager install problem

Created on 22 Dec 2015  Â·  20Comments  Â·  Source: prometheus/alertmanager

Hello!
I would like to install alertmanager without using docker. I followed the steps. But "make" returns me errors. My go env is:


GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/richy/work"
GORACE=""
GOROOT="/home/richy/go"
GOTOOLDIR="/home/richy/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"

I have it


richy@richy:~$ mkdir -p $GOPATH/src/github.com/prometheus
richy@richy:~$ cd $GOPATH/src/github.com/prometheus
richy@richy:~/work/src/github.com/prometheus$ git clone https://github.com/prometheus/alertmanager.git
Clonage dans 'alertmanager'...
remote: Counting objects: 3960, done.
remote: Total 3960 (delta 0), reused 0 (delta 0), pack-reused 3960
Réception d'objets: 100% (3960/3960), 3.98 MiB | 2.44 MiB/s, done.
Résolution des deltas: 100% (2143/2143), done.
Vérification de la connectivité... fait.
richy@richy:~/work/src/github.com/prometheus$ cd alertmanager
richy@richy:~/work/src/github.com/prometheus/alertmanager$ make
>> formatting code
>> building binaries
 >   alertmanager
notify/notify.go:21:2: cannot find package "github.com/cenkalti/backoff" in any of:
    /home/richy/go/src/pkg/github.com/cenkalti/backoff (from $GOROOT)
    /home/richy/work/src/github.com/cenkalti/backoff (from $GOPATH)
provider/sqlite/sqlite.go:9:2: cannot find package "github.com/mattn/go-sqlite3" in any of:
    /home/richy/go/src/pkg/github.com/mattn/go-sqlite3 (from $GOROOT)
    /home/richy/work/src/github.com/mattn/go-sqlite3 (from $GOPATH)
version/info.go:16:8: cannot find package "github.com/prometheus/client_golang/prometheus" in any of:
    /home/richy/go/src/pkg/github.com/prometheus/client_golang/prometheus (from $GOROOT)
    /home/richy/work/src/github.com/prometheus/client_golang/prometheus (from $GOPATH)
notify/impl.go:31:2: cannot find package "github.com/prometheus/common/log" in any of:
    /home/richy/go/src/pkg/github.com/prometheus/common/log (from $GOROOT)
    /home/richy/work/src/github.com/prometheus/common/log (from $GOPATH)
config/config.go:25:2: cannot find package "github.com/prometheus/common/model" in any of:
    /home/richy/go/src/pkg/github.com/prometheus/common/model (from $GOROOT)
    /home/richy/work/src/github.com/prometheus/common/model (from $GOPATH)
api.go:26:2: cannot find package "github.com/prometheus/common/route" in any of:
    /home/richy/go/src/pkg/github.com/prometheus/common/route (from $GOROOT)
    /home/richy/work/src/github.com/prometheus/common/route (from $GOPATH)
notify/impl.go:33:2: cannot find package "golang.org/x/net/context" in any of:
    /home/richy/go/src/pkg/golang.org/x/net/context (from $GOROOT)
    /home/richy/work/src/golang.org/x/net/context (from $GOPATH)
notify/impl.go:34:2: cannot find package "golang.org/x/net/context/ctxhttp" in any of:
    /home/richy/go/src/pkg/golang.org/x/net/context/ctxhttp (from $GOROOT)
    /home/richy/work/src/golang.org/x/net/context/ctxhttp (from $GOPATH)
config/config.go:26:2: cannot find package "gopkg.in/yaml.v2" in any of:
    /home/richy/go/src/pkg/gopkg.in/yaml.v2 (from $GOROOT)
    /home/richy/work/src/gopkg.in/yaml.v2 (from $GOPATH)
make: *** [build] Erreur 1

As beginner I not find the solution.
my go env ? or ...?
Thanks!

Most helpful comment

You need to add the http:// in the Alertmanager URL passed to Prometheus.

All 20 comments

Try adding GO15VENDOREXPERIMENT=1 to your environment.

No change I have the same errors.
It's not a problem of GOPATH or GOROOT ?

Are you using go 1.5.1?

no, 4.9.1 linux/amd64

There is no such version of go, please make sure you're running the latest stable version.

i used go1.5.2.linux-amd64.tar.gz for go installation

Now, i have it


richy@richy:~/alert/src/github.com/prometheus/alertmanager$ make
>> formatting code
>> building binaries
 >   alertmanager
go build: when using gccgo toolchain, please pass linker flags using -gccgoflags, not -ldflags
# github.com/prometheus/alertmanager/template
template/template.go:44:25: error: reference to undefined field or method ‘Option’
   text: tmpltext.New("").Option("missingkey=zero"),
                         ^
template/template.go:45:25: error: reference to undefined field or method ‘Option’
   html: tmplhtml.New("").Option("missingkey=zero"),
                         ^
# github.com/prometheus/alertmanager/config
/tmp/cciKMLZ9.s: Messages de l'assembleur:
/tmp/cciKMLZ9.s:19048: Erreur: symbole « __go_tdn_github.com_prometheus_alertmanager_config.UnmarshalYAML..github.com_prometheus_alertmanager_config.plain » est déjà défini
/tmp/cciKMLZ9.s:19069: Erreur: symbole « __go_td_pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:19410: Erreur: symbole « __go_tdn_github.com_prometheus_alertmanager_config.UnmarshalYAML..github.com_prometheus_alertmanager_config.plain » est déjà défini
/tmp/cciKMLZ9.s:19431: Erreur: symbole « __go_td_pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:20153: Erreur: symbole « __go_tdn_github.com_prometheus_alertmanager_config.UnmarshalYAML..github.com_prometheus_alertmanager_config.plain » est déjà défini
/tmp/cciKMLZ9.s:20174: Erreur: symbole « __go_td_pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:20931: Erreur: symbole « __go_tdn_github.com_prometheus_alertmanager_config.UnmarshalYAML..github.com_prometheus_alertmanager_config.plain » est déjà défini
/tmp/cciKMLZ9.s:20952: Erreur: symbole « __go_td_pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:21758: Erreur: symbole « __go_tdn_github.com_prometheus_alertmanager_config.UnmarshalYAML..github.com_prometheus_alertmanager_config.plain » est déjà défini
/tmp/cciKMLZ9.s:21779: Erreur: symbole « __go_td_pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:22181: Erreur: symbole « __go_td_FppN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plainerN4_boolee » est déjà défini
/tmp/cciKMLZ9.s:22403: Erreur: symbole « __go_tdn_github.com_prometheus_alertmanager_config.UnmarshalYAML..github.com_prometheus_alertmanager_config.plain » est déjà défini
/tmp/cciKMLZ9.s:22424: Erreur: symbole « __go_td_pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:22660: Erreur: symbole « __go_td_FppN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plainerN4_boolee » est déjà défini
/tmp/cciKMLZ9.s:22939: Erreur: symbole « __go_tdn_github.com_prometheus_alertmanager_config.UnmarshalYAML..github.com_prometheus_alertmanager_config.plain » est déjà défini
/tmp/cciKMLZ9.s:22960: Erreur: symbole « __go_td_pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:23176: Erreur: symbole « __go_td_FppN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plainerN4_boolee » est déjà défini
/tmp/cciKMLZ9.s:23303: Erreur: symbole « __go_tdn_github.com_prometheus_alertmanager_config.UnmarshalYAML..github.com_prometheus_alertmanager_config.plain » est déjà défini
/tmp/cciKMLZ9.s:23324: Erreur: symbole « __go_td_pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:23538: Erreur: symbole « __go_td_FppN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plainerN4_boolee » est déjà défini
/tmp/cciKMLZ9.s:23741: Erreur: symbole « __go_tdn_github.com_prometheus_alertmanager_config.UnmarshalYAML..github.com_prometheus_alertmanager_config.plain » est déjà défini
/tmp/cciKMLZ9.s:23762: Erreur: symbole « __go_td_pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:26857: Erreur: symbole « github.com_prometheus_alertmanager_config.SendResolved.pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:26911: Erreur: symbole « github.com_prometheus_alertmanager_config.SendResolved.pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:26965: Erreur: symbole « github.com_prometheus_alertmanager_config.SendResolved.pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
/tmp/cciKMLZ9.s:27019: Erreur: symbole « github.com_prometheus_alertmanager_config.SendResolved.pN61_github.com_prometheus_alertmanager_config.UnmarshalYAML$plain » est déjà défini
make: *** [build] Erreur 2

I'm not sure what's going on there, is your GOROOT set correctly?

Here are my go env


GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/richy/alert"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"

Do you have gccgo installed somewhere? Perhaps it has priority in your PATH.

thank you to all!

I uninstall gccgo and I add the path


export PATH=$PATH:/usr/local/go/bin

I like to know if we can use the gmail SMTP to test sending emails?

it works

Please, I need any assistance regarding the alertmanger.conf.
I would like to have a simple conf of alertmanager.conf to run alertmanager.

Thanx!

My alertmanager.conf is


notification_config {
  name: "alertmanager_test"
  email_config {
    email: "[email protected]"
  }
}
aggregation_rule {
  filter {
    name_re: "job"
    value_re: "node"
  }
  repeat_rate_seconds: 86400
  notification_config_name: "alertmanager_test"
}

But when i do


richy@richy:~/Prometheus/alert/src/github.com/prometheus/alertmanager$ ./alertmanager -config.file=alertmanager.conf
alertmanager, version 0.1.0-beta0 (branch: master, revision: 0c668ea)
  build user:       richy@richy
  build date:       20151223-16:48:15
  go version:       1.5.2
INFO[0000] Loading configuration file                    file=alertmanager.conf source=main.go:125
ERRO[0000] Loading configuration file failed: yaml: line 1: mapping values are not allowed in this context  file=alertmanager.conf source=main.go:128

a solution?

Your configuration file has the format of the old Alertmanager but you are running the new one. If you check the README file of the version you built, you will see an annotated example configuration.

Proper documentation for the new Alertmanager is also being written right now, but unfinished. It might still be helpful: https://github.com/prometheus/docs/pull/275

A simple config could look like this (not tested):

global:
  smtp_from: '[email protected]'
  smtp_smarthost: '<your_mailserver>'

route:
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 3h
  receiver: alertmanager_test

receivers:
- name: alertmanager_test
  email_configs:
  - to: '[email protected]'

Thanks for your help!
I configured the file and I launched Alertmanager. I can not receive alerts from Prometheus

capture du 2015-12-24 10 51 10

the Alertmanager status is

capture du 2015-12-24 10 51 47

Yet I configured alerts therein and alertmanager.url = localhost: 9093

capture du 2015-12-24 10 52 11

The Prometheus status is

capture du 2015-12-24 10 52 42

Please, where can I find the latest stable version of Alertmanager?

What do the logs for Alertmanager and Prometheus say? Any warnings or errors?
You can always check the 0.0.4 tag for the old Alertmanager.


richy@richy:~/Prometheus/serveur$ tail prometheus.log 
time="2015-12-24T11:14:52+01:00" level=error msg="Error sending notification: Post localhost:9093/api/alerts: unsupported protocol scheme \"localhost\"" file=notification.go line=198 
time="2015-12-24T11:15:07+01:00" level=error msg="Error sending notification: Post localhost:9093/api/alerts: unsupported protocol scheme \"localhost\"" file=notification.go line=198 
time="2015-12-24T11:15:22+01:00" level=error msg="Error sending notification: Post localhost:9093/api/alerts: unsupported protocol scheme \"localhost\"" file=notification.go line=198 
time="2015-12-24T11:15:37+01:00" level=error msg="Error sending notification: Post localhost:9093/api/alerts: unsupported protocol scheme \"localhost\"" file=notification.go line=198 
time="2015-12-24T11:15:52+01:00" level=error msg="Error sending notification: Post localhost:9093/api/alerts: unsupported protocol scheme \"localhost\"" file=notification.go line=198 
time="2015-12-24T11:15:53+01:00" level=info msg="Checkpointing in-memory metrics and chunks..." file=persistence.go line=541 
time="2015-12-24T11:15:53+01:00" level=info msg="Done checkpointing in-memory metrics and chunks in 81.590848ms." file=persistence.go line=561 
time="2015-12-24T11:16:07+01:00" level=error msg="Error sending notification: Post localhost:9093/api/alerts: unsupported protocol scheme \"localhost\"" file=notification.go line=198 
time="2015-12-24T11:16:22+01:00" level=error msg="Error sending notification: Post localhost:9093/api/alerts: unsupported protocol scheme \"localhost\"" file=notification.go line=198 
time="2015-12-24T11:16:37+01:00" level=error msg="Error sending notification: Post localhost:9093/api/alerts: unsupported protocol scheme \"localhost\"" file=notification.go line=198 

You need to add the http:// in the Alertmanager URL passed to Prometheus.

Thank you it works!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jfoine picture jfoine  Â·  3Comments

yongzhang picture yongzhang  Â·  5Comments

stuartnelson3 picture stuartnelson3  Â·  5Comments

stuartnelson3 picture stuartnelson3  Â·  5Comments

marcan picture marcan  Â·  4Comments