From eed6de3818d13ab316c87bec9826ca06c014fa4a Mon Sep 17 00:00:00 2001 From: Eric Loyd Date: Sat, 24 Aug 2024 09:37:58 -0400 Subject: [PATCH] Added. --- auto_nagvis.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 auto_nagvis.sh diff --git a/auto_nagvis.sh b/auto_nagvis.sh new file mode 100644 index 0000000..d3fbd5f --- /dev/null +++ b/auto_nagvis.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# +# Assuming the notes field of a host.cfg file is "notes\s " then print them out + +files="" + +while [ -n "$1" ]; do + case "$1" in + -f|--file) files="$2"; shift 2;; + *) shift 1;; + esac +done + +for file in `egrep -l notes $files`; do + awk '/host_name/ {host=$2}; /notes/ {lat=$2; lon=$3} END {print host, lat, lon}' $file +done +