Переглянути джерело

'branch', 'firmware', 'model' und 'gateway' als indizes von node_stats.

cajus 6 роки тому
батько
коміт
2385ba1e34
1 змінених файлів з 6 додано та 2 видалено
  1. 6 2
      src/nodes2prom.sml

+ 6 - 2
src/nodes2prom.sml

@@ -193,6 +193,10 @@ struct
 			firstseen = firstseen },
 		    {	hostname = hostname,
 			node_id = node_id,
+                        branch = branch,
+                        firmware = firmware,
+                        model = model,
+                        gateway = gateway,
 			clients = clients,
 			online = online,
 			uplink = uplink,
@@ -253,7 +257,7 @@ struct
 		    ("firstseen", prom2string (info_prefix ^ "_firstseen", minitems, LargeInt.toString (Time.toSeconds firstseen)))]
 		end
 
-	fun node_stats { hostname, node_id, clients, online, uplink, loadavg, memory_usage, uptime, rootfs_usage, tx, rx, forward, mgmt_tx, mgmt_rx } =
+	fun node_stats { hostname, node_id, branch, firmware, model, gateway, clients, online, uplink, loadavg, memory_usage, uptime, rootfs_usage, tx, rx, forward, mgmt_tx, mgmt_rx } =
 		let val items =
 			[SOME ("clients", Int.toString clients),
 			 SOME ("online", if online then "1" else "0"),
@@ -267,7 +271,7 @@ struct
 			 case forward of SOME forward' => SOME ("forward", Real.toString(forward')) | NONE => NONE,
 			 case mgmt_tx of SOME mgmt_tx' => SOME ("mgmt_tx", Real.toString(mgmt_tx')) | NONE => NONE,
 			 case mgmt_rx of SOME mgmt_rx' => SOME ("mgmt_rx", Real.toString(mgmt_rx')) | NONE => NONE]
-		    fun item2prom (key, value) = (key, stats_prefix ^ key ^ "{hostname=\"" ^ hostname ^ "\",node_id=\"" ^ node_id ^ "\"} " ^ value ^ " " ^ !timestamp ^ "\n")
+		    fun item2prom (key, value) = (key, stats_prefix ^ key ^ "{hostname=\"" ^ hostname ^ "\",node_id=\"" ^ node_id ^ "\",branch=\"" ^ branch ^ "\",firmware=\"" ^ firmware ^ "\",model=\"" ^ model ^ "\",gateway=\"" ^ gateway ^ "\"} " ^ value ^ " " ^ !timestamp ^ "\n")
 		in List.mapPartial (fn (SOME i) => SOME (item2prom i) | NONE => NONE) items
 		end