diff --git a/.ignore b/.ignore new file mode 100644 index 00000000..48b8bf90 --- /dev/null +++ b/.ignore @@ -0,0 +1 @@ +vendor/ diff --git a/internal/log/log.go b/internal/log/log.go index 98ed60f1..afcf3554 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -5,15 +5,12 @@ import ( "log" "log/syslog" "os" - - "github.com/pkg/errors" ) // Level is a log level such a Debug or Error type Level int const ( - initFailed = "failed to initialize syslog logger" syslogFlags = log.Llongfile normalFlags = log.LUTC | log.Ldate | log.Ltime | log.Llongfile @@ -39,13 +36,13 @@ func SetLevel(l Level) { func InitSyslog() (err error) { dl, err := syslog.NewLogger(syslog.LOG_NOTICE, syslogFlags) if err != nil { - return errors.Wrap(err, initFailed) + return fmt.Errorf("InitSyslog failed to initialize debug logger: %+v", err) } debuglog = dl el, err := syslog.NewLogger(syslog.LOG_ERR, syslogFlags) if err != nil { - return errors.Wrap(err, initFailed) + return fmt.Errorf("InitSyslog failed to initialize error logger: %+v", err) } errlog = el diff --git a/pkg/collector/node.go b/pkg/collector/node.go index d94e644c..795e1416 100644 --- a/pkg/collector/node.go +++ b/pkg/collector/node.go @@ -4,6 +4,8 @@ import ( "fmt" "strings" + "github.com/digitalocean/do-agent/internal/log" + "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/node_exporter/collector" @@ -20,6 +22,9 @@ var whitelist = []string{ "node_memory_swaptotal_bytes", "node_filesystem_size_bytes", "node_filesystem_free_bytes", + "node_disk_read_bytes_total", + "node_disk_written_bytes_total", + "node_cpu_seconds_total", "node_load1", "node_load5", "node_load15", @@ -75,6 +80,8 @@ func (n *NodeCollector) Collect(ch chan<- prometheus.Metric) { for _, s := range whitelist { if strings.Contains(d, fmt.Sprintf(`fqname: "%s"`, s)) { ch <- m + } else { + log.Debug("Node metric not whitelisted. Ignoring: %q", d) } } }