MySQL default checks and policies
Summarize
Summary of MySQL Default Checks and Policies
The Agent Client Collector offers a set of default checks and policies designed to monitor MySQL databases effectively. These checks and metrics help ServiceNow customers ensure their MySQL instances are running optimally by providing real-time status and performance data.
Show less
Key Features
- MySQL Events Checks:
- Check MySQL Alive: Validates the result set length from a MySQL query against defined warning and critical thresholds. Useful for verifying database responsiveness and data integrity.
- Check MySQL Threads: Monitors the number of active MySQL threads, issuing OK, WARNING, or CRITICAL status based on configured thresholds. Helps in identifying thread saturation or resource issues.
- Check MySQL Query (util.check-mysql-query): Confirms whether the MySQL database is running by monitoring thread counts within specified upper and lower bounds.
- MySQL Metrics:
- Metrics MySQL: Collects various MySQL database metrics such as aborted clients, aborted connects, transaction bytes, and command counts. These metrics provide insight into database health and activity.
- Metrics MySQL Threads: Reports on the number of running threads with alerting capabilities for thresholds, similar to the check but focused on metric collection.
- Metrics MySQL Processes: Provides detailed metrics on MySQL processes, including the commands they are executing and the databases involved, useful for performance monitoring and troubleshooting.
Usage and Configuration
All checks and metrics require connection parameters such as host, port, database, and optionally, UNIX socket for local connections on UNIX-like systems. Authentication can be managed via MySQL configuration files (my.cnf) by specifying user and password in the client section, simplifying secure connections.
Commands support various parameters to set warning and critical thresholds, allowing tailored alerting based on customer environment needs. Verbose modes are available for troubleshooting.
Key Outcomes
- Enables proactive monitoring of MySQL database health, including connection status and query performance.
- Facilitates early detection of resource contention through thread monitoring, reducing downtime risks.
- Provides comprehensive metrics for capacity planning and operational insights.
- Supports flexible configuration for integration into existing ServiceNow monitoring workflows and alert systems.
The Agent Client Collector provides the following default checks and policies for MySQL Metrics monitoring.
| Type | Check | Description | Usage and Usage example | Output |
|---|---|---|---|---|
| Event | app.mysql.check-mysql-alive | Verifies the length of a result set from a MySQL query. | check-mysql-query-result-count.rb (options) -c, --critical COUNT COUNT critical threshold for number of items returned by the query (required) -d, --database DATABASE MySQL database (required) -h, --host HOST MySQL Host to connect to (required) -i, --ini VALUE My.cnf ini file --ini-section VALUE Section in my.cnf ini file. To enable connection to MySQL thru the .ini file, provide the values against the properties 'user' and 'password' in the client section in the .ini file. -P, --port PORT MySQL Port to connect to -q, --query QUERY Query to execute (required) -w, --warning COUNT Count warning threshold for number of items returned by the query (required) -S, --socket UNIX socket to connect to (required if host specified is 'localhost' on UNIX - like systems) Usage Example
|
MysqlQueryCountCheck OK/CRITICAL/WARNING: message regarding ratio between query length and threshold values |
| Event | app.mysql.check-mysql-threads | Verifies the MySQL DB number of running threads and assigns a status of OK/WARNING/CRITICAL depending on input values. | check-mysql-threads.rb (options) -h, --hostname HOST Hostname to login to -i, --ini VALUE My.cnf ini file --ini-section VALUE Section in my.cnf ini file (Needed if .ini path provided). To enable connection to MySQL thru the .ini file, provide the values against the properties 'user' and 'password' in the client section in the .ini file. -c, --critnum NUMBER Number of running threads upon which an alert is issued -w, --warnnum NUMBER Number of running threads upon which a warning is issued -P, --port PORT MySQL Port to connect to -S, --socket UNIX socket to connect to (required if host specified is 'localhost' on UNIX - like systems) Usage Example
|
CheckMySQLHealth OK/Critical/Warning and number of running threads |
| Event | util.check-mysql-query | Verifies whether MySQL DB is running. | check-mysql-threads.rb (options) -h, --hostname HOST Hostname to login to -i, --ini VALUE My.cnf ini file --ini-section VALUE Section in my.cnf ini file (Needed if .ini path is provided). To enable connection to MySQL thru the .ini file, provide the values against the properties 'user' and 'password' in the client section in the .ini file. -c, --critnum NUMBER Number of running threads upon which an alert is issued -w, --warnnum NUMBER Number of running threads upon which a warning is issued -l, --critlow NUMBER Number of running threads under which an alert is issued -m, --warnlow NUMBER Number of running threads under which a warning is issued -P, --port PORT MySQL Port to connect to -s, --socket UNIX socket to connect to (required if host specified is 'localhost' on UNIX - like systems) Usage Example
|
CheckMySQLHealth OK/Critical/Warning and number of running threads |
| Type | Check | Description | Usage and Usage Example | Output |
|---|---|---|---|---|
| Metric | app.mysql.metrics-mysql | Returns metrics on the MySQL DB. | /usr/local/bin/metrics-mysql-graphite.rb (options) -h, --host HOST MySQL host to connect to (required) -i, --ini VALUE My.cnf ini file --ini-section VALUE Section in my.cnf ini file (Needed if .ini path is provided). To enable connection to MySQL thru the .ini file, provide the values against the properties 'user' and 'password' in the client section in the .ini file. -P, --port PORT MySQL port to connect to. -s, --scheme SCHEME Metric naming scheme, text to append to metric -S, --socket UNIX socket to connect to (required if host specified is 'localhost' on UNIX - like systems) -v, --verbose Show errors (if generated) regarding secondary status copies. Add -v to the Command to activate. Usage Example
|
MysqlQueryCountCheck OK/CRITICAL/WARNING: message regarding ratio between query length and threshold values |
| Metric | app.mysql.check-mysql-threads | Verifies the MySQL DB number of running threads and assigns a status of OK/WARNING/CRITICAL depending on input values. | /usr/local/bin/metrics-mysql-graphite.rb (options) -h, --hostname HOST Hostname to connect to (required) -i, --ini VALUE My.cnf ini file --ini-section VALUE Section in my.cnf ini file (Needed if .ini path is provided). To enable connection to MySQL thru the .ini file, provide the values against the properties 'user' and 'password' in the client section in the .ini file. -c, --critnum NUMBER Number of running threads upon which an alert is issued -w, --warnnum NUMBER Number of running threads upon which a warning is issued -l, --critlow NUMBER Number of running threads under which an alert is issued -m, --warnlow NUMBER Number of running threads under which a warning is issued -P, --port PORT MySQL Port to connect to -s, --socket UNIX socket to connect to (required if host specified is 'localhost' on UNIX - like systems) Usage Example
|
hostname.mysql.general.abortedClients 7600 1649630975 hostname.mysql.general.abortedConnects 247 1649630975 hostname.mysql.general.txBytes 752733902 1649630975 hostname.mysql.commands.admin_commands 1631 1649630975 hostname.mysql.commands.alter_table 0 1649630975 |
| Metric | app.mysql.metrics-mysql-processes | Returns various metrics regarding MySQL DB processes | /usr/local/bin/metrics-mysql-processes.rb (options) -h, --host MySQL host to connect to -i, --ini VALUE My.cnf ini file --ini-section VALUE Section in my.cnf ini file (Needed if .ini path is provided). To enable connection to MySQL thru the .ini file, provide the values against the properties 'user' and 'password' in the client section in the .ini file. -P, --port PORT MySQL Port to connect to -s --scheme SCHEME Metric naming scheme, text to append to metric -s, --socket UNIX socket to connect to (required if host specified is 'localhost' on UNIX - like systems) Usage Example
|
processes, commands they're running and the databases they're running the commands on Example:
|