I'm trying to get the toner levels from a Brother MCF-9465CDN using SNMP, in order to ultimately plot them in a graph using Munin. I'm not getting ink levels though.
Although I'm a bit new to SNMP, I assume what I'm trying should be possible.
$ snmpwalk -v 2c -c public a.b.c.d .1.3.6.1.2.1.43.11.1.1.6
iso.3.6.1.2.1.43.11.1.1.6.1.1 = STRING: "Black Toner Cartridge"
iso.3.6.1.2.1.43.11.1.1.6.1.2 = STRING: "Cyan Toner Cartridge"
iso.3.6.1.2.1.43.11.1.1.6.1.3 = STRING: "Magenta Toner Cartridge"
iso.3.6.1.2.1.43.11.1.1.6.1.4 = STRING: "Yellow Toner Cartridge"
iso.3.6.1.2.1.43.11.1.1.6.1.5 = STRING: "Waste Toner Box"
iso.3.6.1.2.1.43.11.1.1.6.1.6 = STRING: "Belt Unit"
iso.3.6.1.2.1.43.11.1.1.6.1.7 = STRING: "Drum Unit"
There are some other fields I'd like to monitor, such as the Drum and Belt pages left, on which I have more success: see the last two entries below.
Note that the Toner Cartridges are all reporting "-3", while I'd expect some kind of value I can use there.
$ snmpwalk -v 2c -c public a.b.c.d iso.3.6.1.2.1.43.11.1.1.9.1
iso.3.6.1.2.1.43.11.1.1.9.1.1 = INTEGER: -3
iso.3.6.1.2.1.43.11.1.1.9.1.2 = INTEGER: -3
iso.3.6.1.2.1.43.11.1.1.9.1.3 = INTEGER: -3
iso.3.6.1.2.1.43.11.1.1.9.1.4 = INTEGER: -3
iso.3.6.1.2.1.43.11.1.1.9.1.5 = INTEGER: -3
iso.3.6.1.2.1.43.11.1.1.9.1.6 = INTEGER: 48877
iso.3.6.1.2.1.43.11.1.1.9.1.7 = INTEGER: 15830
The Brother MFC is using the latest firmware version N1.10.
Using the MFC's web page on a.b.c.d I'm able to get an indication (using a bar) with the amount of toner capacity left.
It turns out that the "-3" return messages are expected.
My Brother MFC doesn't return the level of the toner using snmp, but just "full", "almost empty", "empty" or "absent".
See this question/answer on serverfault.
Related
Finally managed to have my RPI computer module to work with SNMP.
I have a script running that gives me one of my parameters and if I use query using SNMP I get the info back.
pi#raspberrypi:~ $ snmpwalk -v2c -c public localhost NET-SNMP-EXTEND-MIB::nsExtendObjects | grep snmp_status
NET-SNMP-EXTEND-MIB::nsExtendCommand."snmp_status" = STRING: /home/pi/BDC/snmp_status.py
NET-SNMP-EXTEND-MIB::nsExtendArgs."snmp_status" = STRING:
NET-SNMP-EXTEND-MIB::nsExtendInput."snmp_status" = STRING:
NET-SNMP-EXTEND-MIB::nsExtendCacheTime."snmp_status" = INTEGER: 5
NET-SNMP-EXTEND-MIB::nsExtendExecType."snmp_status" = INTEGER: exec(1)
NET-SNMP-EXTEND-MIB::nsExtendRunType."snmp_status" = INTEGER: run-on-read(1)
NET-SNMP-EXTEND-MIB::nsExtendStorage."snmp_status" = INTEGER: permanent(4)
NET-SNMP-EXTEND-MIB::nsExtendStatus."snmp_status" = INTEGER: active(1)
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."snmp_status" = STRING: 0
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."snmp_status" = STRING: 0
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."snmp_status" = INTEGER: 1
NET-SNMP-EXTEND-MIB::nsExtendResult."snmp_status" = INTEGER: 0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."snmp_status".1 = STRING: 0
If my unit is in alarm replies with
NET-SNMP-EXTEND-MIB::nsExtendOutLine."snmp_status".1 = STRING: 1
if not in alarm replies with
NET-SNMP-EXTEND-MIB::nsExtendOutLine."snmp_status".1 = STRING: 0
This status is stored in a file and it's parsed to the SNMP using a python script.
Now... next question.
The SNMP server gives me the following OID
.1.3.6.1.4.1.8072.1.3.2.3.1.2.11.115.110.109.112.95.115.116.97.116.117.115
and for each parameter it gives me one very different IOD.
How can I change this for something more easy... like the ones we see on MIB files?
If you are doing it in the command line, use
snmptranslate -m NET-SNMP-EXTEND-MIB .1.3.6.1.4.1.8072.1.3.2.3.1.2.11.115.110.109.112.95.115.116.97.116.117.115
To do it purely programmatically (i.e. without parsing command line output), you will need a way to parse the MIB files. I think such tools probably exist in Python, but I've never used them myself.
More often, I hard-code constants for the OIDs that I'm interested in, and manually inspect the MIB to know how to decode the index for each object. The OID you gave is an instance of NET-SNMP-EXTEND-MIB::nsExtendOutputFull, which belongs to nsExtendOutput1Entry. Normally the *Entry types will have an INDEX field telling you which field is used as the index of that table. In this case, it has an AUGMENTS field instead, which points you to nsExtendConfigEntry. The INDEX fornsExtendConfigEntry is nsExtendToken, which has a type of DisplayString (basically an OCTET STRING that is limited to human-readable characters).
Here's an example of how I would do this in Python -- you'll need pip install snmp:
from snmp.types import OID, OctetString
nsExtendOutputFull = OID.parse(".1.3.6.1.4.1.8072.1.3.2.3.1.2")
oid = OID.parse(".1.3.6.1.4.1.8072.1.3.2.3.1.2.11.115.110.109.112.95.115.116.97.116.117.115")
nsExtendToken = oid.extractIndex(nsExtendOutputFull, OctetString)
print(f"Index = {nsExtendToken}")
Here's the output:
Index = OctetString(b'snmp_status')
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 11 months ago.
Improve this question
I'm trying to map devices found using LLDP on a switch to a specific interface on that switch.
If I SSH into the switch, I can tell there is a device on its port 6 (interface 6).
If I run snmpwalk looking at the lldpRemEntry, I can see the same device.
snmpwalk -c community -v 2c $IP 1.0.8802.1.1.2.1.4.1.1 | grep 0.6
iso.0.8802.1.1.2.1.4.1.1.4.0.6.32 = INTEGER: 5
iso.0.8802.1.1.2.1.4.1.1.5.0.6.32 = Hex-STRING: 01 0A 63 29 07
iso.0.8802.1.1.2.1.4.1.1.6.0.6.32 = INTEGER: 7
iso.0.8802.1.1.2.1.4.1.1.7.0.6.32 = STRING: "0008303043F4:P1"
iso.0.8802.1.1.2.1.4.1.1.8.0.6.32 = STRING: "SW PORT"
iso.0.8802.1.1.2.1.4.1.1.9.0.6.32 = STRING: "SEP0008303043F4"
iso.0.8802.1.1.2.1.4.1.1.10.0.6.32 = STRING: "Cisco IP Phone 7965G,V11, SCCP45.9-4-2SR4-3S"
iso.0.8802.1.1.2.1.4.1.1.11.0.6.32 = Hex-STRING: 24 00
iso.0.8802.1.1.2.1.4.1.1.12.0.6.32 = Hex-STRING: 24 00
However, when looking at the ifIndex of the same switch, I don't see the same value (I'm expecting 6). Instead, I see these values for the interface id.
snmpwalk -c community -v 2c $IP 1.3.6.1.2.1.2.2.1.1
iso.3.6.1.2.1.2.2.1.1.1 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.1.10 = INTEGER: 10
iso.3.6.1.2.1.2.2.1.1.30 = INTEGER: 30
iso.3.6.1.2.1.2.2.1.1.41 = INTEGER: 41
iso.3.6.1.2.1.2.2.1.1.999 = INTEGER: 999
iso.3.6.1.2.1.2.2.1.1.5179 = INTEGER: 5179
iso.3.6.1.2.1.2.2.1.1.5180 = INTEGER: 5180
iso.3.6.1.2.1.2.2.1.1.5181 = INTEGER: 5181
iso.3.6.1.2.1.2.2.1.1.10101 = INTEGER: 10101
iso.3.6.1.2.1.2.2.1.1.10102 = INTEGER: 10102
iso.3.6.1.2.1.2.2.1.1.10103 = INTEGER: 10103
iso.3.6.1.2.1.2.2.1.1.10104 = INTEGER: 10104
iso.3.6.1.2.1.2.2.1.1.10105 = INTEGER: 10105
iso.3.6.1.2.1.2.2.1.1.10106 = INTEGER: 10106
iso.3.6.1.2.1.2.2.1.1.10107 = INTEGER: 10107
iso.3.6.1.2.1.2.2.1.1.10108 = INTEGER: 10108
iso.3.6.1.2.1.2.2.1.1.10109 = INTEGER: 10109
iso.3.6.1.2.1.2.2.1.1.10110 = INTEGER: 10110
iso.3.6.1.2.1.2.2.1.1.10111 = INTEGER: 10111
iso.3.6.1.2.1.2.2.1.1.10112 = INTEGER: 10112
iso.3.6.1.2.1.2.2.1.1.10113 = INTEGER: 10113
iso.3.6.1.2.1.2.2.1.1.10114 = INTEGER: 10114
iso.3.6.1.2.1.2.2.1.1.10115 = INTEGER: 10115
iso.3.6.1.2.1.2.2.1.1.10116 = INTEGER: 10116
iso.3.6.1.2.1.2.2.1.1.10117 = INTEGER: 10117
iso.3.6.1.2.1.2.2.1.1.10118 = INTEGER: 10118
iso.3.6.1.2.1.2.2.1.1.10119 = INTEGER: 10119
iso.3.6.1.2.1.2.2.1.1.10120 = INTEGER: 10120
iso.3.6.1.2.1.2.2.1.1.10121 = INTEGER: 10121
iso.3.6.1.2.1.2.2.1.1.10122 = INTEGER: 10122
iso.3.6.1.2.1.2.2.1.1.10123 = INTEGER: 10123
iso.3.6.1.2.1.2.2.1.1.10124 = INTEGER: 10124
iso.3.6.1.2.1.2.2.1.1.10125 = INTEGER: 10125
iso.3.6.1.2.1.2.2.1.1.10126 = INTEGER: 10126
iso.3.6.1.2.1.2.2.1.1.10201 = INTEGER: 10201
iso.3.6.1.2.1.2.2.1.1.10202 = INTEGER: 10202
iso.3.6.1.2.1.2.2.1.1.14001 = INTEGER: 14001
iso.3.6.1.2.1.2.2.1.1.14002 = INTEGER: 14002
With these for the names (ifName):
snmpwalk -c community -v 2c $IP 1.3.6.1.2.1.31.1.1.1.1
iso.3.6.1.2.1.31.1.1.1.1.1 = STRING: "Vl1"
iso.3.6.1.2.1.31.1.1.1.1.10 = STRING: "Vl10"
iso.3.6.1.2.1.31.1.1.1.1.30 = STRING: "Vl30"
iso.3.6.1.2.1.31.1.1.1.1.41 = STRING: "Vl41"
iso.3.6.1.2.1.31.1.1.1.1.999 = STRING: "Vl999"
iso.3.6.1.2.1.31.1.1.1.1.5179 = STRING: "StackPort1"
iso.3.6.1.2.1.31.1.1.1.1.5180 = STRING: "StackSub-St1-1"
iso.3.6.1.2.1.31.1.1.1.1.5181 = STRING: "StackSub-St1-2"
iso.3.6.1.2.1.31.1.1.1.1.10101 = STRING: "Gi1/0/1"
iso.3.6.1.2.1.31.1.1.1.1.10102 = STRING: "Gi1/0/2"
iso.3.6.1.2.1.31.1.1.1.1.10103 = STRING: "Gi1/0/3"
iso.3.6.1.2.1.31.1.1.1.1.10104 = STRING: "Gi1/0/4"
iso.3.6.1.2.1.31.1.1.1.1.10105 = STRING: "Gi1/0/5"
iso.3.6.1.2.1.31.1.1.1.1.10106 = STRING: "Gi1/0/6"
iso.3.6.1.2.1.31.1.1.1.1.10107 = STRING: "Gi1/0/7"
iso.3.6.1.2.1.31.1.1.1.1.10108 = STRING: "Gi1/0/8"
iso.3.6.1.2.1.31.1.1.1.1.10109 = STRING: "Gi1/0/9"
iso.3.6.1.2.1.31.1.1.1.1.10110 = STRING: "Gi1/0/10"
iso.3.6.1.2.1.31.1.1.1.1.10111 = STRING: "Gi1/0/11"
iso.3.6.1.2.1.31.1.1.1.1.10112 = STRING: "Gi1/0/12"
iso.3.6.1.2.1.31.1.1.1.1.10113 = STRING: "Gi1/0/13"
iso.3.6.1.2.1.31.1.1.1.1.10114 = STRING: "Gi1/0/14"
iso.3.6.1.2.1.31.1.1.1.1.10115 = STRING: "Gi1/0/15"
iso.3.6.1.2.1.31.1.1.1.1.10116 = STRING: "Gi1/0/16"
iso.3.6.1.2.1.31.1.1.1.1.10117 = STRING: "Gi1/0/17"
iso.3.6.1.2.1.31.1.1.1.1.10118 = STRING: "Gi1/0/18"
iso.3.6.1.2.1.31.1.1.1.1.10119 = STRING: "Gi1/0/19"
iso.3.6.1.2.1.31.1.1.1.1.10120 = STRING: "Gi1/0/20"
iso.3.6.1.2.1.31.1.1.1.1.10121 = STRING: "Gi1/0/21"
iso.3.6.1.2.1.31.1.1.1.1.10122 = STRING: "Gi1/0/22"
iso.3.6.1.2.1.31.1.1.1.1.10123 = STRING: "Gi1/0/23"
iso.3.6.1.2.1.31.1.1.1.1.10124 = STRING: "Gi1/0/24"
iso.3.6.1.2.1.31.1.1.1.1.10125 = STRING: "Gi1/0/25"
iso.3.6.1.2.1.31.1.1.1.1.10126 = STRING: "Gi1/0/26"
iso.3.6.1.2.1.31.1.1.1.1.10201 = STRING: "Te1/0/1"
iso.3.6.1.2.1.31.1.1.1.1.10202 = STRING: "Te1/0/2"
iso.3.6.1.2.1.31.1.1.1.1.14001 = STRING: "Nu0"
iso.3.6.1.2.1.31.1.1.1.1.14002 = STRING: "Fa0"
So I can tell by looking that the index 10106 is the one that has the device on it because it's name matches the local interface name seen when I SSH into the switch. But how do I link these programmatically only using SNMP commands? I tried using the dot1dBasePortIfIndex, but it for some reason doesn't provide all the interfaces to me.
snmpwalk -c community -v 2c $IP 1.3.6.1.2.1.17.1.4.1.2
iso.3.6.1.2.1.17.1.4.1.2.2 = INTEGER: 10102
iso.3.6.1.2.1.17.1.4.1.2.7 = INTEGER: 10107
iso.3.6.1.2.1.17.1.4.1.2.8 = INTEGER: 10108
iso.3.6.1.2.1.17.1.4.1.2.10 = INTEGER: 10110
iso.3.6.1.2.1.17.1.4.1.2.13 = INTEGER: 10113
iso.3.6.1.2.1.17.1.4.1.2.14 = INTEGER: 10114
iso.3.6.1.2.1.17.1.4.1.2.15 = INTEGER: 10115
iso.3.6.1.2.1.17.1.4.1.2.16 = INTEGER: 10116
iso.3.6.1.2.1.17.1.4.1.2.17 = INTEGER: 10117
iso.3.6.1.2.1.17.1.4.1.2.18 = INTEGER: 10118
iso.3.6.1.2.1.17.1.4.1.2.19 = INTEGER: 10119
iso.3.6.1.2.1.17.1.4.1.2.20 = INTEGER: 10120
iso.3.6.1.2.1.17.1.4.1.2.21 = INTEGER: 10121
iso.3.6.1.2.1.17.1.4.1.2.23 = INTEGER: 10123
iso.3.6.1.2.1.17.1.4.1.2.24 = INTEGER: 10124
iso.3.6.1.2.1.17.1.4.1.2.25 = INTEGER: 10125
iso.3.6.1.2.1.17.1.4.1.2.26 = INTEGER: 10126
iso.3.6.1.2.1.17.1.4.1.2.27 = INTEGER: 10201
iso.3.6.1.2.1.17.1.4.1.2.28 = INTEGER: 10202
I'm missing something, but I just don't know what it is. Thanks for the help.
LLDP-MIB contains the following in the description of the LldpPortNumber type:
A port number has no mandatory relationship to an
InterfaceIndex object (of the interfaces MIB, IETF RFC 2863).
If the LLDP agent is a IEEE 802.1D, IEEE 802.1Q bridge, the
LldpPortNumber will have the same value as the dot1dBasePort
object (defined in IETF RFC 1493) associated corresponding
bridge port. If the system hosting LLDP agent is not an
IEEE 802.1D or an IEEE 802.1Q bridge, the LldpPortNumber
will have the same value as the corresponding interface's
InterfaceIndex object.
It looks like you have discovered this fact, as you mentioned you checked the dot1dBasePortIfIndex. The key thing that you are missing is that Cisco uses something called "community string indexing" for some MIBs, including BRIDGE-MIB. You can find more information at this link if you are interested. In short, you have to incorporate the VLAN number into the community string in order to view the entries for the ports on that VLAN. So if your community string is public and your port is on VLAN 100, then you would need to use public#100 for your community string in order to see the dot1dBasePortIfIndex for that port.
As #TallChuck pointed out, there's no relationship between those indexes. However for at least Cisco IOS devices, including the one you're working on, you can tie that index of 6 using LLDP-MIB::lldpLocPortDesc (or .1.0.8802.1.1.2.1.3.7.1.4). The fields returned are the full names of the interfaces, and match the fields returned from IF-MIB::ifDescr (or .1.3.6.1.2.1.2.2.1.2)
$snmpwalk -v2c -c community 10.10.10.10 LLDP-MIB::lldpLocPortDesc
LLDP-MIB::lldpLocPortDesc.1 = STRING: GigabitEthernet1/0/1
LLDP-MIB::lldpLocPortDesc.2 = STRING: GigabitEthernet1/0/2
...
$snmpwalk -v2c -c community 10.10.10.10 IF-MIB::ifDescr
IF-MIB::ifDescr.10101 = STRING: GigabitEthernet1/0/1
IF-MIB::ifDescr.10102 = STRING: GigabitEthernet1/0/2
...
So in my case, an LLDP neighbor with an index of 2 can be tied to the switch's interface index 10102 via the string GigabitEthernet1/0/2.
One last note, dot1dBasePortIfIndex is a separate indexing system from LLDP, and only indexes layer2 interfaces. This is probably why you didn't see all interfaces listed.
this question is the continuation of Extracting Ubuntu Sensors Command Using Scripts
Since the question was poorly written, I'm rewording the question in form of new question.
Basically I want to extract GPUs temperatures information using sensors command and scripts like gawk and bash.
Example of sensors output will be like this:
amdgpu-pci-0c00
Adapter: PCI adapter
fan1: 1972 RPM
temp1: +50.0°C (crit = +0.0°C, hyst = +0.0°C)
amdgpu-pci-0600
Adapter: PCI adapter
fan1: 1960 RPM
temp1: +47.0°C (crit = +0.0°C, hyst = +0.0°C)
amdgpu-pci-0200
Adapter: PCI adapter
fan1: 1967 RPM
temp1: +52.0°C (crit = +0.0°C, hyst = +0.0°C)
pch_skylake-virtual-0
Adapter: Virtual device
temp1: +33.0°C
amdgpu-pci-0900
Adapter: PCI adapter
fan1: 1893 RPM
temp1: +51.0°C (crit = +0.0°C, hyst = +0.0°C)
amdgpu-pci-0300
Adapter: PCI adapter
fan1: 1992 RPM
temp1: +53.0°C (crit = +0.0°C, hyst = +0.0°C)
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +24.0°C (high = +80.0°C, crit = +100.0°C)
Core 0: +23.0°C (high = +80.0°C, crit = +100.0°C)
Core 1: +21.0°C (high = +80.0°C, crit = +100.0°C)
The GPU temp information is labeled amdgpu-pci-"BUS_ID", so we don't care about other label scheme (skylake-virtual nor coretemp-isa). Things need to be done are:
Extracting the GPU temperatures info, for example amdgpu-pci-0c00
has 50 degree, and put in into an array.
The array index should be started with 0 and ascending in the order
of BUS ID.
If using the above data, the array assuming a is the name, would be:
a[0] = 52 ;amdgpu-pci-0200
a[1] = 53 ;amdgpu-pci-0300
a[2] = 47 ;amdgpu-pci-0600
a[3] = 51 ;amdgpu-pci-0900
a[4] = 50 ;amdgpu-pci-0c00
What I need for the output is an infinite loop that keep updating the array index with its value:
0 => 52
1 => 53
2 => 47
3 => 51
4 => 57
The new value should print over the old value so it won't trail. The update should have 1 second delay so the operator can easily evaluate the values.
The extracting and sorting could be done by GAwk, but I need it to be stored in an array in bash so that I can use it for other process.
regards
Reusing parts from your script and Ed Mortons answer I think this might work for you:
#!/bin/bash
while true
do
while read -r i temp ; do
echo -en "GPU $i temp is $temp \r "
sleep 1
done < <(
sensors | gawk '
!NF {name=""}
/amdgpu/ {
name=$1
}
/^temp1:/ && name {
temps[name]=gensub(/^[^0-9]*([0-9]+).*/,"\\1",1,$2);
}
END {
PROCINFO["sorted_in"] = "#ind_str_asc"
ctr=0;
for (i in temps) {
print ctr++,temps[i]
}
} '
)
done
Edit: if you need to store the values to an array (as stated in the question) for other purposes you can do it like this:
temps=( $( sensors | gawk '...' ) )
In this case change the print command in awk to only print temps[i]. My approach can be easily extended to include other values from the sensors output (like the gpu labels or fan speed).
I amb reading the snmp values for a qnap nas, I have three storage with different metrics I'd like to collect, I would like to have a command to get all the values for index=1, but so far I haven't find any snmp command to accomplish it.
volumeID.1 = INTEGER: 1
volumeID.2 = INTEGER: 2
volumeID.3 = INTEGER: 3
volumeCapacity.1 = Counter64: 8716194508
volumeCapacity.2 = Counter64: 8716194508
volumeCapacity.3 = Counter64: 8716194508
volumeFreeSize.1 = Counter64: 3995664864
volumeFreeSize.2 = Counter64: 2783145980
volumeFreeSize.3 = Counter64: 1360632936
volumeStatus.1 = STRING: "Ready"
volumeStatus.2 = STRING: "Ready"
volumeStatus.3 = STRING: "Ready"
volumeSSDCache.1 = INTEGER: -1
volumeSSDCache.2 = INTEGER: -1
volumeSSDCache.3 = INTEGER: -1
I used the command below to get the output shown, but it only reads sequentialy the values I request.
snmpbulkget -m All -v2c -Cn0 -Cr15 -Os -c public nas NAS-MIB::volumeID
This would be also useful for any non-table indexed values
While row-traversal (through the indices) is easy, you have to collect the columns (objects) explicitely, eg.
snmpget ... volumeID.1 volumeCapacity.1 volumeFreeSize.1 ...
(and yes, you can skip the INDEX object volumeID because it's value is just it's index).
I have a ruby multi-line string (called efixes) that looks like:
ID STATE LABEL INSTALL TIME UPDATED BY ABSTRACT
=== ===== ========== ================= ========== ======================================
1 S hayo32.02 xxxxxxx xxxxxxxx xxxxxxxxxxxxxxx
2 S 23434.23 xxxxxxx xxxxxxxx xxxxxxxxxxxxxxx
STATE codes:
S = STABLE
M = MOUNTED
U = UNMOUNTED
Q = REBOOT REQUIRED
B = BROKEN
I = INSTALLING
R = REMOVING
T = TESTED
P = PATCHED
N = NOT PATCHED
SP = STABLE + PATCHED
SN = STABLE + NOT PATCHED
QP = BOOT IMAGE MODIFIED + PATCHED
QN = BOOT IMAGE MODIFIED + NOT PATCHED
RQ = REMOVING + REBOOT REQUIRED
I only want to display the lines that start with a number. I am having trouble, it doesn't seem to be matching. I found this solution here, (that I don't truly understand right now):
efixes_array = efixes.split("\n").select{|x| /\A[0-9]/.match(x)}
io.puts efixes_array.collect{|x| x.scan(/\A[0-9]/)}.flatten
It is only matching the numbers. I want to display the entire line. The end result, I want to display what is under the "LABELS" column.
This line from your example code
efixes.split("\n").select{|x| /\A[0-9]/.match(x)}
returns an array with all lines that start with a number.