aggiunto controllo errori influxdb
This commit is contained in:
parent
87bd709630
commit
e1b13718bf
6 changed files with 30 additions and 16 deletions
|
@ -2,6 +2,6 @@ FROM scratch
|
||||||
|
|
||||||
MAINTAINER Michele Fadda "<mikif70@gmail.com>"
|
MAINTAINER Michele Fadda "<mikif70@gmail.com>"
|
||||||
|
|
||||||
COPY quota_mongodb-v2.0.2 /bin/quota_mongodb
|
COPY quota_mongodb-v2.1.1 /bin/quota_mongodb
|
||||||
|
|
||||||
ENTRYPOINT [ "/bin/quota_mongodb" ]
|
ENTRYPOINT [ "/bin/quota_mongodb" ]
|
||||||
|
|
3
Docker/build.sh
Executable file
3
Docker/build.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker build -t mikif70/qmongo:2.1.1 .
|
|
@ -4,13 +4,12 @@ docker run \
|
||||||
--rm \
|
--rm \
|
||||||
-v /opt/qmongo/log:/data \
|
-v /opt/qmongo/log:/data \
|
||||||
--name qmongo_tiscali \
|
--name qmongo_tiscali \
|
||||||
--log-opt max-size=2m \
|
mikif70/qmongo:2.1.1 \
|
||||||
--log-opt max-file=5 \
|
-l /data/qmongo.log \
|
||||||
mikif70/qmongo:2.0.1 \
|
-p /data/qmongo.pid \
|
||||||
-l /data/llmongo.log \
|
|
||||||
-p /data/llmongo.pid \
|
|
||||||
-r redis-qdb.mail.tiscali.sys:6379 \
|
-r redis-qdb.mail.tiscali.sys:6379 \
|
||||||
-m 10.39.80.189:27017 \
|
-m 10.39.80.189:27017 \
|
||||||
|
-i enginedb@10.39.109.107:8086 \
|
||||||
-d quota \
|
-d quota \
|
||||||
-c tiscali \
|
-c tiscali \
|
||||||
$@
|
$@
|
10
influxdb.go
10
influxdb.go
|
@ -23,7 +23,7 @@ type storage struct {
|
||||||
|
|
||||||
func getStorage() int64 {
|
func getStorage() int64 {
|
||||||
|
|
||||||
db := dbs.mdb.DB("quota").C("tiscali")
|
db := dbs.mdb.DB(dbs.Database).C(dbs.Collection)
|
||||||
|
|
||||||
// start, err0 := time.Parse("06-01-02", "17-03-20")
|
// start, err0 := time.Parse("06-01-02", "17-03-20")
|
||||||
// stop, err1 := time.Parse("06-01-02", "17-03-21")
|
// stop, err1 := time.Parse("06-01-02", "17-03-21")
|
||||||
|
@ -45,15 +45,19 @@ func getStorage() int64 {
|
||||||
|
|
||||||
if opts.Debug {
|
if opts.Debug {
|
||||||
fmt.Println(db.Count())
|
fmt.Println(db.Count())
|
||||||
fmt.Printf("%d", retval[0].Tot)
|
fmt.Printf("retval: %+v - len: %d\n", retval, len(retval))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(retval) > 0 {
|
||||||
return retval[0].Tot
|
return retval[0].Tot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func writeStats() {
|
func writeStats() {
|
||||||
if opts.Debug {
|
if opts.Debug {
|
||||||
fmt.Printf("writing to influxdb server: %s", opts.Influxdb)
|
fmt.Printf("writing to influxdb server: %s\n", opts.Influxdb)
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := influxdb.NewHTTPClient(influxdb.HTTPConfig{
|
c, err := influxdb.NewHTTPClient(influxdb.HTTPConfig{
|
||||||
|
|
2
main.go
2
main.go
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_Version = "v2.1.0"
|
_Version = "v2.1.1"
|
||||||
_Producer = 0
|
_Producer = 0
|
||||||
_Consumer = 1
|
_Consumer = 1
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -36,6 +37,13 @@ func producer() {
|
||||||
status = _Producer
|
status = _Producer
|
||||||
|
|
||||||
retval, err := redis.Values(conn.Do("SCAN", val, "COUNT", strconv.Itoa(opts.MaxBulk)))
|
retval, err := redis.Values(conn.Do("SCAN", val, "COUNT", strconv.Itoa(opts.MaxBulk)))
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Scan err: %+v\n", err)
|
||||||
|
if opts.Debug {
|
||||||
|
fmt.Printf("Scan err: %+v\n", err)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
keys, _ := redis.Strings(retval[1], err)
|
keys, _ := redis.Strings(retval[1], err)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue