| 1 | //go:build cgo |
| 2 | |
| 3 | package db2 |
| 4 | |
| 5 | import "github.com/netdata/netdata/go/plugins/plugin/ibm.d/modules/db2/contexts" |
| 6 | |
| 7 | func (c *Collector) exportDatabaseMetrics() { |
| 8 | for name, values := range c.mx.databases { |
| 9 | meta := c.databases[name] |
| 10 | statusLabel := "unknown" |
| 11 | if meta != nil && meta.status != "" { |
| 12 | statusLabel = meta.status |
| 13 | } |
| 14 | |
| 15 | labels := contexts.DatabaseLabels{ |
| 16 | Database: name, |
| 17 | Status: statusLabel, |
| 18 | } |
| 19 | |
| 20 | contexts.Database.Status.Set(c.State, labels, contexts.DatabaseStatusValues{ |
| 21 | Status: values.Status, |
| 22 | }) |
| 23 | |
| 24 | contexts.Database.Applications.Set(c.State, labels, contexts.DatabaseApplicationsValues{ |
| 25 | Applications: values.Applications, |
| 26 | }) |
| 27 | } |
| 28 | } |