Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
166c414af1
|
|||
cedb1dfa5a
|
|||
a21fae4f8a
|
@ -118,3 +118,14 @@ create or replace view router_v as
|
|||||||
cast(values->'wan-out'->>'value' as int) as wanOutOctetsPerSeconds
|
cast(values->'wan-out'->>'value' as int) as wanOutOctetsPerSeconds
|
||||||
from measurements
|
from measurements
|
||||||
where application = 'SNMP' and device = '172.16.3.1';
|
where application = 'SNMP' and device = '172.16.3.1';
|
||||||
|
|
||||||
|
create or replace view lora_sht21_v as
|
||||||
|
select time,
|
||||||
|
cast(values->'Humidity'->>'value' as float) as humidity,
|
||||||
|
cast(values->'Temperature'->>'value' as float) as temperature,
|
||||||
|
m.device as device,
|
||||||
|
d.attributes->>'Label' as label
|
||||||
|
from measurements m, devices d
|
||||||
|
where m.application = 'de-hottis-app01' and
|
||||||
|
m.attributes->>'DeviceType' = 'hottis-gy21' and
|
||||||
|
m.device = d.label;
|
||||||
|
@ -25,7 +25,7 @@ func NewDatabaseHandle() *DatabaseHandle {
|
|||||||
} else {
|
} else {
|
||||||
db.dbh = conn
|
db.dbh = conn
|
||||||
db.initialized = true
|
db.initialized = true
|
||||||
//log.Println("Database connection opened")
|
log.Println("Database connection opened")
|
||||||
}
|
}
|
||||||
return &db
|
return &db
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ func (self *DatabaseHandle) StoreMeasurement(measurement *Measurement) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//log.Println("Successfully stored measurement")
|
log.Println("Successfully stored measurement")
|
||||||
counter.S("Stored")
|
counter.S("Stored")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ func New(id string, config config.HandlerConfigT) handler.Handler {
|
|||||||
t.Id = id
|
t.Id = id
|
||||||
|
|
||||||
t.dbh = database.NewDatabaseHandle()
|
t.dbh = database.NewDatabaseHandle()
|
||||||
|
log.Printf("Handler DT1T %d initialized", id)
|
||||||
t.ready = true
|
t.ready = true
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ func New(id string, config config.HandlerConfigT) handler.Handler {
|
|||||||
}
|
}
|
||||||
t.Id = id
|
t.Id = id
|
||||||
t.dbh = database.NewDatabaseHandle()
|
t.dbh = database.NewDatabaseHandle()
|
||||||
|
log.Printf("Handler Locative %d initialized", id)
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package mbgw3
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"udi/config"
|
"udi/config"
|
||||||
@ -31,6 +32,7 @@ func New(id string, config config.HandlerConfigT) handler.Handler {
|
|||||||
}
|
}
|
||||||
t.Id = id
|
t.Id = id
|
||||||
t.dbh = database.NewDatabaseHandle()
|
t.dbh = database.NewDatabaseHandle()
|
||||||
|
log.Printf("Handler MBGW3 %d initialized", id)
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package pv
|
|||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
"log"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"udi/config"
|
"udi/config"
|
||||||
"udi/handlers/handler"
|
"udi/handlers/handler"
|
||||||
@ -41,6 +42,7 @@ func New(id string, config config.HandlerConfigT) handler.Handler {
|
|||||||
}
|
}
|
||||||
t.Id = id
|
t.Id = id
|
||||||
t.dbh = database.NewDatabaseHandle()
|
t.dbh = database.NewDatabaseHandle()
|
||||||
|
log.Printf("Handler PV %d initialized", id)
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package snmp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
// "log"
|
"log"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"udi/config"
|
"udi/config"
|
||||||
"udi/handlers/handler"
|
"udi/handlers/handler"
|
||||||
@ -33,6 +33,7 @@ func New(id string, config config.HandlerConfigT) handler.Handler {
|
|||||||
}
|
}
|
||||||
t.Id = id
|
t.Id = id
|
||||||
t.dbh = database.NewDatabaseHandle()
|
t.dbh = database.NewDatabaseHandle()
|
||||||
|
log.Printf("Handler SNMP %d initialized", id)
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ func New(id string, config config.HandlerConfigT) handler.Handler {
|
|||||||
t.Id = id
|
t.Id = id
|
||||||
t.ready = true
|
t.ready = true
|
||||||
t.dbh = database.NewDatabaseHandle()
|
t.dbh = database.NewDatabaseHandle()
|
||||||
|
log.Printf("Handler SVER %d initialized", id)
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ func New(id string, config config.HandlerConfigT) handler.Handler {
|
|||||||
}
|
}
|
||||||
t.Id = id
|
t.Id = id
|
||||||
t.dbh = database.NewDatabaseHandle()
|
t.dbh = database.NewDatabaseHandle()
|
||||||
|
log.Printf("Handler Z2M %d initialized", id)
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user