diff --git a/config/example/example.go b/config/example/example.go index 50e7cfe1..44bb2816 100644 --- a/config/example/example.go +++ b/config/example/example.go @@ -41,6 +41,11 @@ inputs: variables: true cloudwatch: enable: true + mongodb: + - hostname: localhost + dsn: mongodb://localhost:27017 + enable: true + serverstatus: true mysql: - hostname: localhost dsn: root@tcp(127.0.0.1:3306)/?timeout=3s diff --git a/config/structure.go b/config/structure.go index 9a0131a5..b13f66ac 100644 --- a/config/structure.go +++ b/config/structure.go @@ -54,6 +54,7 @@ type Config struct { Enable bool `yaml:"enable"` } } + MongoDB []MongoDB MySQL []MySQL ProxySQL []struct { Hostname string `yaml:"hostname"` @@ -106,3 +107,10 @@ type MySQL struct { Tables bool `yaml:"tables"` Variables bool `yaml:"variables"` } + +type MongoDB struct { + Hostname string `yaml:"hostname"` + DSN string `yaml:"dsn"` + Enable bool `yaml:"enable"` + ServerStatus bool `yaml:"serverstatus"` +} diff --git a/go.mod b/go.mod index 67a5727e..471496ed 100644 --- a/go.mod +++ b/go.mod @@ -16,15 +16,28 @@ require ( require ( github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-sql-driver/mysql v1.7.1 // indirect + github.com/golang/snappy v0.0.1 // indirect github.com/hpcloud/tail v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/klauspost/compress v1.16.7 // indirect + github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect + github.com/xdg-go/pbkdf2 v1.0.0 // indirect + github.com/xdg-go/scram v1.1.2 // indirect + github.com/xdg-go/stringprep v1.0.4 // indirect + github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect + go.mongodb.org/mongo-driver v1.12.1 // indirect + golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect + golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.7.0 // indirect gopkg.in/fsnotify.v1 v1.4.7 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect ) + +replace github.com/debeando/go-common => /Users/nsc/go/src/github.com/debeando/go-common diff --git a/go.sum b/go.sum index a5ad7288..f32b489d 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/debeando/go-common v0.1.0 h1:wb20i9bt2N+FSR6ixypxrQQ6SCYMKjYLWW2SkuH0cg0= -github.com/debeando/go-common v0.1.0/go.mod h1:umr0E911UyrjnUAuzuJH+9eXpSQbYGuI9aUTDmiLuw8= github.com/debeando/zenit v1.4.5 h1:3qecmh8v2KT2llPA96r9PEBEMWZAZ8EdWEywwzUab6o= github.com/debeando/zenit v1.4.5/go.mod h1:SQy1dXrENEK+kOQRguYYj7edS6k9SLNGKWO/SO3p+CY= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -16,6 +14,10 @@ github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrt github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= @@ -28,6 +30,11 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/kardianos/service v1.2.2 h1:ZvePhAHfvo0A7Mftk/tEzqEZ7Q4lgnR8sGz4xu1YX60= github.com/kardianos/service v1.2.2/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -48,22 +55,38 @@ github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+Kd github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= +github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE= +go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -77,12 +100,18 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= diff --git a/monitor/plugins/inputs/mongodb/serverstatus/main.go b/monitor/plugins/inputs/mongodb/serverstatus/main.go new file mode 100644 index 00000000..c48fe31f --- /dev/null +++ b/monitor/plugins/inputs/mongodb/serverstatus/main.go @@ -0,0 +1,106 @@ +package serverstatus + +import ( + "fmt" + "reflect" + + "zenit/config" + "zenit/monitor/plugins/inputs" + "zenit/monitor/plugins/lists/metrics" + + "github.com/debeando/go-common/cast" + "github.com/debeando/go-common/log" + "github.com/debeando/go-common/mongodb" + "github.com/debeando/go-common/strings" +) + +type Plugin struct { + Name string + Hostname string + Values []metrics.Value +} + +func (p *Plugin) Collect(name string, cnf *config.Config, mtc *metrics.Items) { + defer func() { + if err := recover(); err != nil { + log.ErrorWithFields(name, log.Fields{"error": err}) + } + }() + + for host := range cnf.Inputs.MongoDB { + log.DebugWithFields(name, log.Fields{ + "hostname": cnf.Inputs.MongoDB[host].Hostname, + "enable": cnf.Inputs.MongoDB[host].Enable, + "variables": cnf.Inputs.MongoDB[host].ServerStatus, + }) + + if !cnf.Inputs.MongoDB[host].Enable { + continue + } + + if !cnf.Inputs.MongoDB[host].ServerStatus { + continue + } + + log.InfoWithFields(name, log.Fields{ + "hostname": cnf.Inputs.MongoDB[host].Hostname, + }) + + m := mongodb.New(cnf.Inputs.MongoDB[host].Hostname, cnf.Inputs.MongoDB[host].DSN) + m.Connect() + ss := m.GetServerStatus() + data := reflect.ValueOf(ss) + + p.Name = name + p.Hostname = cnf.Inputs.MongoDB[host].Hostname + p.iterate("", data) + + mtc.Add(metrics.Metric{ + Key: "mongodb_serverstatus", + Tags: []metrics.Tag{ + {Name: "hostname", Value: cnf.Inputs.MongoDB[host].Hostname}, + }, + Values: p.Values, + }) + + p.resetValues() + } +} + +func (p *Plugin) iterate(k string, data reflect.Value) { + switch data.Kind() { + case reflect.Map: + for _, key := range data.MapKeys() { + value := data.MapIndex(key) + + if reflect.TypeOf(value.Interface()).Kind() == reflect.Map { + p.iterate(key.String(), reflect.ValueOf(value.Interface())) + } else { + if cast.InterfaceIsNumber(value.Interface()) { + k := fmt.Sprintf("%s%s%s", strings.ToCamel(k), separator(k, "."), strings.ToCamel(key.String())) + v := value.Interface() + log.DebugWithFields(p.Name, log.Fields{ + "hostname": p.Hostname, + k: v, + }) + p.Values = append(p.Values, metrics.Value{Key: k, Value: v}) + } + } + } + } +} + +func (p *Plugin) resetValues() { + p.Values = []metrics.Value{} +} + +func separator(value, char string) string { + if len(value) > 0 { + return char + } + return "" +} + +func init() { + inputs.Add("InputMongoDBServerStatus", func() inputs.Input { return &Plugin{} }) +} diff --git a/monitor/plugins/plugins.go b/monitor/plugins/plugins.go index 9682fb67..e716fd6f 100644 --- a/monitor/plugins/plugins.go +++ b/monitor/plugins/plugins.go @@ -9,32 +9,33 @@ import ( "zenit/monitor/plugins/inputs" "zenit/monitor/plugins/outputs" - _ "zenit/monitor/plugins/inputs/aws/cloudwatch/rds" - _ "zenit/monitor/plugins/inputs/aws/discover/rds" - _ "zenit/monitor/plugins/inputs/mysql/aurora" - _ "zenit/monitor/plugins/inputs/mysql/overflow" - _ "zenit/monitor/plugins/inputs/mysql/replica" - _ "zenit/monitor/plugins/inputs/mysql/status" - _ "zenit/monitor/plugins/inputs/mysql/tables" - _ "zenit/monitor/plugins/inputs/mysql/variables" - _ "zenit/monitor/plugins/inputs/os/cpu" - _ "zenit/monitor/plugins/inputs/os/disk" - _ "zenit/monitor/plugins/inputs/os/mem" - _ "zenit/monitor/plugins/inputs/os/net" - _ "zenit/monitor/plugins/inputs/os/sys" - _ "zenit/monitor/plugins/inputs/parsers/mysql/audit" - _ "zenit/monitor/plugins/inputs/parsers/mysql/slow" - _ "zenit/monitor/plugins/inputs/percona/deadlock" - _ "zenit/monitor/plugins/inputs/percona/delay" - _ "zenit/monitor/plugins/inputs/percona/kill" - _ "zenit/monitor/plugins/inputs/percona/osc" - _ "zenit/monitor/plugins/inputs/percona/xtrabackup" - _ "zenit/monitor/plugins/inputs/proxysql/commands" - _ "zenit/monitor/plugins/inputs/proxysql/errors" - _ "zenit/monitor/plugins/inputs/proxysql/global" - _ "zenit/monitor/plugins/inputs/proxysql/pool" - _ "zenit/monitor/plugins/inputs/proxysql/queries" - _ "zenit/monitor/plugins/outputs/influxdb" + // _ "zenit/monitor/plugins/inputs/aws/cloudwatch/rds" + // _ "zenit/monitor/plugins/inputs/aws/discover/rds" + _ "zenit/monitor/plugins/inputs/mongodb/serverstatus" + // _ "zenit/monitor/plugins/inputs/mysql/aurora" + // _ "zenit/monitor/plugins/inputs/mysql/overflow" + // _ "zenit/monitor/plugins/inputs/mysql/replica" + // _ "zenit/monitor/plugins/inputs/mysql/status" + // _ "zenit/monitor/plugins/inputs/mysql/tables" + // _ "zenit/monitor/plugins/inputs/mysql/variables" + // _ "zenit/monitor/plugins/inputs/os/cpu" + // _ "zenit/monitor/plugins/inputs/os/disk" + // _ "zenit/monitor/plugins/inputs/os/mem" + // _ "zenit/monitor/plugins/inputs/os/net" + // _ "zenit/monitor/plugins/inputs/os/sys" + // _ "zenit/monitor/plugins/inputs/parsers/mysql/audit" + // _ "zenit/monitor/plugins/inputs/parsers/mysql/slow" + // _ "zenit/monitor/plugins/inputs/percona/deadlock" + // _ "zenit/monitor/plugins/inputs/percona/delay" + // _ "zenit/monitor/plugins/inputs/percona/kill" + // _ "zenit/monitor/plugins/inputs/percona/osc" + // _ "zenit/monitor/plugins/inputs/percona/xtrabackup" + // _ "zenit/monitor/plugins/inputs/proxysql/commands" + // _ "zenit/monitor/plugins/inputs/proxysql/errors" + // _ "zenit/monitor/plugins/inputs/proxysql/global" + // _ "zenit/monitor/plugins/inputs/proxysql/pool" + // _ "zenit/monitor/plugins/inputs/proxysql/queries" + // _ "zenit/monitor/plugins/outputs/influxdb" "github.com/debeando/go-common/log" ) diff --git a/zenit.yaml b/zenit.yaml index d638f811..8e977622 100644 --- a/zenit.yaml +++ b/zenit.yaml @@ -39,6 +39,11 @@ inputs: variables: true cloudwatch: enable: true + mongodb: + - hostname: localhost + dsn: mongodb://localhost:27017 + enable: true + serverstatus: true mysql: - hostname: localhost dsn: root@tcp(127.0.0.1:3306)/?timeout=3s