-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding HolmesGPT plugin * Updated to use a temporary file
- Loading branch information
1 parent
0a76cf7
commit e7ddea6
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
plugins: | ||
# Author: Pavan Gudiwada | ||
# Investigate incidents in your cluster to quickly find the root cause using HolmesGPT | ||
# Requires HolmesGPT to be installed and configured (https://github.com/robusta-dev/holmesgpt) on your system | ||
# Open any K9s view, then: | ||
# Shift+H to run an investigation with default ask command | ||
# Shift+O to customize the question before running an investigation. | ||
holmesgpt: | ||
shortCut: Shift-H | ||
description: Ask HolmesGPT | ||
scopes: | ||
- all | ||
command: bash | ||
background: false | ||
confirm: false | ||
args: | ||
- -c | ||
- | | ||
holmes ask "why is $NAME of $RESOURCE_NAME in -n $NAMESPACE not working as expected" | ||
echo "Press 'q' to exit" | ||
while : ; do | ||
read -n 1 k <&1 | ||
if [[ $k = q ]] ; then | ||
break | ||
fi | ||
done | ||
custom-holmesgpt: | ||
shortCut: Shift-Q | ||
description: Custom HolmesGPT Ask | ||
scopes: | ||
- all | ||
command: bash | ||
background: false | ||
confirm: false | ||
args: | ||
- -c | ||
- | | ||
INSTRUCTIONS="# Edit the line below. Lines starting with '#' will be ignored." | ||
DEFAULT_ASK_COMMAND="why is $NAME of $RESOURCE_NAME in -n $NAMESPACE not working as expected" | ||
QUESTION_FILE=$(mktemp) | ||
echo "$INSTRUCTIONS" > "$QUESTION_FILE" | ||
echo "$DEFAULT_ASK_COMMAND" >> "$QUESTION_FILE" | ||
# Open the line in the default text editor | ||
${EDITOR:-nano} "$QUESTION_FILE" | ||
# Read the modified line, ignoring lines starting with '#' | ||
user_input=$(grep -v '^#' "$QUESTION_FILE") | ||
echo running: holmes ask "\"$user_input\"" | ||
holmes ask "$user_input" | ||
echo "Press 'q' to exit" | ||
while : ; do | ||
read -n 1 k <&1 | ||
if [[ $k = q ]] ; then | ||
break | ||
fi | ||
done |