@@ -5,8 +5,11 @@ import (
5
5
"fmt"
6
6
"os"
7
7
"strconv"
8
+ "strings"
8
9
"sync"
9
10
"time"
11
+
12
+ "github.com/prometheus/common/version"
10
13
)
11
14
12
15
var currentScreen = "boot_screen"
@@ -161,8 +164,33 @@ func updateStaticContents() {
161
164
if err == nil {
162
165
nativeInstance .UpdateLabelIfChanged ("boot_screen_version" , systemVersion .String ())
163
166
nativeInstance .UpdateLabelIfChanged ("boot_screen_app_version" , appVersion .String ())
167
+ nativeInstance .UpdateLabelIfChanged ("system_version_label" , systemVersion .String ())
168
+ nativeInstance .UpdateLabelIfChanged ("app_version_label" , appVersion .String ())
169
+ }
170
+
171
+ // get cpu info
172
+ cpuInfo , err := os .ReadFile ("/proc/cpuinfo" )
173
+ // get the line starting with "Serial"
174
+ for _ , line := range strings .Split (string (cpuInfo ), "\n " ) {
175
+ if strings .HasPrefix (line , "Serial" ) {
176
+ serial := strings .SplitN (line , ":" , 2 )[1 ]
177
+ nativeInstance .UpdateLabelIfChanged ("cpu_serial_label" , strings .TrimSpace (serial ))
178
+ break
179
+ }
164
180
}
165
181
182
+ // get kernel version
183
+ kernelVersion , err := os .ReadFile ("/proc/version" )
184
+ if err == nil {
185
+ kernelVersion := strings .TrimPrefix (string (kernelVersion ), "Linux version " )
186
+ kernelVersion = strings .SplitN (kernelVersion , " " , 2 )[0 ]
187
+ nativeInstance .UpdateLabelIfChanged ("kernel_version_label" , kernelVersion )
188
+ }
189
+
190
+ nativeInstance .UpdateLabelIfChanged ("build_branch_label" , version .Branch )
191
+ nativeInstance .UpdateLabelIfChanged ("build_date_label" , version .BuildDate )
192
+ nativeInstance .UpdateLabelIfChanged ("golang_version_label" , version .GoVersion )
193
+
166
194
nativeInstance .UpdateLabelIfChanged ("boot_screen_device_id" , GetDeviceID ())
167
195
}
168
196
0 commit comments