MSSQL loadable plugin
Source
xxxxxxxxxx
// nullUniqueIdentifier is a wrapper for mssql.UniqueIdentifier that allows for
/*
** Zabbix
** Copyright (C) 2001-2024 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 handlers
import (
"context"
"database/sql"
"database/sql/driver"
"encoding/json"
"io"
"io/fs"
"path/filepath"
"strings"
mssql "github.com/microsoft/go-mssqldb"
"golang.zabbix.com/plugin/mssql/plugin/params"
"golang.zabbix.com/sdk/errs"
"golang.zabbix.com/sdk/log"
)
var (
_ sql.Scanner = (*nullUniqueIdentifier)(nil)
_ driver.Valuer = (*nullUniqueIdentifier)(nil)
_ sql.Scanner = (*nullBool)(nil)
_ driver.Valuer = (*nullBool)(nil)
_ HandlerFunc = WithJSONResponse(nil)
_ ConnHandlerFunc = QueryHandlerFunc("")
_ ConnHandlerFunc = VersionHandler
_ ConnHandlerFunc = CustomQueries(nil).HandlerFunc
)
// HandlerFunc describes the signature all metric handler functions must have.
type HandlerFunc func(
metricParams map[string]string, extraParams ...string,
) (any, error)
// ConnHandlerFunc describes the signature all connection handler functions
// must have.
type ConnHandlerFunc func(
ctx context.Context,
conn *sql.DB,
metricParams map[string]string,
extraParams ...string,
) (any, error)
// CustomQueries stores user defined custom queries.