aggiunto controllo errori influxdb

This commit is contained in:
Michele 2017-03-21 10:34:37 +01:00
parent 87bd709630
commit e1b13718bf
6 changed files with 30 additions and 16 deletions

View file

@ -2,6 +2,6 @@ FROM scratch
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" ]

3
Docker/build.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
docker build -t mikif70/qmongo:2.1.1 .

View file

@ -4,13 +4,12 @@ docker run \
--rm \
-v /opt/qmongo/log:/data \
--name qmongo_tiscali \
--log-opt max-size=2m \
--log-opt max-file=5 \
mikif70/qmongo:2.0.1 \
-l /data/llmongo.log \
-p /data/llmongo.pid \
mikif70/qmongo:2.1.1 \
-l /data/qmongo.log \
-p /data/qmongo.pid \
-r redis-qdb.mail.tiscali.sys:6379 \
-m 10.39.80.189:27017 \
-i enginedb@10.39.109.107:8086 \
-d quota \
-c tiscali \
$@

View file

@ -23,7 +23,7 @@ type storage struct {
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")
// stop, err1 := time.Parse("06-01-02", "17-03-21")
@ -45,15 +45,19 @@ func getStorage() int64 {
if opts.Debug {
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 0
}
func writeStats() {
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{

View file

@ -12,7 +12,7 @@ import (
)
const (
_Version = "v2.1.0"
_Version = "v2.1.1"
_Producer = 0
_Consumer = 1
)

View file

@ -3,6 +3,7 @@ package main
import (
"fmt"
"log"
"strconv"
"strings"
"time"
@ -36,6 +37,13 @@ func producer() {
status = _Producer
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)