Skip to content

Commit

Permalink
Update name
Browse files Browse the repository at this point in the history
* Fork ping package.
* Update main name.
  • Loading branch information
SuperQ committed Nov 5, 2018
1 parent 33f278c commit 0a55d76
Show file tree
Hide file tree
Showing 10 changed files with 870 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Expand Up @@ -10,12 +10,12 @@ jobs:
- checkout
- run: go mod download
- run: make promu
- run: make check_license style unused test build
- run: rm -v smokeping_exporter
- run: make style unused test build
- run: rm -v smokeping_prober

build:
machine: true
working_directory: /home/circleci/.go_workspace/src/github.com/superq/smokeping_exporter
working_directory: /home/circleci/.go_workspace/src/github.com/superq/smokeping_prober

steps:
- checkout
Expand All @@ -28,7 +28,7 @@ jobs:

workflows:
version: 2
smokeping_exporter:
smokeping_prober:
jobs:
- test:
filters:
Expand Down
11 changes: 9 additions & 2 deletions README.md
@@ -1,12 +1,12 @@
# smokeping_exporter
# smokeping_prober
Prometheus style "smokeping" prober.

## Overview

This prober sends a series of ICMP (or UDP) pings to a target and records the responses in Prometheus histogram metrics.

```
usage: smokeping_exporter [<flags>] <hosts>...
usage: smokeping_prober [<flags>] <hosts>...
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
Expand All @@ -30,6 +30,13 @@ Args:

## Building and running

Requires Go >= 1.11

```console
go get github.com/superq/smokeping_prober
sudo setcap cap_net_raw=+ep smokeping_prober
```

## Metrics

Metric Name | Type | Description
Expand Down
3 changes: 2 additions & 1 deletion collector.go
Expand Up @@ -15,9 +15,10 @@
package main

import (
"github.com/superq/smokeping_prober/ping"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/log"
"github.com/superq/go-ping"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Expand Up @@ -12,8 +12,7 @@ require (
github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d // indirect
github.com/sirupsen/logrus v1.2.0 // indirect
github.com/superq/go-ping v0.0.0-20181104213257-53547381f759
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc // indirect
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Expand Up @@ -29,10 +29,6 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/superq/go-ping v0.0.0-20181104154941-047489f97917 h1:wbmXLfICQmUm7HYm1QNIwJYCm4MCRGoDmvEraa5eIWg=
github.com/superq/go-ping v0.0.0-20181104154941-047489f97917/go.mod h1:tpobUWz3CVqSu3zItIZ7wxSDIwqFJFReKz3mijV6ikc=
github.com/superq/go-ping v0.0.0-20181104213257-53547381f759 h1:8ZrBFttrpVTbxMZxo/D0m/5Yn6xLmq4on7GtArDE1Bk=
github.com/superq/go-ping v0.0.0-20181104213257-53547381f759/go.mod h1:tpobUWz3CVqSu3zItIZ7wxSDIwqFJFReKz3mijV6ikc=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc h1:ZMCWScCvS2fUVFw8LOpxyUUW5qiviqr4Dg5NdjLeiLU=
Expand Down
9 changes: 5 additions & 4 deletions main.go
Expand Up @@ -18,11 +18,12 @@ import (
"fmt"
"net/http"

"github.com/superq/smokeping_prober/ping"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/log"
"github.com/prometheus/common/version"
"github.com/superq/go-ping"
"gopkg.in/alecthomas/kingpin.v2"
)

Expand Down Expand Up @@ -54,7 +55,7 @@ func HostList(s kingpin.Settings) (target *[]string) {
type pingerList []ping.Pinger

func init() {
prometheus.MustRegister(version.NewCollector("smokeping_exporter"))
prometheus.MustRegister(version.NewCollector("smokeping_prober"))
}

func main() {
Expand All @@ -69,11 +70,11 @@ func main() {
)

log.AddFlags(kingpin.CommandLine)
kingpin.Version(version.Print("smokeping_exporter"))
kingpin.Version(version.Print("smokeping_prober"))
kingpin.HelpFlag.Short('h')
kingpin.Parse()

log.Infoln("Starting smokeping_exporter", version.Info())
log.Infoln("Starting smokeping_prober", version.Info())
log.Infoln("Build context", version.BuildContext())

pingers := make([]*ping.Pinger, len(*hosts))
Expand Down
21 changes: 21 additions & 0 deletions ping/LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Cameron Sparr

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions ping/README.md
@@ -0,0 +1 @@
This is a fork of https://github.com/sparrc/go-ping

0 comments on commit 0a55d76

Please sign in to comment.