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:
|
||||
u.batchClient(r, v)
|
||||
case *unifi.Event:
|
||||
r.addEvent()
|
||||
u.batchEvent(r, v)
|
||||
case *unifi.IDS:
|
||||
r.addIDS()
|
||||
u.batchIDS(r, v)
|
||||
default:
|
||||
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) {
|
||||
m := r.Metrics
|
||||
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",
|
||||
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))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ type Report struct {
|
|||
USW int // Total count of USW devices.
|
||||
UAP int // Total count of UAP 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
|
||||
Elapsed time.Duration
|
||||
ch chan *metric
|
||||
|
|
@ -39,6 +41,8 @@ type report interface {
|
|||
addUSG()
|
||||
addUAP()
|
||||
addUSW()
|
||||
addEvent()
|
||||
addIDS()
|
||||
}
|
||||
|
||||
func (r *Report) metrics() *poller.Metrics {
|
||||
|
|
@ -67,18 +71,21 @@ func (r *Report) send(m *metric) {
|
|||
func (r *Report) addUSW() {
|
||||
r.USW++
|
||||
}
|
||||
|
||||
func (r *Report) addUAP() {
|
||||
r.UAP++
|
||||
}
|
||||
|
||||
func (r *Report) addUSG() {
|
||||
r.USG++
|
||||
}
|
||||
|
||||
func (r *Report) addUDM() {
|
||||
r.UDM++
|
||||
}
|
||||
func (r *Report) addEvent() {
|
||||
r.Eve++
|
||||
}
|
||||
func (r *Report) addIDS() {
|
||||
r.IDS++
|
||||
}
|
||||
|
||||
func (r *Report) error(err error) {
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue