def parse_netdev(data, prefix="sys.net"):
    """Parse data from /proc/net/dev."""
    lines = data.splitlines()
    # Parse out the column headers as keys.
    _, receive_columns, transmit_columns = lines[1].split("|")
    columns = ["recv_%s" % column for column in receive_columns.split()]
    columns.extend(["send_%s" % column for column in transmit_columns.split()])

    # Parse out the network devices.
    result = {}
    for line in lines[2:]:
        if not ":" in line:
            continue
        device, data = line.split(":")
        device = device.strip()
        data = dict(zip(columns, map(int, data.split())))
        result.update({
            "%s.%s.bytes.received" % (prefix, device): data["recv_bytes"],
            "%s.%s.bytes.sent" % (prefix, device): data["send_bytes"],
            "%s.%s.packets.received" % (prefix, device): data["recv_packets"],
            "%s.%s.packets.sent" % (prefix, device): data["send_packets"]})
    return result