Skip to content

Commit

Permalink
refactor listallnodes; added new metric (#13)
Browse files Browse the repository at this point in the history
* refactor listallnodes to add more labels; added new metric for node total memory in gb
  • Loading branch information
mjavier2k authored Mar 21, 2020
1 parent bc09387 commit ae62104
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
29 changes: 29 additions & 0 deletions pkg/prom/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,35 @@ func (c *solidfireCollector) Collect(ch chan<- prometheus.Metric) {
strconv.Itoa(node.NodeID),
node.Name,
node.ChassisName,
strconv.Itoa(node.AssociatedFServiceID),
strconv.Itoa(node.AssociatedMasterServiceID),
node.PlatformInfo.ChassisType,
node.PlatformInfo.CPUModel,
node.PlatformInfo.NodeType,
node.PlatformInfo.PlatformConfigVersion,
node.Sip,
node.Sipi,
node.SoftwareVersion,
node.UUID,
)

ch <- prometheus.MustNewConstMetric(
MetricDescriptions.NodeMemory,
prometheus.CounterValue,
node.PlatformInfo.NodeMemoryGB,
strconv.Itoa(node.NodeID),
node.Name,
node.ChassisName,
strconv.Itoa(node.AssociatedFServiceID),
strconv.Itoa(node.AssociatedMasterServiceID),
node.PlatformInfo.ChassisType,
node.PlatformInfo.CPUModel,
node.PlatformInfo.NodeType,
node.PlatformInfo.PlatformConfigVersion,
node.Sip,
node.Sipi,
node.SoftwareVersion,
node.UUID,
)
}

Expand Down
12 changes: 10 additions & 2 deletions pkg/prom/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ type Descriptions struct {
VolumeQoSWriteBlockSizes *prometheus.Desc

// ListAllNodes
Node *prometheus.Desc
Node *prometheus.Desc
NodeMemory *prometheus.Desc

// GetClusterStats
ClusterStatsActualIOPS *prometheus.Desc
Expand Down Expand Up @@ -653,7 +654,14 @@ func NewMetricDescriptions(namespace string) *Descriptions {
d.Node = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "node_name"),
"Cluster node name",
[]string{"node_id", "node_name", "chassis_name"},
[]string{"node_id", "node_name", "chassis_name", "associated_fservice_id", "associated_master_service_id", "chassis_type", "cpu_model", "node_type", "platform_config_version", "sip", "sipi", "software_version", "uuid"},
nil,
)

d.NodeMemory = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "node_total_memory_gb"),
"Cluster node total memory in GB",
[]string{"node_id", "node_name", "chassis_name", "associated_fservice_id", "associated_master_service_id", "chassis_type", "cpu_model", "node_type", "platform_config_version", "sip", "sipi", "software_version", "uuid"},
nil,
)

Expand Down
10 changes: 5 additions & 5 deletions pkg/solidfire/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,11 @@ type ListAllNodesResponse struct {
NodeID int `json:"nodeID"`
NodeSlot string `json:"nodeSlot"`
PlatformInfo struct {
ChassisType string `json:"chassisType"`
CPUModel string `json:"cpuModel"`
NodeMemoryGB int `json:"nodeMemoryGB"`
NodeType string `json:"nodeType"`
PlatformConfigVersion string `json:"platformConfigVersion"`
ChassisType string `json:"chassisType"`
CPUModel string `json:"cpuModel"`
NodeMemoryGB float64 `json:"nodeMemoryGB"`
NodeType string `json:"nodeType"`
PlatformConfigVersion string `json:"platformConfigVersion"`
} `json:"platformInfo"`
Sip string `json:"sip"`
Sipi string `json:"sipi"`
Expand Down

0 comments on commit ae62104

Please sign in to comment.