Check_sql and Multiple Metrics

We are implementing Checkmk-based monitoring for a system that has multiple queues that are represented by data in MS SQL databases. The desire is to have a single service per queue, but with multiple metrics under each service.

Based on this forum thread from April 2020, we have the following Stored Procedure that kind-of works.

	DECLARE @size int,
			@lagTime int
	SELECT @size = dbo.ufs_mntr_getQueueSize(),
			@lagtime = dbo.ufs_mntr_getQueueLagTime()
	SELECT @lagtime AS [Value],
		'Longest delay (seconds)' AS [Text],
		CONCAT(@lagtime, '|queue_size=', @size) AS [PerfData]

We then have a rule in Checkmk configured as follows:

  • Service Description: The Queue
  • Type of Database: MSSQL
  • Database Name: TheDatabase
  • Database User: TheUser
  • Database Password: From password store
  • Query or SQL statement: usp_cmk_GetQueueMetrics
  • Use procedure call instead of SQL statement: None: procedure call is used
  • Upper levels for first output item: 300.00, 900.00
  • Performance Data: queue_lag_time

This works in that we end up with 2 service graphs (“queue_lag_time” and “|queue_size”), each with the correct value. However, only queue_lag_time is shown under “Service Metrics”.

And now, some questions:

  • First and foremost, is this a reasonable approach to this type of monitoring or is there a better way?
  • Assuming this is sane, is there a way to show multiple metrics in the “Service Metrics” section?
  • Is there a way to plot multiple metrics on a single graph?
  • Is there a way to trim the leading pipe from “|queue_size”?
  • Is there a way to have all the metric names in the same place? Our current implementation depends on putting the first metric in the Checkmk rule and all subsequent ones in the Stored Procedure.

Thanks in advance for any feedback or guidance,
Jason