Last active
March 11, 2024 21:32
-
-
Save anaisbetts/380e7ffe7a20b288be4daa03866ac894 to your computer and use it in GitHub Desktop.
Check dmesg with AI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | |
export OPENAI_API_KEY='sk-your-openai-key' | |
journalctl --since "24 hours ago" --no-pager -k | npx typechat-cli@latest -s "$SCRIPT_DIR/dmesg-scan.ts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Represents the possible error information found in a captured Linux kernel dmesg output | |
export interface ResponseShape { | |
cpuFailure: boolean // If true, the log contains a CPU failure or Machine Check Exception | |
hardwareDiskFailure: boolean // If true, the log contains a SATA / SCSI error indicating a hard disk failure or warning | |
filesystemError: boolean // If true, the log contains a critical filesystem error or btrfs error that is important for an administrator to look at | |
deviceError: boolean // If true, an attached device such as a USB or PCI Express device is throwing critical errors | |
outOfMemoryError: boolean // If true, the kernel OOM killer was invoked to kill a process | |
criticalError: boolean // If true, there is an entry in the dmesg output that likely requires immediate administrator attention | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment