Skip to content

Commit

Permalink
Merge pull request #30 from devopyio/prommod
Browse files Browse the repository at this point in the history
Add prommod
  • Loading branch information
devopsjonas authored Mar 31, 2019
2 parents 0d34d46 + 6fef36f commit 3e84482
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/zal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/devopyio/zabbix-alertmanager/zabbixprovisioner/provisioner"
"github.com/devopyio/zabbix-alertmanager/zabbixsender/zabbixsnd"
"github.com/devopyio/zabbix-alertmanager/zabbixsender/zabbixsvc"
"github.com/povilasv/prommod"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
ver "github.com/prometheus/common/version"
Expand All @@ -19,19 +20,19 @@ import (
)

func main() {
app := kingpin.New("zal", "A zabbix and prometheus integration.")
app := kingpin.New("zal", "Zabbix and Prometheus integration.")

app.Version(ver.Print("zal"))
app.HelpFlag.Short('h')

send := app.Command("send", "Start zabbix sender.")
send := app.Command("send", "Listens for Alert requests from Alertmanager and sends them to Zabbix.")
senderAddr := send.Flag("addr", "Server address which will receive alerts from alertmanager.").Default("0.0.0.0:9095").String()
zabbixAddr := send.Flag("zabbix-addr", "Zabbix address.").Envar("ZABBIX_URL").Required().String()
hostsFile := send.Flag("hosts-path", "Path to resolver to host mapping file.").String()
keyPrefix := send.Flag("key-prefix", "Prefix to add to the trapper item key").Default("prometheus").String()
defaultHost := send.Flag("default-host", "default host to send alerts to").Default("prometheus").String()

prov := app.Command("prov", "Start zabbix provisioner.")
prov := app.Command("prov", "Reads Prometheus Alerting rules and converts them into Zabbix Triggers.")
provConfig := prov.Flag("config-path", "Path to provisioner hosts config file.").Required().String()
provUser := prov.Flag("user", "Zabbix json rpc user.").Envar("ZABBIX_USER").Required().String()
provPassword := prov.Flag("password", "Zabbix json rpc password.").Envar("ZABBIX_PASSWORD").Required().String()
Expand Down Expand Up @@ -66,7 +67,7 @@ func main() {
log.SetOutput(os.Stdout)

prometheus.MustRegister(ver.NewCollector(send.FullCommand()))

prometheus.MustRegister(prommod.NewCollector(send.FullCommand()))
switch cmd {
case send.FullCommand():
s, err := zabbixsnd.New(*zabbixAddr)
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/pkg/errors v0.8.1
github.com/povilasv/prommod v0.0.11
github.com/prometheus/client_golang v0.9.2
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
github.com/prometheus/common v0.2.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/povilasv/prommod v0.0.11 h1:uiCU9z2UpNoMFyd5h3evJB8mTBuT9lZU3CYpMZkkyE0=
github.com/povilasv/prommod v0.0.11/go.mod h1:kMc6cpm22gp7m0cPEFRoRgIzXq75ZIJvNY6GbNu9EJk=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740=
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
Expand Down

0 comments on commit 3e84482

Please sign in to comment.