I receive a stream from a monitor, but I need to format it to store it in a database to graph it. There are three segments to the data; key, value, and status. The status needs to be translated into a number. (status number to code table shown. below) I have a method that uses two reads, the first one that stores the key + value, and a second that stores key + converted status. I don't know if it's possible, but I'd like to do it with one read, and store key + value + converted status on one line in the output to the file.
Status number to code table
#0 #us: unspecified
#0 #ok: ok
#1 #nc: non-critical
#2 #cr: critical
#3 #nr: non-recoverable
What I receive:
What I have:
What I want:
Is this possible?
Thanks!
Status number to code table
#0 #us: unspecified
#0 #ok: ok
#1 #nc: non-critical
#2 #cr: critical
#3 #nr: non-recoverable
What I receive:
Code:
System Temp | 48 degrees C | cr
+1.5V | 1.51 Volts | ok
+5V | 5.15 Volts | nc
+5VSB | 5.12 Volts | ok
+12V | 12.19 Volts | ok
-12V | -12.00 Volts | ok
+3.3V | 3.26 Volts | ok
Code:
v_System_Temp:48
v_+1.5V:1.51
v_+5V:5.15
v_+5VSB:5.12
v_+12V:12.19
v_-12V:-12.00
v_+3.3V:3.26
s_System_Temp:2
s_+1.5V:0
s_+5V:1
s_+5VSB:0
s_+12V:0
s_-12V:0
s_+3.3V:0
Code:
System_Temp:48:2
+1.5V:1.51:0
+5V:5.15:1
+5VSB:5.12:0
+12V:12.19:0
-12V:-12.00:0
+3.3V:3.26:0
Thanks!