Home Directory Plugins Databases MySQL check_mysql_connections

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_mysql_connections

Rating
3 votes
Favoured:
1
Hits
113743
Files:
FileDescription
check_mysql_connectionsCheck script V1.1.1
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Checks the number of connections to a mysql server.
Checks the number of connections to a mysql server.

Shell script.
- requires mysqladmin.
- requires bash.
- requires utils.sh from nagios plugins package
Reviews (2)
May I suggest a little patch to support PNP4Nagios? I am quite new at this an I do not know how to do in a different way, so as the patch is very small, I am pasting it here. Hope it can help.

roberto

=====
--- old/check_mysql_connections 2011-06-13 09:41:19.000000000 +0200
+++ new/check_mysql_connections 2011-06-13 09:46:49.000000000 +0200
@@ -14,6 +14,7 @@
# V1.1.0 gs 20060818 user mysqladmin options
# V1.1.1 gs 20070405 fix result calculation
# fix by and thanks to Stephan Helas
+# 20110613 added PNP4nagios support - Roberto Resecco

source /usr/lib/nagios/plugins/utils.sh

@@ -84,15 +85,15 @@
CONNS=$((`mysqladmin $MYSQLOPTS processlist 2>/dev/null|wc -l`-4))

if [ $CONNS -ge $CRIT ]; then
- echo "CRITICAL: $CONNS/$MAXCONNS mysql connections"
+ echo "CRITICAL: $CONNS/$MAXCONNS mysql connections|mysqlConnections=$CONNS"
exit $STATE_CRITICAL
elif [ $CONNS -ge $WARN ]; then
- echo "WARNING: $CONNS/$MAXCONNS mysql connections"
+ echo "WARNING: $CONNS/$MAXCONNS mysql connections|mysqlConnections=$CONNS"
exit $STATE_WARNING
elif [ $CONNS -ge 0 ]; then
- echo "OK: $CONNS/$MAXCONNS mysql connections"
+ echo "OK: $CONNS/$MAXCONNS mysql connections|mysqlConnections=$CONNS"
exit $STATE_OK
else
- echo "UNKNOWN: Cannot determine number of connections"
+ echo "UNKNOWN: Cannot determine number of connections|mysqlConnections=$CONNS"
exit $STATE_UNKNOWN
fi
=======
Been running this plug-in for a year or two now, but didn't notice until today that it wasn't actually sourcing the utils.sh file. I had to add the full path to line 18 "source /usr/local/nagios/libexec/utils.sh". With out this the status is already returned as "OK" but with the Warning, Critical, or OK text.

Now that I have that in place it works like a charm. Probably something I missed when I first started this plugin.