Skip to content

Instantly share code, notes, and snippets.

@tkhn
Last active December 22, 2015 23:49
Show Gist options
  • Select an option

  • Save tkhn/6549577 to your computer and use it in GitHub Desktop.

Select an option

Save tkhn/6549577 to your computer and use it in GitHub Desktop.
Munin plugin to monitor docs number in bash
#!/bin/sh
case $1 in
config)
cat <<'EOM'
graph_title Sphinx index main stats
graph_vlabel docs count
graph_category sphinx
documents_count.label Documents count in index
graph_args --base 1000 -l 0"
EOM
exit 0;;
esac
num=$( echo "SELECT * FROM main LIMIT 0; SHOW META;" | mysql -h 127.0.0.1 -P 9306 | grep "total_found" | cut -f2 )
echo "documents_count.value $num"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment