Skip to content

Instantly share code, notes, and snippets.

@adamf
Created August 8, 2011 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamf/1131155 to your computer and use it in GitHub Desktop.
Save adamf/1131155 to your computer and use it in GitHub Desktop.
Smokeping config generation with awk
traceroute www.bbc.co.uk | awk '{ trg=$3; host=$2; gsub(/\./,"_",trg); gsub(/\./,"_",host); if (NR == 1) print "\n++",trg"\n\nmenu="$3"\ntitle="$3"\nhost="$3"\n"; else if ( !/\*/ ) print "+++",host, "\n\nhost=" $2"\n"}' >> /etc/smokeping/config.d/Targets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment