MSSQL loadable plugin
Source
xxxxxxxxxx
// Start starts the mssql plugin, setting up the internal connection management.
/*
** Zabbix
** Copyright (C) 2001-2025 Zabbix SIA
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
**/
package plugin
import (
_ "embed"
"os"
"golang.zabbix.com/plugin/mssql/plugin/dbconn"
"golang.zabbix.com/plugin/mssql/plugin/handlers"
"golang.zabbix.com/plugin/mssql/plugin/params"
"golang.zabbix.com/sdk/errs"
"golang.zabbix.com/sdk/metric"
"golang.zabbix.com/sdk/plugin"
"golang.zabbix.com/sdk/plugin/container"
"golang.zabbix.com/sdk/zbxerr"
)
const (
// Name of the plugin.
Name = "MSSQL"
availabilityGroupGet = mssqlMetricKey("mssql.availability.group.get")
customQuery = mssqlMetricKey("mssql.custom.query")
dbGet = mssqlMetricKey("mssql.db.get")
jobStatusGet = mssqlMetricKey("mssql.job.status.get")
lastBackupGet = mssqlMetricKey("mssql.last.backup.get")
localDBGet = mssqlMetricKey("mssql.local.db.get")
mirroringGet = mssqlMetricKey("mssql.mirroring.get")
nonLocalDBGet = mssqlMetricKey("mssql.nonlocal.db.get")
perfCounterGet = mssqlMetricKey("mssql.perfcounter.get")
ping = mssqlMetricKey("mssql.ping")
quorumGet = mssqlMetricKey("mssql.quorum.get")
quorumMemberGet = mssqlMetricKey("mssql.quorum.member.get")
replicaGet = mssqlMetricKey("mssql.replica.get")
version = mssqlMetricKey("mssql.version")
)
var (
//go:embed queries/availability.group.get.sql
availabilityGroupGetQuery string
//go:embed queries/db.get.sql
dbGetQuery string
//go:embed queries/job.status.get.sql
jobStatusGetQuery string
//go:embed queries/last.backup.get.sql
lastBackupGetQuery string
//go:embed queries/local.db.get.sql