Skip to content

Commit 8af250d

Browse files
authored
Merge pull request #6 from DeepLcom/NET-1220
Net-1220 - added some sub categories for " show system statistics "
2 parents 3ebf754 + b1544c7 commit 8af250d

File tree

12 files changed

+2132
-0
lines changed

12 files changed

+2132
-0
lines changed

collectors.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import (
4646
"github.com/czerwonk/junos_exporter/pkg/features/storage"
4747
"github.com/czerwonk/junos_exporter/pkg/features/subscriber"
4848
"github.com/czerwonk/junos_exporter/pkg/features/system"
49+
"github.com/czerwonk/junos_exporter/pkg/features/systemstatistics"
4950
"github.com/czerwonk/junos_exporter/pkg/features/twamp"
5051
"github.com/czerwonk/junos_exporter/pkg/features/vpws"
5152
"github.com/czerwonk/junos_exporter/pkg/features/vrrp"
@@ -130,6 +131,8 @@ func (c *collectors) initCollectorsForDevices(device *connector.Device, descRe *
130131
c.addCollectorIfEnabledForDevice(device, "ddosprotection", f.DDOSProtection, ddosprotection.NewCollector)
131132
c.addCollectorIfEnabledForDevice(device, "krt", f.KRT, krt.NewCollector)
132133
c.addCollectorIfEnabledForDevice(device, "twamp", f.TWAMP, twamp.NewCollector)
134+
c.addCollectorIfEnabledForDevice(device, "system_statistics", f.SystemStatistics, systemstatistics.NewCollector)
135+
133136
}
134137

135138
func (c *collectors) addCollectorIfEnabledForDevice(device *connector.Device, key string, enabled bool, newCollector func() collector.RPCCollector) {

internal/config/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ type FeatureConfig struct {
103103
DDOSProtection bool `yaml:"ddos_protection,omitempty"`
104104
KRT bool `yaml:"krt,omitempty"`
105105
TWAMP bool `yaml:"twamp,omitempty"`
106+
SystemStatistics bool `yaml:"system_statistics,omitempty"`
107+
106108
}
107109

108110
// New creates a new config
@@ -182,6 +184,7 @@ func setDefaultValues(c *Config) {
182184
f.License = false
183185
f.MACSec = true
184186
f.Poe = false
187+
f.SystemStatistics = true
185188
}
186189

187190
// FeaturesForDevice gets the feature set configured for a device

main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ var (
9090
poeEnabled = flag.Bool("poe.enabled", true, "Scrape PoE metrics")
9191
krtEnabled = flag.Bool("krt.enabled", false, "Scrape KRT queue metrics")
9292
twampEnabled = flag.Bool("twamp.enabled", false, "Scrape TWAMP metrics")
93+
systemstatisticsEnabled = flag.Bool("systemstatistics.enabled", true, "Scrape system statistics metrics")
9394
cfg *config.Config
9495
devices []*connector.Device
9596
connManager *connector.SSHConnectionManager
@@ -266,6 +267,7 @@ func loadConfigFromFlags() *config.Config {
266267
f.Poe = *poeEnabled
267268
f.KRT = *krtEnabled
268269
f.TWAMP = *twampEnabled
270+
f.SystemStatistics = *systemstatisticsEnabled
269271
return c
270272
}
271273

pkg/features/systemstatistics/collector.go

Lines changed: 927 additions & 0 deletions
Large diffs are not rendered by default.

pkg/features/systemstatistics/rpc.go

Lines changed: 453 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)