migrate to new server
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -212,7 +213,7 @@ func InsertAlert(prefix string, deveui string, email string, threshold int) {
|
||||
|
||||
_, err := conn.Do("SET", prefix+deveui+":"+email, threshold)
|
||||
if err != nil {
|
||||
logit("InsertAlert: Error inserting: " + prefix + deveui + ":" + email)
|
||||
logit("InsertAlert: Error inserting: " + prefix + deveui + ":" + email)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +281,10 @@ func getLastMetrics(deveui string) OneMetric {
|
||||
}
|
||||
|
||||
// Set headers
|
||||
req.Header.Set("Authorization", "Token nKYCoz3TA-LItYXG988DjdiStMhrfKmFXQqzxrjzJJ7Ek_iUttzFSE9lfe3s6q99EMdcrjuGlDAjp4Y0VnNRXw==")
|
||||
var INFLUX_RO_TOKEN = os.Getenv("INFLUX_RO_TOKEN")
|
||||
|
||||
// Set headers
|
||||
req.Header.Set("Authorization", "Token "+INFLUX_RO_TOKEN)
|
||||
req.Header.Set("accept", "application/csv")
|
||||
req.Header.Set("content-type", "application/vnd.flux")
|
||||
|
||||
@@ -335,7 +339,7 @@ func CheckThreshold(d string, vp int, u2 string, last_metric OneMetric, info_thr
|
||||
if vp <= alert_threshold {
|
||||
if AlarmNotAlreadySent("alarm_sent_accu:", d, u2, alert_threshold) {
|
||||
sendEmailAccu(u2, alias, d, last_metric.BatteryPercent, alert_threshold, "ALARM")
|
||||
InsertAlert("alarm_sent_accu:", d , u2, alert_threshold)
|
||||
InsertAlert("alarm_sent_accu:", d, u2, alert_threshold)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user