** 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 General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
** 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 General Public License for more details.
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"github.com/go-ldap/ldap"
"golang.zabbix.com/agent2/pkg/web"
"golang.zabbix.com/sdk/conf"
"golang.zabbix.com/sdk/errs"
"golang.zabbix.com/sdk/log"
"golang.zabbix.com/sdk/plugin"
errorInvalidFirstParam = "Invalid first parameter."
errorInvalidSecondParam = "Invalid second parameter."
errorInvalidThirdParam = "Invalid third parameter."
errorInvalidFourthParam = "Invalid fourth parameter."
errorInvalidFifthParam = "Invalid fifth parameter."
errorTooManyParams = "Too many parameters."
errorUnsupportedMetric = "Unsupported metric."
Timeout int `conf:"optional,range=1:30"`
func (p *Plugin) exportNetTcpListen(params []string) (result interface{}, err error) {
return nil, errors.New(errorTooManyParams)
if len(params) == 0 || params[0] == "" {
return nil, errors.New(errorInvalidFirstParam)
port, err := strconv.ParseUint(params[0], 10, 16)
return nil, errors.New(errorInvalidFirstParam)
return exportSystemTcpListen(uint16(port))
func (p *Plugin) exportNetTcpPort(params []string, timeout int) (result int, err error) {
err = errors.New(errorTooManyParams)
if len(params) < 2 || len(params[1]) == 0 {
err = errors.New(errorInvalidSecondParam)