Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search with exit status and quiet mode #235

Open
wookietreiber opened this issue Aug 5, 2020 · 0 comments
Open

search with exit status and quiet mode #235

wookietreiber opened this issue Aug 5, 2020 · 0 comments

Comments

@wookietreiber
Copy link

I'm looking for a little more [rip]grep in xsv, i.e. adding both an exit status of 1 if nothing is found and an associated quiet mode -q in either xsv search or maybe even a new subcommand. Do you think that these would be worthwhile contributions? I'd be willing to put in the effort and provide a PR.

Background / Use Case

We have third-party tools that can output XSV. We have Icinga checks that look for $stuff in that output. Using awk and friends works but is quite cumbersome, xsv would be the perfect fit for this:

function node_is_bar {
  blah | xsv xxx -d: node="^$node$" colY=bar
}

if node_is_bar
then
  echo "OK $node is bar"
  exit $nagios_status_ok
else
  echo "CRITICAL $node is not bar"
  exit $nagios_status_critical
fi

Currently, we're doing it the cumbersome way, for anyone interested in bash and awk madness, see here. We do this a lot, so I can definitely see a use case for this in xsv ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant