Skip to content

Commit

Permalink
Records raw OID counter in each sample. (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkinkade authored Aug 26, 2020
1 parent 0e63545 commit 3286a68
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Sample struct {
CollectStart int64 `json:"collectstart"`
CollectEnd int64 `json:"collectend"`
Value uint64 `json:"value"`
Counter uint64 `json:"counter"`
}

// Model represents the structure of metric for DISCO.
Expand Down
4 changes: 4 additions & 0 deletions archive/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ var testModels = []Model{
CollectStart: 1592344911240000000,
CollectEnd: 1592344912360000000,
Value: 158,
Counter: 1246,
},
Sample{
Timestamp: 1591845358,
CollectStart: 1592344911240000000,
CollectEnd: 1592344912360000000,
Value: 132,
Counter: 1378,
},
},
},
Expand All @@ -43,12 +45,14 @@ var testModels = []Model{
CollectStart: 1592344911240000000,
CollectEnd: 1592344912360000000,
Value: 3256,
Counter: 13547,
},
Sample{
Timestamp: 1591845358,
CollectStart: 1592344911240000000,
CollectEnd: 1592344912360000000,
Value: 2789,
Counter: 16336,
},
},
},
Expand Down
3 changes: 2 additions & 1 deletion metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ func (metrics *Metrics) Collect(client snmp.Client, config config.Config) error
Timestamp: metrics.CollectStart.Unix(),
CollectStart: collectStart.UnixNano(),
CollectEnd: collectEnd.UnixNano(),
Value: increase},
Value: increase,
Counter: value},
)

metrics.oids[oid].previousValue = value
Expand Down

0 comments on commit 3286a68

Please sign in to comment.