<commit_before># check-mysql

## Description

Checks for MySQL.

## Synopsis
```
check-mysql connection --host=127.0.0.1 --port=3306 --user=USER --password=PASSWORD --tls --tls-root-cert=ca.pem --tls-skip-verify --warning=250 --critical=280
```

## Installation

First, build this program.

```
go get github.com/mackerelio/go-check-plugins
cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-mysql
go install
```

Or you can use this program by installing the official Mackerel package. See [Using the official check plugin pack for check monitoring - Mackerel Docs](https://mackerel.io/docs/entry/howto/mackerel-check-plugins).


Next, you can execute this program :-)

```
check-mysql connection --host=127.0.0.1 --port=3306 --user=USER --password=PASSWORD --warning=250 --critical=280
check-mysql replication --host=127.0.0.1 --port=3306 --user=USER --password=PASSWORD --warning=5 --critical=10
```


## Setting for mackerel-agent

If there are no problems in the execution result, add a setting in mackerel-agent.conf .

```
[plugin.checks.check-mysql-sample]
command = ["check-mysql", "connection", "--host", "127.0.0.1", "--port", "3306", "--user", "USER", "--password", "PASSWORD", "--warning", "250", "--critical", "280"]
```

## Usage
### Subcommands

```
  uptime
  readonly
  replication
  connection
```

### Options
#### `uptime` subcommand

Checks the MySQL server uptime.

```
  -H, --host=           Hostname (default: localhost)
  -p, --port=           Port (default: 3306)
  -S, --socket=         Path to unix socket
  -u, --user=           Username (default: root)
  -P, --password=       Password [$<PASSWORD>]
      --tls             Enable TLS connection
      --tls-root-cert=  The root certificate used for TLS certificate verification
      --tls-skip-verify Disable TLS certificate verification
  -c, --critical=       critical if the uptime less than (default: 0)
  -w, --warning=        warning if the uptime less than (default: 0)
```

#### `readonly` subcommand
<commit_msg>Update check-mysql/README.md<commit_after># check-mysql

## Description

Checks for MySQL.

## Synopsis
```
check-mysql connection --host=127.0.0.1 --port=3306 --user=USER --password=PASSWORD --tls --tls-root-cert=ca.pem --tls-skip-verify --warning=250 --critical=280
```

## Installation

First, build this program.

```
go get github.com/mackerelio/go-check-plugins
cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-mysql
go install
```

Or you can use this program by installing the official Mackerel package. See [Using the official check plugin pack for check monitoring - Mackerel Docs](https://mackerel.io/docs/entry/howto/mackerel-check-plugins).


Next, you can execute this program :-)

```
check-mysql connection --host=127.0.0.1 --port=3306 --user=USER --password=PASSWORD --warning=250 --critical=280
check-mysql replication --host=127.0.0.1 --port=3306 --user=USER --password=PASSWORD --warning=5 --critical=10
```


## Setting for mackerel-agent

If there are no problems in the execution result, add a setting in mackerel-agent.conf .

```
[plugin.checks.check-mysql-sample]
command = ["check-mysql", "connection", "--host", "127.0.0.1", "--port", "3306", "--user", "USER", "--password", "PASSWORD", "--warning", "250", "--critical", "280"]
```

## Usage
### Subcommands

```
  uptime
  readonly
  replication
  connection
```

### Options
#### `uptime` subcommand

Checks the MySQL server uptime.

```
  -H, --host=           Hostname (default: localhost)
  -p, --port=           Port (default: 3306)
  -S, --socket=         Path to unix socket
  -u, --user=           Username (default: root)
  -P, --password=       Password [$MYSQL_PASSWORD]
      --tls             Enables TLS connection
      --tls-root-cert=  The root certificate used for TLS certificate verification
      --tls-skip-verify Disable TLS certificate verification
  -c, --critical=       critical if the uptime less than (default: 0)
  -w, --warning=        warning if the uptime less than (default: 0)
```

#### `readonly` subcommand

{'fraction_non_alphanumeric': 0.16060009837678307, 'fraction_numerical': 0.03295622233152976, 'mean_word_length': 3.1289340101522845, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3909292', 'n_tokens_mistral': 1415, 'n_tokens_neox': 1266, 'n_words': 381}