Best integration from consol labs plugin into checkmk

Hey guys

Is there somewhere a best practise or general tutorial how to use the consol labs plugin into checkmk?

Greetz
Ovrld

Hi @Overlord

As far as I know consol labs creates Nagios/Icinga plugins. As such, they would be used as any other classic Nagios/Icinga check in CMK, i.e. either as “classic” active or passive check or via MRPE.

HTH,
Thomas

1 Like

Since I have installed the check via MRPE I have an issue with the agent output and CheckMK can’t recognize the apache Plugin anymore:

<<< mrpe>>>
(check_mysql_health) MySQL_IndexUsage 2 CRITICAL - index usage 5.76% | index_usage=5.76%;12:;10: index_usage_now=0.00%
<<< mrpe>>>
() 0
<<local:sep(0)>>
0 Nextcloud_Version - No update available (installed version: 20.0.8.1)
cached(1617707950,45000) 0 ‘APT Repository’ Repositories=4: Repository Health Fine
<<<apache_status:sep(124)>>>
[::1]|80||::1
[::1]|80||ServerVersion: Apache/2.4.38 (Debian)
[::1]|80||ServerMPM: prefork
[::1]|80||Server Built: 2020-08-25T20:08:29
[::1]|80||CurrentTime: Tuesday, 06-Apr-2021 13:59:38 CEST
[::1]|80||RestartTime: Friday, 02-Apr-2021 20:36:36 CEST
[::1]|80||ParentServerConfigGeneration: 5
[::1]|80||ParentServerMPMGeneration: 4
[::1]|80||ServerUptimeSeconds: 321781
[::1]|80||ServerUptime: 3 days 17 hours 23 minutes 1 second
[::1]|80||Load1: 0.22
[::1]|80||Load5: 0.11
[::1]|80||Load15: 0.03
[::1]|80||Total Accesses: 6048
[::1]|80||Total kBytes: 8084
[::1]|80||Total Duration: 6028
[::1]|80||CPUUser: 4.16
[::1]|80||CPUSystem: 8.24
[::1]|80||CPUChildrenUser: 2.56
[::1]|80||CPUChildrenSystem: 1.25
[::1]|80||CPULoad: .00503759
[::1]|80||Uptime: 321781
[::1]|80||ReqPerSec: .0187954
[::1]|80||BytesPerSec: 25.7256
[::1]|80||BytesPerReq: 1368.72
[::1]|80||DurationPerReq: .996693
[::1]|80||BusyWorkers: 1
[::1]|80||IdleWorkers: 5
[::1]|80||Scoreboard: W___…
Please select a mode
Copyright (c) 2009 Gerhard Lausser

Check various parameters of MySQL databases

Usage:
check_mysql_health [-v] [-t ] [[–hostname ]
[–port | --socket ]
–username --password ] --mode
[–method mysql]
check_mysql_health [-h | --help]
check_mysql_health [-V | --version]

Options:
–hostname
the database server’s hostname
–port
the database’s port. (default: 3306)
–socket
the database’s unix socket.
–username
the mysql db user
–password
the mysql db user’s password
–database
the database’s name. (default: information_schema)
–replication-user
the database’s replication user name (default: replication)
–warning
the warning range
–critical
the critical range
–mode
the mode of the plugin. select one of the following keywords:
connection-time (Time to connect to the server)
uptime (Time the server is running)
threads-connected (Number of currently open connections)
threadcache-hitrate (Hit rate of the thread-cache)
threads-created (Number of threads created per sec)
threads-running (Number of currently running threads)
threads-cached (Number of currently cached threads)
connects-aborted (Number of aborted connections per sec)
clients-aborted (Number of aborted connections (because the client died) per sec)
slave-lag (Seconds behind master)
slave-io-running (Slave io running: Yes)
slave-sql-running (Slave sql running: Yes)
qcache-hitrate (Query cache hitrate)
qcache-lowmem-prunes (Query cache entries pruned because of low memory)
keycache-hitrate (MyISAM key cache hitrate)
bufferpool-hitrate (InnoDB buffer pool hitrate)
bufferpool-wait-free (InnoDB buffer pool waits for clean page available)
log-waits (InnoDB log waits because of a too small log buffer)
tablecache-hitrate (Table cache hitrate)
table-lock-contention (Table lock contention)
index-usage (Usage of indices)
tmp-disk-tables (Percent of temp tables created on disk)
table-fragmentation (Show tables which should be optimized)
open-files (Percent of opened files)
slow-queries (Slow queries)
long-running-procs (long running processes)
cluster-ndbd-running (ndnd nodes are up and running)
sql (any sql command returning a single number)

--name
   the name of something that needs to be further specified,
   currently only used for sql statements
--name2
   if name is a sql statement, this statement would appear in
   the output and the performance data. This can be ugly, so
   name2 can be used to appear instead.
--regexp
   if this parameter is used, name will be interpreted as a
   regular expression.
--units
   one of %, KB, MB, GB. This is used for a better output of mode=sql
   and for specifying thresholds for mode=tablespace-free
--labelformat
   one of pnp4nagios (which is the default) or groundwork.
   It is used to shorten performance data labels to 19 characters.

In mode sql you can url-encode the statement so you will not have to mess
around with special characters in your Nagios service definitions.
Instead of
–name=“select count(*) from v$session where status = ‘ACTIVE’”
you can say
–name=select%20count%28%2A%29%20from%20v%24session%20where%20status%20%3D%20%27ACTIVE%27
For your convenience you can call check_mysql_health with the --mode encode
option and it will encode the standard input.

You can find the full documentation at
check_mysql_health - ConSol Labs

Send email to gerhard.lausser@consol.de if you have questions
regarding use of this software.
Please include version information with all correspondence (when possible,
use output from the --version option of the plugin itself).

If i perform the script on the shell, I get the normal output without the last stuff from the script:

CRITICAL - index usage 5.76% | index_usage=5.76%;12:;10: index_usage_now=5.69%

Any Ideas?

The output looks like a wrong configured MRPE call.
Can you show the MRPE configuration please.

1 Like

MySQL%20IndexUsage /usr/lib/check_mk_agent/plugins/check_mysql_health --hostname 127.0.0.1 --username user --password ‘password’ --mode index-usage --warning 12: --critical 10:

Hey @Overlord

Try the following:

  1. Place this line into a seperate *.sh file /usr/lib/check_mk_agent/plugins/check_mysql_health --hostname 127.0.0.1 --username user --password ‘password’ --mode index-usage --warning 12: --critical 10:
  2. Execute your shell script with MRPE

Does it yield the expected result?

Thomas

2 Likes

Argh - got it! :wink: I copied the script in the same directory to it’s pulled twice. Omg

The agent’s plugins directory is only for checkmk agent plugins. Classical Nagios plugins have to be installed outside of /usr/lib/check_mk_agent and can be called via /etc/check_mk/mrpe.cfg.

See section 4 of The agent for Linux in detail

1 Like

Thank you for your reply - a short last question:

Is there a difference between MRPE and “Integrate Nagios plugins”" (Setup → Services → Other Services → Integrate Nagios plugins"?

MRPE = running on the monitored client machine
Integrate Nagios plugins = Running on the Monitoring server and bind the checks to the client machines?

Like “check if IP/DNS xy is on a spamlist”, running on the monitoring server and bind this check to the client server with that DNS/IP?

Yes, that is exactly correct.

1 Like