Skip to content

Instantly share code, notes, and snippets.

@jflemer-ndp
Created February 5, 2017 19:20
Show Gist options
  • Save jflemer-ndp/2561766c853154aa864d715c4a30c158 to your computer and use it in GitHub Desktop.
Save jflemer-ndp/2561766c853154aa864d715c4a30c158 to your computer and use it in GitHub Desktop.
ipmitool -H $IP -U $USER -P $PASSWORD sensor 2>&1 | perl -pe '%p;$s="ok";while(<>){chomp;my @a=split/\s*\|\s*/;next if $a[3] eq "na" or $a[2] eq "discrete"; $s=$a[3] if $a[3] ne "ok";$p{$a[0]}=\@a} print "SENSOR $s"; map { ($n=lc $_->[0])=~s/[^+a-z0-9]/_/g; print "|$n=$_->[1] $_->[2]\n"} values %p'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment