** Copyright (C) 2001-2025 Zabbix SIA
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
"golang.zabbix.com/sdk/errs"
"golang.zabbix.com/sdk/metric"
"golang.zabbix.com/sdk/plugin"
"golang.zabbix.com/sdk/uri"
keyASMDiskGroups = "oracle.diskgroups.stats"
keyASMDiskGroupsDiscovery = "oracle.diskgroups.discovery"
keyArchive = "oracle.archive.info"
keyArchiveDiscovery = "oracle.archive.discovery"
keyCDB = "oracle.cdb.info"
keyCustomQuery = "oracle.custom.query"
keyDataFiles = "oracle.datafiles.stats"
keyDatabasesDiscovery = "oracle.db.discovery"
keyFRA = "oracle.fra.stats"
keyInstance = "oracle.instance.info"
keyPDB = "oracle.pdb.info"
keyPDBDiscovery = "oracle.pdb.discovery"
keyPGA = "oracle.pga.stats"
keyProc = "oracle.proc.stats"
keyRedoLog = "oracle.redolog.info"
keySGA = "oracle.sga.stats"
keySessions = "oracle.sessions.stats"
keySysMetrics = "oracle.sys.metrics"
keySysParams = "oracle.sys.params"
keyTablespaces = "oracle.ts.stats"
keyTablespacesDiscovery = "oracle.ts.discovery"
keyUser = "oracle.user.info"
keyVersion = "oracle.version"
// handlerFunc defines an interface must be implemented by handlers.
ctx context.Context, conn OraClient, params map[string]string, extraParams ...string,
) (res interface{}, err error)
err := plugin.RegisterMetrics(&impl, pluginName, metrics.List()...)
panic(errs.Wrap(err, "failed to register metrics"))
// getHandlerFunc returns a handlerFunc related to a given key.
func getHandlerFunc(key string) handlerFunc {
return asmDiskGroupsHandler
case keyASMDiskGroupsDiscovery:
return asmDiskGroupsDiscovery
case keyArchiveDiscovery:
return archiveDiscoveryHandler
return customQueryHandler
case keyDatabasesDiscovery:
return databasesDiscoveryHandler
return pdbDiscoveryHandler