count events and ids indivually.
This commit is contained in:
parent
e7ce83dc86
commit
7587a390fb
|
|
@ -264,8 +264,10 @@ func (u *InfluxUnifi) switchExport(r report, v interface{}) {
|
||||||
case *unifi.Client:
|
case *unifi.Client:
|
||||||
u.batchClient(r, v)
|
u.batchClient(r, v)
|
||||||
case *unifi.Event:
|
case *unifi.Event:
|
||||||
|
r.addEvent()
|
||||||
u.batchEvent(r, v)
|
u.batchEvent(r, v)
|
||||||
case *unifi.IDS:
|
case *unifi.IDS:
|
||||||
|
r.addIDS()
|
||||||
u.batchIDS(r, v)
|
u.batchIDS(r, v)
|
||||||
default:
|
default:
|
||||||
u.Collector.LogErrorf("invalid export type: %T", v)
|
u.Collector.LogErrorf("invalid export type: %T", v)
|
||||||
|
|
@ -276,9 +278,9 @@ func (u *InfluxUnifi) switchExport(r report, v interface{}) {
|
||||||
func (u *InfluxUnifi) LogInfluxReport(r *Report) {
|
func (u *InfluxUnifi) LogInfluxReport(r *Report) {
|
||||||
m := r.Metrics
|
m := r.Metrics
|
||||||
u.Collector.Logf("UniFi Metrics Recorded. Sites: %d, Clients: %d, "+
|
u.Collector.Logf("UniFi Metrics Recorded. Sites: %d, Clients: %d, "+
|
||||||
"UAP: %d, USG/UDM: %d, USW: %d, IDS+Events: %d, Points: %d, "+
|
"UAP: %d, USG/UDM: %d, USW: %d, IDS/Events: %d/%d, Points: %d, "+
|
||||||
"Fields: %d, Errs: %d, Elapsed: %v",
|
"Fields: %d, Errs: %d, Elapsed: %v",
|
||||||
len(m.Sites), len(m.Clients), r.UAP, r.UDM+r.USG,
|
len(m.Sites), len(m.Clients), r.UAP, r.UDM+r.USG,
|
||||||
r.USW, len(r.Events.Logs), r.Total,
|
r.USW, r.IDS, r.Eve, r.Total,
|
||||||
r.Fields, len(r.Errors), r.Elapsed.Round(time.Millisecond))
|
r.Fields, len(r.Errors), r.Elapsed.Round(time.Millisecond))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ type Report struct {
|
||||||
USW int // Total count of USW devices.
|
USW int // Total count of USW devices.
|
||||||
UAP int // Total count of UAP devices.
|
UAP int // Total count of UAP devices.
|
||||||
UDM int // Total count of UDM devices.
|
UDM int // Total count of UDM devices.
|
||||||
|
Eve int // Total count of Events.
|
||||||
|
IDS int // Total count of IDS/IPS Events.
|
||||||
Start time.Time
|
Start time.Time
|
||||||
Elapsed time.Duration
|
Elapsed time.Duration
|
||||||
ch chan *metric
|
ch chan *metric
|
||||||
|
|
@ -39,6 +41,8 @@ type report interface {
|
||||||
addUSG()
|
addUSG()
|
||||||
addUAP()
|
addUAP()
|
||||||
addUSW()
|
addUSW()
|
||||||
|
addEvent()
|
||||||
|
addIDS()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Report) metrics() *poller.Metrics {
|
func (r *Report) metrics() *poller.Metrics {
|
||||||
|
|
@ -67,18 +71,21 @@ func (r *Report) send(m *metric) {
|
||||||
func (r *Report) addUSW() {
|
func (r *Report) addUSW() {
|
||||||
r.USW++
|
r.USW++
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Report) addUAP() {
|
func (r *Report) addUAP() {
|
||||||
r.UAP++
|
r.UAP++
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Report) addUSG() {
|
func (r *Report) addUSG() {
|
||||||
r.USG++
|
r.USG++
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Report) addUDM() {
|
func (r *Report) addUDM() {
|
||||||
r.UDM++
|
r.UDM++
|
||||||
}
|
}
|
||||||
|
func (r *Report) addEvent() {
|
||||||
|
r.Eve++
|
||||||
|
}
|
||||||
|
func (r *Report) addIDS() {
|
||||||
|
r.IDS++
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Report) error(err error) {
|
func (r *Report) error(err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue