LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   List of dmesg Error Codes (https://www.linuxquestions.org/questions/linux-enterprise-47/list-of-dmesg-error-codes-4175424065/)

worm5252 08-26-2012 10:56 AM

List of dmesg Error Codes
 
Does anyone know where I can find a list of most or all possbile error codes that are displayed in dmesg?

I am working on a server verification script to run after we apply patches to systems and I want to be able to automatically detect and log all errors in dmesg without haveing to actually read it.

Thanks,
Jared

SecretCode 08-26-2012 11:36 AM

Hmm, not sure if such a thing exists. I think each module or component writes its own messages in its own formats. Most of them don't seem to have the kind of error codes that could be looked up in a list or used to drive automation.

What are you trying to do in the verification scripts? dmesg pretty much is "automatically detect and log all errors". I assume you want to get alerts to another system for error conditions?

worm5252 08-26-2012 12:12 PM

Well after we apply patched/updates we always scan dmesg to see if there are bad config options, failed hardware messages, segfaults, etc. So I am just trying to cut out the time it takes to read all of the dmesg manually and just write anything suspicious found to a log I have. Eventually I will also do the same thing for other system logs such as /var/log/messages and things. But as of now dmesg is the hardest one to find issues with. So I want to get it knocked out first.

Essentially I have a script now that remotely checks a node to gather infomation about the health of the machine and writes it to a local log. The after it gets that information it displays dmesg and /var/log/messages for manual review. I want to be able to completely automate it so I can execute the script and jsut read the local log only.

worm5252 08-26-2012 01:09 PM

Here is an example of what I am trying to do

Sample dmesg stores as /tmp/dmesg.fake
Code:

time.c: can't update CMOS clock from 9 to 55
nfs: server leviticus02 not responding, still trying
nfs: server leviticus02 OK
ipv6: Unknown parameter `off'
set_rtc_mmss: can't update from 5 to 59
VMCIUtil: Updating context id from 0xffffffff to 0x3c7e92e8 on event 0.
portmap: server localhost not responding, timed out
RPC: failed to contact portmap (errno -5).
kjournald starting.  Commit interval 5 seconds
EXT3 FS on dm-3, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
kjournald starting.  Commit interval 5 seconds
EXT3 FS on dm-5, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
Adding 1048568k swap on /dev/VG00/LV01.  Priority:-1 extents:1
Adding 1048568k swap on /dev/sde.  Priority:-2 extents:1
VMware memory control driver initialized
Clock: inserting leap second 23:59:60 UTC

Then I have a script like this
Code:

#!/bin/bash

HOST="$1"
DMESGFILE="/tmp/dmesg.$HOST"
LOG="dmesg.log"
ERRORS="'Unknown parameter' 'can\'t update CMOS clock' 'not responding' '0x' 'inserting leap second'"

while read line; do
        for i in $ERRORS; do
                echo $line | awk "/$i/"
        done
done < $DMESGFILE

Then I can run
Code:

$ ./parse_dmesg.sh fake
And it will return this
Code:

time.c: can't update CMOS clock from 9 to 55
time.c: can't update CMOS clock from 9 to 55
set_rtc_mmss: can't update from 5 to 59
Clock: inserting leap second 23:59:60 UTC


SecretCode 08-26-2012 01:13 PM

Well I would do it with regular expressions (in Perl or Python) not plain string matches ... but still I think you are going to have to cook up your own list of warning matches. I'm not aware of any general standards for errors in dmesg.

Anyone else?

chrism01 08-27-2012 06:31 AM

I'm pretty sure there's no std; get yourself a good thesaurus eg http://thesaurus.com/ and lookup words like "don't", "can't", "fail", "bad" & friends ...
Good luck, you're going to need it ...
You could try homing in on words related to whatever you just changed ...


All times are GMT -5. The time now is 05:56 PM.