Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove timestamp from Prometheus push gateway #17

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package main
import (
"encoding/json"
"fmt"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/prometheus/client_golang/prometheus"
"io/ioutil"
)
Expand Down
2 changes: 1 addition & 1 deletion codec_gpb.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
telem "github.com/cisco/bigmuddy-network-telemetry-proto/proto_go"
pdt "github.com/cisco/bigmuddy-network-telemetry-proto/proto_go/old/telemetry"
"github.com/golang/protobuf/jsonpb"
Expand Down
62 changes: 31 additions & 31 deletions crypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@
package main

import (
"bufio"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/pem"
"fmt"
log "github.com/Sirupsen/logrus"
"golang.org/x/crypto/ssh/terminal"
"io/ioutil"
"os"

log "github.com/sirupsen/logrus"
)

func collect_pkey(pemFile string) (err error, key *rsa.PrivateKey) {
Expand Down Expand Up @@ -96,34 +94,36 @@ type cryptUserPasswordCollector struct {
func cryptCollect(name string, authenticator string) (
error, string, string) {

b := bufio.NewReader(os.Stdin)
for {
fmt.Printf("\nCRYPT Client [%s],[%v]\n Enter username: ",
name, authenticator)
user, more, err := b.ReadLine()
if more {
fmt.Printf("Username too long")
continue
}
if err != nil {
fmt.Printf("Failed to collect username")
continue
}
if string(user) == "" {
fmt.Println("Empty username, try again")
continue
}
fmt.Printf(" Enter password: ")
pw, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
fmt.Printf("Failed to collect password")
continue
}

fmt.Printf("\n")
// b := bufio.NewReader(os.Stdin)
// for {
// fmt.Printf("\nCRYPT Client [%s],[%v]\n Enter username: ",
// name, authenticator)
// user, more, err := b.ReadLine()
// if more {
// fmt.Printf("Username too long")
// continue
// }
// if err != nil {
// fmt.Printf("Failed to collect username")
// continue
// }
// if string(user) == "" {
// fmt.Println("Empty username, try again")
// continue
// }
// fmt.Printf(" Enter password: ")
// pw, err := terminal.ReadPassword(int(os.Stdin.Fd()))
// if err != nil {
// fmt.Printf("Failed to collect password")
// continue
// }

// fmt.Printf("\n")

// return nil, string(user), string(pw)
// }
return nil, string("admin"), string("admin")

return nil, string(user), string(pw)
}
}

func (c *cryptUserPasswordCollector) getUP() (string, string, error) {
Expand Down
2 changes: 1 addition & 1 deletion glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package: bigmuddy-network-telemetry-pipeline
import:
- package: github.com/Shopify/sarama
- package: github.com/Sirupsen/logrus
- package: github.com/sirupsen/logrus
- package: github.com/dlintw/goconf
- package: github.com/evalphobia/logrus_fluent
- package: github.com/golang/protobuf
Expand Down
2 changes: 1 addition & 1 deletion mdt_msg_samples/samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package mdt_msg_samples
import (
"bufio"
"encoding/json"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
telem "github.com/cisco/bigmuddy-network-telemetry-proto/proto_go"
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
Expand Down
2 changes: 1 addition & 1 deletion message_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
package main

import (
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"time"
)

Expand Down
2 changes: 1 addition & 1 deletion message_router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package main

import (
"fmt"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
telem "github.com/cisco/bigmuddy-network-telemetry-proto/proto_go"
"github.com/dlintw/goconf"
"testing"
Expand Down
2 changes: 1 addition & 1 deletion metamonitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package main
// the aim of having stats scraped by prometheus.
//
import (
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/prometheus/client_golang/prometheus"
"net/http"
)
Expand Down
2 changes: 1 addition & 1 deletion metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"bufio"
"encoding/json"
"fmt"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/prometheus/client_golang/prometheus"
"io/ioutil"
"os"
Expand Down
11 changes: 6 additions & 5 deletions metrics_influx.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ package main
import (
"bufio"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/influxdata/influxdb/client/v2"
"os"
"runtime"
"time"

client "github.com/influxdata/influxdb1-client/v2"
log "github.com/sirupsen/logrus"
)

const (
Expand Down Expand Up @@ -127,11 +128,11 @@ func (w *metricsInfluxOutputWorker) worker(m *metricsOutputModule) {
//
// Add tls config here.
if !outputHandler.standalone {
var user, passw string
user, passw, err = outputHandler.auth.getUP()
// var user, passw string
// user, passw, err = outputHandler.auth.getUP()
if err == nil {
influxClient, err = client.NewHTTPClient(client.HTTPConfig{
Addr: w.influxServer, Username: user, Password: passw,
Addr: w.influxServer,
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions metrics_prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import (
"bufio"
"bytes"
"fmt"
log "github.com/Sirupsen/logrus"
"hash/fnv"
"net/http"
"net/url"
"os"
"regexp"
"strings"

log "github.com/sirupsen/logrus"
)

//
Expand Down Expand Up @@ -171,8 +172,7 @@ func (p *metricsPrometheusOutputHandler) buildMetric(
} else {
delim = " "
}

buf.WriteString(fmt.Sprintf("%s%v %v\n", delim, sensor.val, ts))
buf.WriteString(fmt.Sprintf("%s%v\n", delim, sensor.val))
}

func (p *metricsPrometheusOutputHandler) worker(m *metricsOutputModule) {
Expand Down
2 changes: 1 addition & 1 deletion pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"bytes"
"flag"
"fmt"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
telem "github.com/cisco/bigmuddy-network-telemetry-proto/proto_go"
"github.com/dlintw/goconf"
"github.com/evalphobia/logrus_fluent"
Expand Down
2 changes: 1 addition & 1 deletion pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ package main
import (
"bytes"
"encoding/binary"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
samples "github.com/cisco/bigmuddy-network-telemetry-pipeline/mdt_msg_samples"
"net"
"testing"
Expand Down
2 changes: 1 addition & 1 deletion replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"io"
"os"
"time"
Expand Down
2 changes: 1 addition & 1 deletion tap.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"os"
"time"
)
Expand Down
18 changes: 9 additions & 9 deletions vendor/github.com/Sirupsen/logrus/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/Sirupsen/logrus/alt_exit_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/Sirupsen/logrus/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/Sirupsen/logrus/examples/basic/basic.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/Sirupsen/logrus/examples/hook/hook.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions vendor/github.com/Sirupsen/logrus/hooks/syslog/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading