Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/icinga2/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var optionalFiles = []string{
"/var/log/icinga2/error.log",
"/var/log/icinga2/crash",
"/var/log/icinga2/debug.log",
"/etc/logrotate.d/icinga2",
}

var commands = map[string][]string{
Expand Down
12 changes: 12 additions & 0 deletions modules/icingadb/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ var files = []string{
"/etc/icinga2/features-enabled/icingadb.conf",
}

var optionalFiles = []string{
"/etc/logrotate.d/icingadb-redis-server",
}

var services = []string{
"icingadb",
"icingadb-redis",
Expand Down Expand Up @@ -67,6 +71,14 @@ func Collect(c *collection.Collection) {
c.AddFiles(ModuleName, file)
}

for _, file := range optionalFiles {
if _, err := os.Stat(file); err != nil {
continue
}

c.AddFiles(ModuleName, file)
}

for _, service := range services {
c.AddServiceStatusRaw(ModuleName+"/service-"+service+".txt", service)
}
Expand Down
14 changes: 14 additions & 0 deletions modules/mysql/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package mysql

import (
"github.com/NETWAYS/support-collector/pkg/collection"
"os"
)

const (
Expand All @@ -26,6 +27,11 @@ var commands = map[string][]string{
"mysql-version.txt": {"mysql", "-V"},
}

var optionalFiles = []string{
"/etc/logrotate.d/mariadb",
"/etc/logrotate.d/mysql",
}

// Detect if a MySQL or MariaDB daemon appears to be running.
func Detect() string {
for _, name := range possibleServices {
Expand Down Expand Up @@ -55,4 +61,12 @@ func Collect(c *collection.Collection) {
for name, cmd := range commands {
c.AddCommandOutput(ModuleName+"/"+name, cmd[0], cmd[1:]...)
}

for _, file := range optionalFiles {
if _, err := os.Stat(file); err != nil {
continue
}

c.AddFiles(ModuleName, file)
}
}