| | 38 | |
|---|
| | 39 | =text |
|---|
| | 40 | Example outputs from sensors & matching regex parts: |
|---|
| | 41 | |
|---|
| | 42 | Fan output example from sensors: |
|---|
| | 43 | -------------------------------- |
|---|
| | 44 | Case Fan: 1268 RPM (min = 3750 RPM, div = 8) ALARM |
|---|
| | 45 | CPU Fan: 0 RPM (min = 1171 RPM, div = 128) ALARM |
|---|
| | 46 | Aux Fan: 0 RPM (min = 753 RPM, div = 128) ALARM |
|---|
| | 47 | fan4: 3375 RPM (min = 774 RPM, div = 8) |
|---|
| | 48 | fan5: 0 RPM (min = 1054 RPM, div = 128) ALARM |
|---|
| | 49 | |
|---|
| | 50 | ^^^^ ^^^^ ^^^^ |
|---|
| | 51 | $1 $2 $3 |
|---|
| | 52 | |
|---|
| | 53 | -------------------------------- |
|---|
| | 54 | |
|---|
| | 55 | Temorature output example from sensors: |
|---|
| | 56 | --------------------------------------- |
|---|
| | 57 | Sys Temp: +41.0°C (high = -128.0°C, hyst = +24.0°C) ALARM sensor = thermistor |
|---|
| | 58 | CPU Temp: +40.5°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor |
|---|
| | 59 | AUX Temp: +39.0°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor |
|---|
| | 60 | |
|---|
| | 61 | ^^^^^^^^ ^^ ^^ ^^ |
|---|
| | 62 | $1 $2 $3 $4 |
|---|
| | 63 | |
|---|
| | 64 | --------------------------------------- |
|---|
| | 65 | |
|---|
| | 66 | Voltage output example from sensors: |
|---|
| | 67 | ------------------------------------ |
|---|
| | 68 | |
|---|
| | 69 | VCore: +1.09 V (min = +0.00 V, max = +1.74 V) |
|---|
| | 70 | in1: +12.14 V (min = +10.51 V, max = +2.38 V) ALARM |
|---|
| | 71 | |
|---|
| | 72 | ^^^ ^^^ ^^^ ^^ |
|---|
| | 73 | $1 $2 $3 $4 |
|---|
| | 74 | |
|---|
| | 75 | |
|---|
| | 76 | ------------------------------------ |
|---|
| | 77 | =cut |
|---|
| | 78 | |
|---|
| | 79 | |
|---|
| 39 | | fan => { |
|---|
| 40 | | regex => qr/^(\S[^:]*)\s*:\s*\+?(\d+) RPM.*?(\d+) RPM/m, |
|---|
| 41 | | title => 'Fans', |
|---|
| 42 | | vtitle => 'RPM', |
|---|
| 43 | | print_threshold => \&fan_threshold, |
|---|
| 44 | | graph_args => '--base 1000 -l 0' |
|---|
| 45 | | }, |
|---|
| 46 | | temp => { |
|---|
| 47 | | regex => qr/^(\S[^:]*)\s*:\s*\+?(-?\d+(?:\.\d+)?)[° ]C(?:\s+\((?:high|limit)\s*=\s*\+?(\d+(?:\.\d+)?)[° ]C,\s*hyst(?:eresis)?\s*=\s*\+?(\d+(?:\.\d+)?)[° ]C\))?/m, |
|---|
| 48 | | |
|---|
| 49 | | title => 'Temperatures', |
|---|
| 50 | | vtitle => 'Celsius', |
|---|
| 51 | | print_threshold => \&temp_threshold, |
|---|
| 52 | | graph_args => '--base 1000 -l 0' |
|---|
| 53 | | }, |
|---|
| 54 | | volt => { |
|---|
| 55 | | regex => qr/^(\S[^:]*)\s*:\s*\+?(-?\d+(?:\.\d+)?) V(?:\s+\(min\s*=\s*\+?(-?\d+(?:\.\d+)?) V,\s*max\s*=\s*\+?(-?\d+(?:\.\d+)?) V\))/m, |
|---|
| 56 | | title => 'Voltages', |
|---|
| 57 | | vtitle => 'Volt', |
|---|
| 58 | | print_threshold => \&volt_threshold, |
|---|
| 59 | | graph_args => '--base 1000 --logarithmic' |
|---|
| 60 | | }, |
|---|
| 61 | | ); |
|---|
| | 81 | fan => { |
|---|
| | 82 | regex => qr/ |
|---|
| | 83 | ^ # String must start with: |
|---|
| | 84 | (\S[^:]*) # Match any non-whitespace char, except ':' |
|---|
| | 85 | # (Match label as \$1) |
|---|
| | 86 | \s* # Zero or more spaces followed by |
|---|
| | 87 | : # : characheter |
|---|
| | 88 | \s* # Zero or more spaces followed by |
|---|
| | 89 | \+? # Zero or one '+' char. Note: This might not be needed |
|---|
| | 90 | # as FAN speeds don't have + signs in front of them. |
|---|
| | 91 | # This can be probably be removed as the |
|---|
| | 92 | # sensors program never prints a + char in front of |
|---|
| | 93 | # RPM values. Verified in lm-sensors-3-3.1.2 |
|---|
| | 94 | (\d+) # Match one or more digits (Match current value as \$2) |
|---|
| | 95 | \s # Exactly one space followed by |
|---|
| | 96 | RPM.*? # RPM string, and then any chars |
|---|
| | 97 | (\d+) # Match one or more digits (Match minimum value as \$3) |
|---|
| | 98 | \s # Exactly one space followed by |
|---|
| | 99 | RPM # RPM string |
|---|
| | 100 | /xms, |
|---|
| | 101 | title => 'Fans', |
|---|
| | 102 | vtitle => 'RPM', |
|---|
| | 103 | print_threshold => \&fan_threshold, |
|---|
| | 104 | graph_args => '--base 1000 -l 0' |
|---|
| | 105 | }, |
|---|
| | 106 | |
|---|
| | 107 | temp => { |
|---|
| | 108 | regex => qr/ |
|---|
| | 109 | ^ # String must start with: |
|---|
| | 110 | (\S[^:]*) # Match any non-whitespace char, except ':' |
|---|
| | 111 | # (Match label as \$1) |
|---|
| | 112 | \s* # Zero or more spaces followed by |
|---|
| | 113 | : # ':' characheter |
|---|
| | 114 | \s* # Zero or more spaces followed by |
|---|
| | 115 | \+? # Zero or one '+' char followed by |
|---|
| | 116 | |
|---|
| | 117 | (-? # Match zero or one '-' char |
|---|
| | 118 | \d+ # Match one or more digits |
|---|
| | 119 | # (Match current value as \$2) followed by |
|---|
| | 120 | |
|---|
| | 121 | (?:\.\d+)?)# Zero or one match of '.' char followd by one or more |
|---|
| | 122 | # digits. '?:' means it doesn't spit out the field. |
|---|
| | 123 | [°\s] # Match degree char or space char |
|---|
| | 124 | C # Match 'C' char |
|---|
| | 125 | |
|---|
| | 126 | (?: # >>>>Match the following statement zero or one time. |
|---|
| | 127 | # '?:' means it doesn't spit out the field. |
|---|
| | 128 | \s+ # One or more space followed by |
|---|
| | 129 | \( # '(' char |
|---|
| | 130 | (?:high|limit) # 'high' or 'limit' string. |
|---|
| | 131 | # '?:' means it doesn't spit out the field. |
|---|
| | 132 | \s*=\s* # Match zero or more spaces and then '=' char and then |
|---|
| | 133 | # zero or more spaces, followed by |
|---|
| | 134 | \+? # Zero or one '+' char |
|---|
| | 135 | (\d+ # Match one or more digits |
|---|
| | 136 | # (Match high value as \$3) followed by |
|---|
| | 137 | |
|---|
| | 138 | (?:\.\d+)?)# Zero or one match of '.' char followd by one or more |
|---|
| | 139 | # digits. '?:' means it doesn't spit out the field. |
|---|
| | 140 | [°\s] # Match degree char or space char |
|---|
| | 141 | C,\s* # 'C,' string followd by zero or more spaces |
|---|
| | 142 | hyst # 'hyst' string followed by |
|---|
| | 143 | (?:eresis)?# zero or one 'eresis' string. |
|---|
| | 144 | # '?:' means it doesn't spit out the field. |
|---|
| | 145 | \s*=\s* # Match zero or more spaces and then '=' char and then |
|---|
| | 146 | # zero or more spaces, followed by |
|---|
| | 147 | \+? # Zero or one '+' char |
|---|
| | 148 | (\d+ # Match one or more digits |
|---|
| | 149 | # (Match hyst value as \$4) followed by |
|---|
| | 150 | (?:\.\d+)?)# Zero or one match of '.' char followd by one or more |
|---|
| | 151 | # digits. '?:' means it doesn't spit out the field. |
|---|
| | 152 | [°\s]C # Match degree char or space char, and then 'C' char |
|---|
| | 153 | \) # ')' char |
|---|
| | 154 | )? # >>>>end of statement |
|---|
| | 155 | /xms, |
|---|
| | 156 | title => 'Temperatures', |
|---|
| | 157 | vtitle => 'Celsius', |
|---|
| | 158 | print_threshold => \&temp_threshold, |
|---|
| | 159 | graph_args => '--base 1000 -l 0' |
|---|
| | 160 | }, |
|---|
| | 161 | |
|---|
| | 162 | volt => { |
|---|
| | 163 | regex => qr/ |
|---|
| | 164 | ^ # String must start with: |
|---|
| | 165 | (\s?\S[^:]*)# Match any non-whitespace char, except ':' |
|---|
| | 166 | # but allow an optional whitespace at the begining. |
|---|
| | 167 | # This is needed as voltages are sometimes printed with |
|---|
| | 168 | # one space in front of them. |
|---|
| | 169 | # (match the label as \$1) |
|---|
| | 170 | |
|---|
| | 171 | \s*:\s* # Zero or more spaces followed by ':' char and |
|---|
| | 172 | # the zero or more spaces followed by |
|---|
| | 173 | \+? # Zero or one '+' char followed by |
|---|
| | 174 | (-? # Match zero or one '-' char |
|---|
| | 175 | \d+ # Match one or more digits |
|---|
| | 176 | # (match the current voltage as \$2) followed by |
|---|
| | 177 | (?:\.\d+)?) # Zero or one match of '.' char followd by one or more digits. |
|---|
| | 178 | # '?:' means it doesn't spit out the field. |
|---|
| | 179 | \sV # one space, 'V' char |
|---|
| | 180 | |
|---|
| | 181 | (?: # >>>>Match the following statement. |
|---|
| | 182 | # '?:' means it doesn't spit out the field. |
|---|
| | 183 | \s+ # One or more space followed by |
|---|
| | 184 | \( # '(' char |
|---|
| | 185 | min # Match min string |
|---|
| | 186 | \s*=\s* # Match zero or more spaces and then '=' char and |
|---|
| | 187 | # then zero or more spaces, followed by |
|---|
| | 188 | \+? # Zero or one '+' char |
|---|
| | 189 | (-? # Match zero or one '-' char |
|---|
| | 190 | \d+ # Match one or more digits |
|---|
| | 191 | # (Match the minimum value as \$3) followed by |
|---|
| | 192 | (?:\.\d+)?) # Zero or one match of '.' char followd by one or more |
|---|
| | 193 | # digits. '?:' means it doesn't spit out the field. |
|---|
| | 194 | \sV,\s* # One space char, 'V,' string followd by zero or |
|---|
| | 195 | # more spaces |
|---|
| | 196 | |
|---|
| | 197 | max # Match 'max' string |
|---|
| | 198 | \s*=\s* # Match zero or more spaces and then '=' char and |
|---|
| | 199 | # then zero or more spaces, followed by |
|---|
| | 200 | \+? # Zero or one '+' char |
|---|
| | 201 | (-? # Match zero or one '-' char |
|---|
| | 202 | \d+ # Match one or more digits |
|---|
| | 203 | # (Match the max value as \$4) followed by |
|---|
| | 204 | (?:\.\d+)?) # Zero or one match of '.' char followd by one or more digits. |
|---|
| | 205 | # '?:' means passive group (does not match) |
|---|
| | 206 | \sV # one space, 'V' char |
|---|
| | 207 | \) # ')' char |
|---|
| | 208 | ) # >>>>end of statement |
|---|
| | 209 | |
|---|
| | 210 | /xms, |
|---|
| | 211 | |
|---|
| | 212 | title => 'Voltages', |
|---|
| | 213 | vtitle => 'Volt', |
|---|
| | 214 | print_threshold => \&volt_threshold, |
|---|
| | 215 | graph_args => '--base 1000 --logarithmic' |
|---|
| | 216 | }, |
|---|
| | 217 | ); |
|---|