@@ -39,6 +39,10 @@ type Collector struct {
3939 driveTotalBytes * prometheus.Desc
4040 driveAvailableBytes * prometheus.Desc
4141
42+ sysLoadAvg * prometheus.Desc
43+ sysFreeMemoryBytes * prometheus.Desc
44+ sysTotalMemoryBytes * prometheus.Desc
45+
4246 projectionRunning * prometheus.Desc
4347 projectionStatus * prometheus.Desc
4448 projectionProgress * prometheus.Desc
@@ -92,6 +96,10 @@ func NewCollector(config *config.Config, client *client.EventStoreStatsClient) *
9296 driveTotalBytes : prometheus .NewDesc ("eventstore_drive_total_bytes" , "Drive total size in bytes" , []string {"drive" }, nil ),
9397 driveAvailableBytes : prometheus .NewDesc ("eventstore_drive_available_bytes" , "Drive available bytes" , []string {"drive" }, nil ),
9498
99+ sysLoadAvg : prometheus .NewDesc ("eventstore_sys_loadavg" , "System load average" , []string {"period" }, nil ),
100+ sysFreeMemoryBytes : prometheus .NewDesc ("eventstore_sys_free_memory_bytes" , "System free memory in bytes" , nil , nil ),
101+ sysTotalMemoryBytes : prometheus .NewDesc ("eventstore_sys_total_memory_bytes" , "System total memory in bytes" , nil , nil ),
102+
95103 projectionRunning : prometheus .NewDesc ("eventstore_projection_running" , "If 1, projection is in 'Running' state" , []string {"projection" }, nil ),
96104 projectionStatus : prometheus .NewDesc ("eventstore_projection_status" , "If 1, projection is in specified state" , []string {"projection" , "status" }, nil ),
97105 projectionProgress : prometheus .NewDesc ("eventstore_projection_progress" , "Projection progress 0 - 1, where 1 = projection progress at 100%" , []string {"projection" }, nil ),
@@ -144,6 +152,10 @@ func (c *Collector) Describe(ch chan<- *prometheus.Desc) {
144152 ch <- c .driveTotalBytes
145153 ch <- c .driveAvailableBytes
146154
155+ ch <- c .sysLoadAvg
156+ ch <- c .sysFreeMemoryBytes
157+ ch <- c .sysTotalMemoryBytes
158+
147159 ch <- c .projectionRunning
148160 ch <- c .projectionStatus
149161 ch <- c .projectionProgress
@@ -190,6 +202,7 @@ func (c *Collector) collectFromStats(ch chan<- prometheus.Metric, stats *client.
190202 c .collectFromTCPConnectionStats (ch , stats .TCPConnections )
191203 c .collectFromQueueStats (ch , stats .Server .Es .Queues )
192204 c .collectFromDriveStats (ch , stats .Server .System .Drives )
205+ c .collectFromSystemStats (ch , stats .Server .System )
193206 c .collectFromProjectionStats (ch , stats .Projections )
194207 c .collectFromSubscriptionStats (ch , stats .Subscriptions )
195208 c .collectFromStreamStats (ch , stats .Streams )
@@ -240,6 +253,15 @@ func (c *Collector) collectFromDriveStats(ch chan<- prometheus.Metric, stats map
240253 }
241254}
242255
256+ func (c * Collector ) collectFromSystemStats (ch chan <- prometheus.Metric , stats client.SystemStats ) {
257+ ch <- prometheus .MustNewConstMetric (c .sysLoadAvg , prometheus .GaugeValue , stats .LoadAvg .OneMin , "1m" )
258+ ch <- prometheus .MustNewConstMetric (c .sysLoadAvg , prometheus .GaugeValue , stats .LoadAvg .FiveMin , "5m" )
259+ ch <- prometheus .MustNewConstMetric (c .sysLoadAvg , prometheus .GaugeValue , stats .LoadAvg .FifteenMin , "15m" )
260+
261+ ch <- prometheus .MustNewConstMetric (c .sysFreeMemoryBytes , prometheus .GaugeValue , float64 (stats .FreeMem ))
262+ ch <- prometheus .MustNewConstMetric (c .sysTotalMemoryBytes , prometheus .GaugeValue , float64 (stats .TotalMem ))
263+ }
264+
243265func (c * Collector ) collectFromProjectionStats (ch chan <- prometheus.Metric , stats []client.ProjectionStats ) {
244266 for _ , projection := range stats {
245267 running := 0.0
0 commit comments