### Install check-log Plugin using Go Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-log/README.md Instructions to build and install the check-log plugin from source using Go. This involves getting the plugin, navigating to its directory, and running 'go install'. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-log go install ``` -------------------------------- ### Install check-aws-sqs-queue-size Plugin using Go Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-aws-sqs-queue-size/README.md Instructions to build and install the check-aws-sqs-queue-size plugin using Go. This involves fetching the plugin and running 'go install'. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-aws-sqs-queue-size go install ``` -------------------------------- ### Build and Install check-file-age Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-file-age/README.md Instructions to build and install the plugin from the source repository using Go tools. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-file-age go install ``` -------------------------------- ### Build and Install check-aws-cloudwatch-logs Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-aws-cloudwatch-logs/README.md Instructions for building and installing the plugin from source using the Go toolchain. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-aws-cloudwatch-logs go install ``` -------------------------------- ### Install check-ping Plugin using Go Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ping/README.md This snippet shows how to build and install the check-ping plugin using Go. It requires Go to be installed and configured. The output is the executable binary for the plugin. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-ping go install ``` -------------------------------- ### Build and Install check-memcached Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-memcached/README.md Instructions to build the check-memcached plugin from source using Go and install it. This involves navigating to the plugin's directory and running 'go install'. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-memcached go install ``` -------------------------------- ### Build and Install check-http Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-http/README.md Instructions on how to build the check-http plugin from source using Go. This involves fetching the package, navigating to its directory, and running the go install command. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-http go install ``` -------------------------------- ### Install check-ntservice Plugin using Go Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ntservice/README.md This snippet shows how to build and install the check-ntservice plugin using Go. It requires Go to be installed and configured. The output is the executable plugin. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-ntservice go install ``` -------------------------------- ### Build and Install check-ssh Plugin (Go) Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ssh/README.md Instructions to build and install the check-ssh plugin using Go. This involves fetching the plugin, navigating to its directory, and running the go install command. It's a prerequisite for using the plugin locally. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-ssh go install ``` -------------------------------- ### Install check-redis plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-redis/README.md Instructions for building and installing the check-redis plugin from the go-check-plugins repository using Go. ```shell go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-redis go install ``` -------------------------------- ### Build and Install check-windows-eventlog Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-windows-eventlog/README.md This snippet shows how to build and install the check-windows-eventlog plugin using Go. It assumes you have Go installed and the project source code is available. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-windows-eventlog go install ``` -------------------------------- ### Install Go Check Plugins (Bash) Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Demonstrates how to install the Go Check Plugins using package managers for Red Hat/CentOS and Debian/Ubuntu systems, as well as building from source using Go. ```bash # For Red Hat/CentOS systems yum install mackerel-check-plugins # For Debian/Ubuntu systems apt-get install mackerel-check-plugins # Build from source go install github.com/mackerelio/go-check-plugins/check-http@latest ``` -------------------------------- ### Build and Install check-mysql Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-mysql/README.md Instructions for building the check-mysql plugin from source using Go and installing it. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-mysql go install ``` -------------------------------- ### Install check-uptime via Go Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-uptime/README.md Instructions for building and installing the check-uptime plugin from the source repository using the Go toolchain. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-uptime go install ``` -------------------------------- ### Build and Install check-mailq Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-mailq/README.md Instructions for building and installing the check-mailq plugin from the source repository using Go tools. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-mailq go install ``` -------------------------------- ### Install check-dns Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-dns/README.md Builds and installs the check-dns plugin from the go-check-plugins repository using the Go toolchain. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-dns go install ``` -------------------------------- ### Build and Install check-solr Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-solr/README.md Instructions for building the check-solr plugin from source using Go. This involves fetching the plugin and running 'go install'. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-solr go install ``` -------------------------------- ### Build and Install check-cert-file Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-cert-file/README.md Instructions for building the plugin from source using Go. This requires a properly configured GOPATH environment. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-cert-file go install ``` -------------------------------- ### Build and Install check-ldap Plugin (Go) Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ldap/README.md Instructions to build the check-ldap plugin from source using Go. This involves fetching the plugin and installing it locally. It's a prerequisite for using the plugin directly or as part of the Mackerel package. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-ldap go install ``` -------------------------------- ### Install check-disk Plugin using Go Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-disk/README.md Installs the check-disk plugin using the Go build command. This method is suitable for developers or environments where Go is readily available. ```bash go install github.com/mackerelio/go-check-plugins/check-disk@latest ``` -------------------------------- ### Build and Install check-smtp Plugin (Go) Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-smtp/README.md Instructions to build the check-smtp plugin from source using Go. This involves fetching the plugin and installing it locally. It's a prerequisite for using the plugin directly or for deployment. ```bash go get github.com/mackerelio/go-check-plugins cd $(go env GOPATH)/src/github.com/mackerelio/go-check-plugins/check-smtp go install ``` -------------------------------- ### Execute check-redis commands Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-redis/README.md Command-line examples for checking Redis reachability and replication status. ```shell check-redis reachable --host=127.0.0.1 --port=6379 --timeout=5 --socket= check-redis slave --host=127.0.0.1 --port=6379 --timeout=5 --socket= ``` -------------------------------- ### Execute check-aws-sqs-queue-size Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-aws-sqs-queue-size/README.md Example command to execute the check-aws-sqs-queue-size plugin with AWS credentials and queue details. It checks the size of a specified SQS queue. ```bash check-aws-sqs-queue-size --access-key-id= --secret-access-key= --region= --queue= ``` -------------------------------- ### Execute check-uptime command Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-uptime/README.md Example command to run the check-uptime plugin with defined warning and critical thresholds for uptime in seconds. ```bash check-uptime --warning-under=600 --critical-under=120 ``` -------------------------------- ### Execute check-mailq Command Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-mailq/README.md Example command to execute the check-mailq plugin with warning and critical thresholds for a Postfix MTA. ```bash check-mailq -w 100 -c 200 -M postfix ``` -------------------------------- ### Execute check-mysql Plugin Commands Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-mysql/README.md Examples of how to execute the check-mysql plugin for different monitoring checks, including connection and replication status. ```bash 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 ``` -------------------------------- ### Execute check-ssh Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ssh/README.md Example of how to execute the check-ssh plugin from the command line. This demonstrates setting warning and critical thresholds for SSHD response time in seconds. ```bash check-ssh -w 1 -c 3 ``` -------------------------------- ### Execute check-memcached Command Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-memcached/README.md Example of how to run the check-memcached command-line tool to test a Memcached instance. It specifies the host, port, timeout, and a test key. ```bash check-memcached -H localhost -p 11211 -t 3 -k KeyForTest ``` -------------------------------- ### Execute check-log Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-log/README.md Example of how to execute the check-log plugin from the command line. It takes arguments for the log file path, the regular expression pattern, and warning/critical thresholds. ```bash check-log --file=/path/to/file --pattern=REGEXP --warning-over=N --critical-over=N ``` -------------------------------- ### Execute check-file-age Command Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-file-age/README.md Example command to monitor a specific file with defined warning and critical thresholds for age and size. ```bash check-file-age -w 240 -W 10 -c 600 -C 0 -f /path/to/filename ``` -------------------------------- ### Configure mackerel-agent for Redis Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-redis/README.md Example configuration snippet for the mackerel-agent.conf file to enable Redis monitoring. ```toml [plugin.checks.check-redis-sample] command = ["check-redis", "reachable", "--host", "127.0.0.1", "--port", "6379", "--timeout", "5", "--socket", ""] ``` -------------------------------- ### Execute check-cert-file Command Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-cert-file/README.md Example command to run the check-cert-file plugin directly from the terminal. It accepts a file path and threshold values for warning and critical states. ```bash check-cert-file --file=/path/to/cert.pem --warning=30 --critical=14 ``` -------------------------------- ### Execute check-smtp Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-smtp/README.md Example of how to execute the check-smtp plugin from the command line. This demonstrates basic usage with host, port, warning, critical, and timeout parameters. ```bash check-smtp -H smtp.example.com -p 25 -w 3 -c 5 -t 10 ``` -------------------------------- ### Configure check-mysql Plugin in mackerel-agent Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-mysql/README.md Example configuration for the check-mysql plugin within the mackerel-agent.conf file to enable monitoring. ```ini [plugin.checks.check-mysql-sample] command = ["check-mysql", "connection", "--host", "127.0.0.1", "--port", "3306", "--user", "USER", "--password", "PASSWORD", "--warning", "250", "--critical", "280"] ``` -------------------------------- ### Configure check-http in mackerel-agent Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-http/README.md Example configuration for the mackerel-agent to use the check-http plugin. This demonstrates how to specify the command and its arguments within the mackerel-agent.conf file. ```ini [plugin.checks.check-http-sample] command = ["check-http", "-u", "http://example.com"] ``` -------------------------------- ### Execute check-solr Ping Command Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-solr/README.md Example of how to execute the check-solr plugin to ping a Solr instance. It specifies the host, port, and core to check. ```bash check-solr ping --host=127.0.0.1 --port=8983 --core=CORE ``` -------------------------------- ### Test TCP Connections with check-tcp (Bash) Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Illustrates how to use the check-tcp plugin for monitoring TCP connections. Examples include basic port checks, SSL connections, sending data and matching responses, checking Unix domain sockets, and verifying closed ports. ```bash # Basic TCP port check with response time thresholds check-tcp -H localhost -p 4224 -w 3 -c 5 # SSL connection to service check-tcp -H localhost -p 443 -S --no-check-certificate # Send data and expect pattern in response check-tcp -H localhost -p 6379 -s "PING\r\n" -e "PONG" # Check Unix domain socket check-tcp -U /var/run/docker.sock # Verify port is closed (useful for security checks) check-tcp -H localhost -p 3306 -C -W # Gearman protocol check check-tcp --service=gearman -H localhost -p 4730 # mackerel-agent.conf configuration # [plugin.checks.redis-tcp] # command = ["check-tcp", "-H", "127.0.0.1", "-p", "6379", "-w", "1", "-c", "3"] ``` -------------------------------- ### Execute check-ldap Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ldap/README.md Example of how to execute the check-ldap plugin from the command line. It takes arguments for warning and critical thresholds, and the LDAP base distinguished name. ```bash check-ldap -b 'dc=jp' -w 5 -c 10 ``` -------------------------------- ### Execute check-aws-cloudwatch-logs Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-aws-cloudwatch-logs/README.md Example command to execute the plugin directly to check for error patterns in a specific log group. ```bash check-aws-cloudwatch-logs --log-group-name /aws/lambda/sample_log_group --pattern "Error" --critical-over 10 --warning-over 5 ``` -------------------------------- ### Monitor Log Files with check-log (Bash) Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Demonstrates the usage of the check-log plugin for monitoring log files. Examples include checking for specific patterns, handling multiple patterns, excluding patterns, searching in multiple files, case-insensitive searches, and specifying file encodings. ```bash # Basic error pattern check check-log --file=/var/log/app.log --pattern="ERROR" --warning-over=5 --critical-over=10 # Multiple patterns with AND logic check-log -f /var/log/syslog -p "error" -p "critical" -w 1 -c 5 # Exclude certain patterns from matching check-log -f /var/log/app.log -p "ERROR" -E "expected error" -E "ignore this" -w 3 -c 10 # Check multiple files using glob pattern check-log --file="/var/log/app/*.log" --pattern="FATAL" -c 1 -r # Case-insensitive search with return matched lines check-log -f /var/log/app.log -p "exception" -i -r -w 5 -c 10 # Check log files in directory with specific encoding check-log --search-in-directory=/var/log/myapp --file-pattern="*.log" --pattern="Error" --encoding=UTF-8 -w 10 -c 50 # Skip missing files and check from first run check-log -f /var/log/app.log -p "CRITICAL" --missing=OK --check-first -c 1 # mackerel-agent.conf configuration # [plugin.checks.app-errors] # command = ["check-log", "-f", "/var/log/app/error.log", "-p", "ERROR|FATAL", "-w", "5", "-c", "20", "-r"] ``` -------------------------------- ### Execute check-ping Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ping/README.md This bash snippet shows the command-line execution of the check-ping plugin. It requires the plugin to be installed and accessible in the system's PATH. The command takes host, count, and wait-time as arguments. ```bash check-ping -H 127.0.0.1 -n 5 -w 100 ``` -------------------------------- ### Monitor Disk Usage with check-disk (Bash) Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Shows how to use the check-disk plugin to monitor disk space and inode usage. Examples cover checking specific paths, using different units, excluding filesystem types, monitoring inode usage, and excluding specific device paths. ```bash # Check specific path with percentage thresholds check-disk --warning=10 --critical=5 --path=/ # Check with specific units (KB, MB, GB, TB) check-disk -w 500 -c 100 -u GB -p /data # Check all filesystems except specific types check-disk -A -X tmpfs -X devtmpfs -w 15% -c 10% # Check inode usage along with disk space check-disk -w 20% -c 10% -W 15% -K 5% -p /var # Exclude specific device paths check-disk -A -x /dev/loop0 -x /dev/sr0 -w 10% -c 5% # mackerel-agent.conf configuration # [plugin.checks.disk-root] # command = ["check-disk", "--warning", "15%", "--critical", "10%", "--path", "/"] ``` -------------------------------- ### Monitor Memcached Availability Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Verifies Memcached availability by performing set and get operations on a specified key. ```bash check-memcached -H localhost -p 11211 -t 3 -k healthcheck ``` -------------------------------- ### Monitor HTTP Endpoints with check-http (Bash) Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Provides examples for using the check-http plugin to monitor web services. It covers basic checks, HTTPS, authentication, proxy usage, custom headers, response validation, and POST requests. ```bash # Basic HTTP check check-http -u http://example.com # HTTPS check with custom status mapping (treat 404 as OK) check-http -s 404=ok -u https://example.com # Check with authentication and custom header check-http -u https://api.example.com --user=admin:password -H "Authorization: Bearer token123" # Check via proxy with pattern matching in response check-http --proxy=http://localhost:8080 -u http://example.com -p "Welcome" # Redirect requests to different host (useful for testing) check-http --connect-to=example.com:443:127.0.0.1:8080 https://example.com # POST request with body and timeout check-http -m POST -d '{"key":"value"}' -t 30 -u https://api.example.com/endpoint # mackerel-agent.conf configuration # [plugin.checks.http-api] # command = ["check-http", "-u", "https://api.example.com/health", "-p", "healthy", "-t", "15"] ``` -------------------------------- ### Configure check-ssh Plugin in mackerel-agent Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ssh/README.md Example configuration for the mackerel-agent to run the check-ssh plugin. This snippet shows how to define a check named 'check-ssh-sample' and specify the command with its arguments, including warning and critical thresholds. ```conf [plugin.checks.check-ssh-sample] command = ["check-ssh", "-w", "1", "-c", "3"] ``` -------------------------------- ### Filter Windows Event Log Messages Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-windows-eventlog/README.md These examples show how to use the --message-pattern and --message-exclude options to filter Windows event log entries based on their messages. This is useful for targeting specific events or excluding noisy ones. ```bash # Find messages matching 'foo' but not 'bar' --message-pattern foo --message-exclude bar ``` -------------------------------- ### Monitor MySQL MasterHA (MHA) Cluster Status Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Monitors the status and replication of MySQL MasterHA (MHA) clusters. Supports checking all configurations, specific configurations, replication lag, and SSH connectivity between nodes. Crucial for high-availability MySQL setups. ```bash # Check all MHA configurations check-masterha status --all ``` ```bash # Check specific configuration check-masterha status --conf=/etc/masterha/app1.cnf ``` ```bash # Check replication status check-masterha repl --conf=/etc/masterha/app1.cnf --seconds_behind_master=30 ``` ```bash # Check SSH connectivity between nodes check-masterha ssh --all --confdir=/etc/masterha/conf.d ``` ```bash # mackerel-agent.conf configuration # [plugin.checks.masterha] # command = ["check-masterha", "status", "--all", "--confdir", "/etc/masterha/conf"] ``` -------------------------------- ### Execute check-disk Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-disk/README.md Demonstrates the basic execution of the check-disk plugin with warning and critical thresholds for disk space. It checks the free space on the root path ('/'). ```bash check-disk --warning=10 --critical=5 --path=/ ``` -------------------------------- ### check-ntservice Plugin Options Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ntservice/README.md This snippet lists the available command-line options for the check-ntservice plugin. These options allow for flexible service name matching, exclusion, listing services, and exact matching. ```bash -s, --service-name= matches if contained in service name -x, --exclude-service= exclude if contained in service name. This option takes precedence over --service-name -l, --list-service list service --exact more exact checking of the service. This option applies only to --service-name. ``` -------------------------------- ### Monitor System Load with check-load Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Monitors system load averages for 1, 5, and 15-minute intervals, with options for per-CPU normalization. ```bash check-load -w 4,3,2 -c 6,5,4 check-load -r -w 2,1.5,1 -c 4,3,2 ``` -------------------------------- ### Check Multiple Files with Glob Pattern Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-log/README.md Demonstrates how to use glob patterns with the --file option to check multiple log files. It highlights the importance of using '--file=' instead of '--file ' for correct expansion. ```bash # Correct usage for glob expansion check-log --file=/tmp/some.log_* # Incorrect usage that may lead to unexpected results # check-log --file /tmp/some.log_* ``` -------------------------------- ### Execute check-http with Custom Request Destination Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-http/README.md Shows how to use the --connect-to option to route requests to a different host and port than the target URL suggests. This is useful for testing internal services or load balancers. ```bash check-http --connect-to=example.com:443:127.0.0.1:8080 https://example.com # will request to 127.0.0.1:8000 but AS example.com:443 check-http --connect-to=:443:127.0.0.1:8080 https://example.com # empty host1 matches ANY host check-http --connect-to=example.com::127.0.0.1:8080 https://example.com # empty port1 matches ANY port check-http --connect-to=localhost:443::8080 https://localhost # empty host2 means unchanged, therefore will request to localhost:8080 AS localhost:443 check-http --connect-to=example.com:443:127.0.0.1: https://example.com # empty port2 means unchanged, therefore will request to 127.0.0.1:443 ``` -------------------------------- ### Configure check-ntservice Plugin in mackerel-agent Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ntservice/README.md This configuration snippet demonstrates how to set up the check-ntservice plugin within the mackerel-agent.conf file. It specifies the command to run and its arguments, allowing Mackerel to monitor the specified Windows NT Service. ```shell [plugin.checks.check-ntservice-sample] command = ["check-ntservice", "--service-name", "SERVICE_NAME"] ``` -------------------------------- ### Run check-mysql Plugin Tests Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-mysql/README.md Commands to execute the test scripts for the check-mysql plugin against different MySQL versions using Docker. ```bash (cd ..; make build) ./test_8/test.sh # MySQL 8.0.23 ./test_57/test.sh # MySQL 5.7.8 ``` -------------------------------- ### Execute check-http via Proxy Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-http/README.md Illustrates how to configure the check-http plugin to use a proxy server for making requests. Supports HTTP, HTTPS, and SOCKS5 proxies, including basic authentication. ```bash check-http --proxy=http://localhost:8080 -u http://example.com # request via http://localhost:8080 HTTP_PROXY=http://localhost:8080 check-http -u http://example.com # Same. you can set proxy via environment variable check-http --proxy=http://user:pass@localhost:8080 -u http://example.com # basic authentication is also supported ``` -------------------------------- ### Configure check-disk Plugin in mackerel-agent Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-disk/README.md Shows how to configure the check-disk plugin within the mackerel-agent configuration file. This enables automatic disk space monitoring by Mackerel. ```ini [plugin.checks.disk-sample] command = ["check-disk", "--warning", "10", "--critical", "5", "--path", "/"] ``` -------------------------------- ### Configure check-windows-eventlog in mackerel-agent.conf Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-windows-eventlog/README.md This configuration snippet demonstrates how to integrate the check-windows-eventlog plugin with the Mackerel agent. It specifies the command to run and its arguments for monitoring event logs. ```ini [plugin.checks.check-windows-eventlog-sample] command = ["check-windows-eventlog", "--log", "LOGTYPE", "--type", "EVENTTYPE", "--source-pattern", "REGEXP", "--source-exclude", "REGEXP", "--message-pattern", "REGEXP", "--message-exclude", "REGEXP", "--event-id-pattern", "RANGE", "--event-id-exclude", "RANGE", "--warning-over", "N", "--critical-over", "N", "--fail-first"] ``` -------------------------------- ### Configure mackerel-agent for File Monitoring Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-file-age/README.md Configuration snippet for the mackerel-agent.conf file to integrate the check-file-age plugin into the Mackerel monitoring system. ```toml [plugin.checks.fileage-sample] command = ["check-file-age", "-w", "240", "-W", "10", "-c", "600", "-C", "0", "-f", "/path/to/filename"] ``` -------------------------------- ### Configure mackerel-agent for CloudWatch Logs Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-aws-cloudwatch-logs/README.md Configuration snippet for the mackerel-agent.conf file to integrate the plugin into Mackerel monitoring. ```toml [plugin.checks.aws-cloudwatch-logs-sample] command = ["check-aws-cloudwatch-logs", "--log-group-name", "/aws/lambda/sample_log_group", "--pattern", "Error", "--critical-over", "10", "--warning-over", "5"] ``` -------------------------------- ### Configure mackerel-agent for check-mailq Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-mailq/README.md Configuration snippet for the mackerel-agent.conf file to enable the check-mailq plugin. ```toml [plugin.checks.check-mailq-sample] command = ["check-mailq", "-w", "100", "-c", "200", "-M", "postfix"] ``` -------------------------------- ### Configure check-log Plugin in mackerel-agent.conf Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-log/README.md Configuration snippet for the mackerel-agent to use the check-log plugin. This defines a check named 'check-log-sample' and specifies the command with its arguments. ```ini [plugin.checks.check-log-sample] command = ["check-log", "--file", "/path/to/file", "--pattern", "REGEXP", "--warning-over", "N", "--critical-over", "N"] ``` -------------------------------- ### Configure mackerel-agent for Certificate Monitoring Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-cert-file/README.md Configuration snippet for the mackerel-agent.conf file to enable automated certificate expiration monitoring. ```toml [plugin.checks.cert-file] command = ["check-cert-file", "--file", "/path/to/cert.pem", "--warning", "30", "--critical", "14"] ``` -------------------------------- ### Configure check-memcached for mackerel-agent Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-memcached/README.md Configuration snippet for mackerel-agent to integrate the check-memcached plugin. This defines the command to execute and its parameters. ```ini [plugin.checks.cert-memcached-sample] command = ["check-memcached", "-H", "", "-p", "", "-t", "", "-k", ""] ``` -------------------------------- ### Configure mackerel-agent for DNS Monitoring Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-dns/README.md Adds the check-dns plugin configuration to the mackerel-agent.conf file to enable automated DNS monitoring. ```toml [plugin.checks.dns-sample] command = ["check-dns", "-H", "a.root-servers.net", "-s", "8.8.8.8"] ``` -------------------------------- ### Configure mackerel-agent for check-uptime Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-uptime/README.md Configuration snippet for the mackerel-agent.conf file to integrate the check-uptime plugin into the monitoring service. ```toml [plugin.checks.check-uptime-sample] command = ["check-uptime", "--warning-under", "600", "--critical-under", "120"] ``` -------------------------------- ### Configure check-ldap Plugin in mackerel-agent Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ldap/README.md Configuration snippet for the mackerel-agent to run the check-ldap plugin as a check item. This defines the command to execute and its arguments, allowing Mackerel to monitor LDAP response times. ```conf [plugin.checks.check-ldap-sample] command = ["check-ldap", "-b", "dc=jp", "-w", "5", "-c", "10"] ``` -------------------------------- ### Execute check-ntservice Plugin Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ntservice/README.md This snippet shows the command-line execution of the check-ntservice plugin. It takes the service name as an argument to check the status of a specific Windows NT Service. ```bash check-ntservice --service-name=SERVICE_NAME ``` -------------------------------- ### Configure check-solr with mackerel-agent Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-solr/README.md Configuration snippet for mackerel-agent to use the check-solr plugin. This defines the command and its arguments for monitoring. ```conf [plugin.checks.check-solr-sample] command = ["check-solr", "ping", "--host", "127.0.0.1", "--port", "8983", "--core", "CORE"] ``` -------------------------------- ### Configure check-ping Plugin in mackerel-agent Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-ping/README.md This TOML snippet demonstrates how to configure the check-ping plugin within the mackerel-agent.conf file. It specifies the command to run and its arguments, enabling Mackerel to execute the check. ```toml [plugin.checks.check-ping-sample] command = ["check-ping", "-H", "127.0.0.1", "-n", "5", "-w", "100"] ``` -------------------------------- ### Monitor Processes with check-procs Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Monitors system processes based on patterns, user, state, resource usage, or parent PID with flexible threshold alerting. ```bash check-procs --pattern="nginx" --warning-under=1 --critical-under=1 check-procs -p "worker" -W 1 -C 1 -w 10 -c 20 check-procs --state=Z --warning-over=0 --critical-over=5 check-procs -u mysql -p "mysqld" -W 1 -C 1 check-procs -p "java" --virtual-memory-size=4000000 --resident-set-size=2000000 check-procs --ppid=1 -p "orphaned" -w 5 -c 10 check-procs -p "check-procs" -x "monitor" -M ``` -------------------------------- ### Monitor System Uptime with check-uptime Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Tracks system uptime to alert on unexpected reboots or to ensure maintenance windows are respected. ```bash check-uptime --warning-under=600 --critical-under=120 check-uptime -W 7776000 -C 15552000 ``` -------------------------------- ### Monitor PostgreSQL with check-postgresql Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Checks PostgreSQL connection counts with support for SSL/TLS certificate verification and database-specific monitoring. ```bash check-postgresql connection --host=127.0.0.1 --port=5432 --user=monitor --password=secret --database=mydb --warning=70 --critical=90 check-postgresql connection -H db.example.com -u monitor -P secret -d postgres -s require --sslrootcert=/etc/ssl/ca.pem ``` -------------------------------- ### Configure mackerel-agent for AWS SQS Queue Size Check Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-aws-sqs-queue-size/README.md Configuration snippet for mackerel-agent to integrate the check-aws-sqs-queue-size plugin. This defines the command to run and its arguments for monitoring. ```conf [plugin.checks.aws-sqs-queue-size-sample] command = ["check-aws-sqs-queue-size", "--access-key-id", "", "--secret-access-key", "", "--region", "", "--queue", ""] ``` -------------------------------- ### Execute check-http with Custom Status Mapping Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-http/README.md Demonstrates how to override the default HTTP status code checking. You can specify expected status codes or ranges, mapping them to 'ok' or other desired states. ```bash check-http -s 404=ok -u http://example.com check-http -s 200-404=ok -u http://example.com ``` -------------------------------- ### Configure check-smtp Plugin in mackerel-agent Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-smtp/README.md Configuration snippet for integrating the check-smtp plugin with the mackerel-agent. This defines a check, specifying the command and its arguments to be executed by the agent. ```conf [plugin.checks.check-smtp-sample] command = ["check-smtp", "-H", "smtp.example.com", "-p", "25", "-w", "3", "-c", "5", "-t", "10"] ``` -------------------------------- ### Monitor Redis with check-redis Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Verifies Redis availability and replication status, supporting authentication and Unix socket connections. ```bash check-redis reachable --host=127.0.0.1 --port=6379 --timeout=5 check-redis replication -H 127.0.0.1 -p 6379 check-redis replication -H 127.0.0.1 --skip-master check-redis reachable -s /var/run/redis/redis.sock check-redis reachable -H 127.0.0.1 -p 6379 --username=default --password=secret ``` -------------------------------- ### Monitor Directory File Size Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Calculates the total size of files within a directory and alerts if thresholds are exceeded. Supports depth limits. ```bash check-file-size -b /var/log/fluentd/buffer/ -w 5M -c 10M check-file-size -b /tmp -w 100M -c 500M -d 2 ``` -------------------------------- ### Monitor Mail Queue Size Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Checks the size of the mail queue for Mail Transfer Agents (MTAs) like Postfix and Qmail. Helps identify potential mail delivery issues by monitoring queue lengths against warning and critical thresholds. ```bash # Check Postfix mail queue check-mailq -M postfix -w 100 -c 200 ``` ```bash # Check Qmail queue check-mailq -M qmail -w 50 -c 100 ``` ```bash # mackerel-agent.conf configuration # [plugin.checks.mailq] # command = ["check-mailq", "-M", "postfix", "-w", "50", "-c", "200"] ``` -------------------------------- ### Monitor SMTP Connectivity Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Checks SMTP server availability, response time, and supports STARTTLS, SMTPS, and authentication. ```bash check-smtp -H smtp.example.com -p 25 -w 3 -c 5 -t 10 check-smtp -H smtp.example.com -p 587 -S -A PLAIN -U user@example.com -P password ``` -------------------------------- ### Monitor JMX MBean Attributes via Jolokia Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Checks JMX MBean attributes on Java applications using the Jolokia HTTP agent. Can monitor metrics like CPU load and memory usage. Requires specifying host, port, MBean name, and attribute. Useful for JVM performance monitoring. ```bash # Check JVM CPU load check-jmx-jolokia -H 127.0.0.1 -p 8778 -m "java.lang:type=OperatingSystem" -a ProcessCpuLoad -w 0.7 -c 0.9 ``` ```bash # Check heap memory usage check-jmx-jolokia -H 127.0.0.1 -p 8778 -m "java.lang:type=Memory" -a HeapMemoryUsage -i used -w 800000000 -c 900000000 ``` ```bash # mackerel-agent.conf configuration # [plugin.checks.jvm-cpu] # command = ["check-jmx-jolokia", "-H", "127.0.0.1", "-p", "8778", "-m", "java.lang:type=OperatingSystem", "-a", "ProcessCpuLoad", "-w", "0.8", "-c", "0.95"] ``` -------------------------------- ### Monitor SSH Connectivity Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Checks if an SSH server is reachable and responsive. Supports authentication via user and private key. ```bash check-ssh -H server.example.com -w 1 -c 3 check-ssh -H server.example.com -u admin -i /home/monitor/.ssh/id_rsa ``` -------------------------------- ### Check SSH Connection and Response Time Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Monitors SSH connectivity to a specified host. Allows customization of port and timeout settings. Useful for ensuring SSH services are available and responsive within defined thresholds. ```bash check-ssh -H server.example.com -P 2222 -t 10 -w 2 -c 5 ``` ```bash # mackerel-agent.conf configuration # [plugin.checks.ssh] # command = ["check-ssh", "-H", "bastion.example.com", "-w", "2", "-c", "5"] ``` -------------------------------- ### Monitor MySQL with check-mysql Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Monitors MySQL connection counts, replication lag, uptime, and read-only status. Supports TLS/SSL and Unix socket connections. ```bash check-mysql connection --host=127.0.0.1 --port=3306 --user=monitor --password=secret --warning=250 --critical=280 check-mysql replication -H 127.0.0.1 -u repl_monitor -P secret -w 5 -c 10 check-mysql uptime -H 127.0.0.1 -u monitor -P secret -w 300 -c 60 check-mysql readonly -H 127.0.0.1 -u monitor -P secret check-mysql connection -S /var/run/mysqld/mysqld.sock -u monitor -P secret --tls --tls-skip-verify check-mysql connection -H db.example.com -u monitor -P secret --tls --tls-root-cert=/etc/ssl/ca.pem ``` -------------------------------- ### Monitor LDAP Server Response Time Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Checks the response time of an LDAP server. Supports basic checks, authentication with bind credentials, and custom attribute searches. Essential for monitoring directory service availability and performance. ```bash # Basic LDAP check check-ldap -H ldap.example.com -b 'dc=example,dc=com' -w 5 -c 10 ``` ```bash # With bind credentials check-ldap -H ldap.example.com -b 'dc=example,dc=com' -D 'cn=monitor,dc=example,dc=com' -P secret -w 2 -c 5 ``` ```bash # Custom attribute search check-ldap -H ldap.example.com -b 'ou=users,dc=example,dc=com' -a '(uid=*)' -w 3 -c 10 ``` ```bash # mackerel-agent.conf configuration # [plugin.checks.ldap] # command = ["check-ldap", "-H", "ldap.example.com", "-b", "dc=example,dc=com", "-w", "3", "-c", "10"] ``` -------------------------------- ### Monitor File Age and Size Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Checks if a file has been modified within a specific timeframe and optionally verifies its size. ```bash check-file-age -f /var/log/app/heartbeat.log -w 240 -c 600 check-file-age -f /data/backup.tar.gz -w 86400 -c 172800 -W 1000000 -C 500000 ``` -------------------------------- ### Validate DNS Record Content Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-dns/README.md Checks if the DNS server returns specific expected IP addresses for a given host. This command validates the response against the provided expected string. ```bash check-dns -H a.root-servers.net -s 8.8.8.8 -e 198.41.0.4 ``` -------------------------------- ### Monitor NTP Time Synchronization Offset Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Monitors the time offset from NTP servers to ensure system clock synchronization. Can use local daemons or specify remote servers, and check synchronization status via stratum. Crucial for distributed systems requiring accurate time. ```bash # Basic NTP offset check using local daemon check-ntpoffset -w 50 -c 100 ``` ```bash # Using specific NTP servers check-ntpoffset -s ntp.example.com,pool.ntp.org -w 50 -c 100 -t 10 ``` ```bash # Check stratum for synchronization status check-ntpoffset -w 50 -c 100 -S ``` ```bash # mackerel-agent.conf configuration # [plugin.checks.ntp] # command = ["check-ntpoffset", "-w", "100", "-c", "500", "-S"] ``` -------------------------------- ### Monitor SSL Certificate Expiry Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Checks the expiration date of an SSL certificate file. It triggers warnings or critical alerts based on the remaining time in seconds. ```bash check-cert-file --file=/etc/ssl/certs/server.pem --warning=30 --critical=14 ``` -------------------------------- ### Check Apache Solr Core Health Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Monitors the health of Apache Solr cores by sending ping requests to the Solr HTTP endpoint. Requires specifying the host, port, and core name. Helps ensure Solr search functionality is operational. ```bash # Check Solr core ping check-solr ping --host=127.0.0.1 --port=8983 --core=products ``` ```bash # mackerel-agent.conf configuration # [plugin.checks.solr] # command = ["check-solr", "ping", "-H", "127.0.0.1", "-p", "8983", "-c", "main_core"] ``` -------------------------------- ### Execute DNS Health Check Source: https://github.com/mackerelio/go-check-plugins/blob/master/check-dns/README.md Performs a basic DNS health check against a specified host using a target DNS server. The check returns OK if the response status is NOERROR, otherwise it returns CRITICAL. ```bash check-dns -H a.root-servers.net -s 8.8.8.8 ``` -------------------------------- ### Monitor AWS SQS Queue Size Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Checks the number of messages in an AWS SQS queue. Can be configured via environment variables or explicit credentials. ```bash check-aws-sqs-queue-size --region=us-east-1 --queue=my-queue --warning=10 --critical=100 AWS_REGION=us-east-1 check-aws-sqs-queue-size --queue=processing-queue -w 50 -c 200 ``` -------------------------------- ### Monitor Windows Event Log Entries Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Monitors Windows Event Logs for specific events, types, and patterns. Allows filtering by log name, event type, source, message content, and event IDs. Useful for detecting errors, warnings, and audit events. ```bash # Check for errors in Application log check-windows-eventlog --log=Application --type=Error --warning-over=5 --critical-over=10 ``` ```bash # Filter by source and message pattern check-windows-eventlog --log=System --type=Error --source-pattern="Service Control" --message-pattern="failed" -w 1 -c 5 ``` ```bash # Event ID filtering check-windows-eventlog --log=Security --type="Audit Failure" --event-id-pattern=4625 -r -w 10 -c 50 ``` ```bash # Exclude specific event IDs check-windows-eventlog --log=Application --type=Warning --event-id-pattern=1000-2000 --event-id-exclude=1001,1002 -w 5 -c 20 ``` ```bash # mackerel-agent.conf configuration # [plugin.checks.eventlog-errors] # command = ["check-windows-eventlog", "--log", "Application", "--type", "Error", "--message-pattern", "critical", "-w", "3", "-c", "10", "-r"] ``` -------------------------------- ### Monitor AWS CloudWatch Logs Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Searches for specific patterns in AWS CloudWatch logs and triggers alerts if thresholds are exceeded. Supports filtering by log group and stream prefix. ```bash check-aws-cloudwatch-logs --log-group-name=/aws/lambda/myfunction --pattern="ERROR" --warning-over=5 --critical-over=10 AWS_PROFILE=production check-aws-cloudwatch-logs --log-group-name=/app/logs --pattern="ERROR" -w 5 -c 20 ``` -------------------------------- ### Monitor DNS Resolution Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Validates DNS resolution by querying a specific server and verifying the response against expected IP addresses or record types. ```bash check-dns -H example.com -s 8.8.8.8 check-dns -H example.com -s 8.8.8.8 -e 93.184.216.34 check-dns -H example.com -s 8.8.8.8 -q AAAA ``` -------------------------------- ### Monitor SSL Certificates with check-ssl-cert Source: https://context7.com/mackerelio/go-check-plugins/llms.txt Checks expiration dates for remote SSL/TLS certificates, supporting custom ports, self-signed certificates, and client authentication. ```bash check-ssl-cert --host=example.com --warning=30 --critical=7 check-ssl-cert -H example.com -p 8443 -w 30 -c 14 check-ssl-cert -H internal.example.com --no-check-certificate -w 30 -c 7 check-ssl-cert -H api.example.com --cert-file=/etc/ssl/client.crt --key-file=/etc/ssl/client.key ```