Skip to content

Instantly share code, notes, and snippets.

@anaisbetts
Last active March 11, 2024 21:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anaisbetts/380e7ffe7a20b288be4daa03866ac894 to your computer and use it in GitHub Desktop.
Save anaisbetts/380e7ffe7a20b288be4daa03866ac894 to your computer and use it in GitHub Desktop.
Check dmesg with AI
#!/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"
// 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