feat: add more checks

pull/7/head
sundowndev 2022-11-29 15:15:40 +04:00
parent d430a576b2
commit c41b093f01
8 changed files with 140 additions and 29 deletions

View File

@ -1,11 +1,5 @@
package check
const (
Linux = "linux"
Darwin = "darwin"
Windows = "windows"
)
var checks []Check
type Check interface {

View File

@ -0,0 +1,24 @@
//go:build !windows
package check
type databaseServerCheck struct{}
func NewDatabaseServerCheck() Check {
return &databaseServerCheck{}
}
func (s *databaseServerCheck) Name() string {
return "database-server"
}
func (s *databaseServerCheck) Paths() []string {
return []string{
"/var/log/mysqld.log",
"/var/log/mysql.log",
}
}
func init() {
AddCheck(NewDatabaseServerCheck())
}

26
lib/check/ftp_check.go Normal file
View File

@ -0,0 +1,26 @@
//go:build !windows
package check
type ftpCheck struct{}
func NewFTPCheck() Check {
return &ftpCheck{}
}
func (s *ftpCheck) Name() string {
return "ftp"
}
func (s *ftpCheck) Paths() []string {
return []string{
"/usr/local/psa/var/log/xferlog*",
"/var/log/xferlog*",
"/var/log/secure*",
"/var/log/pureftp.log*",
}
}
func init() {
AddCheck(NewFTPCheck())
}

View File

@ -0,0 +1,28 @@
//go:build !windows
package check
type httpServerCheck struct{}
func NewHTTPServerCheck() Check {
return &httpServerCheck{}
}
func (s *httpServerCheck) Name() string {
return "http-server"
}
func (s *httpServerCheck) Paths() []string {
return []string{
"/var/log/apache2/access.log*",
"/var/log/apache2/error_log*",
"/var/log/httpd*",
"/var/log/apache/access.log*",
"/var/log/apache/error.log*",
"/var/log/nginx/*.log*",
}
}
func init() {
AddCheck(NewHTTPServerCheck())
}

View File

@ -1,23 +0,0 @@
//go:build !windows
package check
type lastLogCheck struct{}
func NewLastLogCheck() Check {
return &lastLogCheck{}
}
func (s *lastLogCheck) Name() string {
return "lastlog"
}
func (s *lastLogCheck) Paths() []string {
return []string{
"/var/log/lastlog",
}
}
func init() {
AddCheck(NewLastLogCheck())
}

24
lib/check/mail_check.go Normal file
View File

@ -0,0 +1,24 @@
//go:build !windows
package check
type mailCheck struct{}
func NewMailCheck() Check {
return &mailCheck{}
}
func (s *mailCheck) Name() string {
return "mail"
}
func (s *mailCheck) Paths() []string {
return []string{
"/usr/local/psa/var/log/maillog*",
"/var/log/maillog*",
}
}
func init() {
AddCheck(NewMailCheck())
}

38
lib/check/system_check.go Normal file
View File

@ -0,0 +1,38 @@
//go:build !windows
package check
type systemCheck struct{}
func NewSystemCheck() Check {
return &systemCheck{}
}
func (s *systemCheck) Name() string {
return "system"
}
func (s *systemCheck) Paths() []string {
return []string{
"/var/log/lastlog",
"/var/log/boot.log*",
"/var/log/auth.log*",
"/var/log/daemon.log*",
"/var/log/kern.log*",
"/var/log/boot.log*",
"/var/log/syslog*",
"/var/log/mail.log*",
"/var/log/messages*",
"/var/log/secure*",
"/var/log/btmp*",
"/var/log/utmp*",
"/var/log/wtmp*",
"/var/log/faillog",
"/var/log/audit/*.log*",
"/var/log/dmesg",
}
}
func init() {
AddCheck(NewSystemCheck())
}