Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrejs Kozlovs <andrejs.kozlovs@zabbix.com>2022-05-18 08:23:44 +0300
committerAndrejs Kozlovs <andrejs.kozlovs@zabbix.com>2022-05-18 08:23:44 +0300
commitaae5d830adf1ea6005e2fd6e3246d2cbd26e6f0e (patch)
tree16ee04df31d7221139c0d9b8dd7a46cd5e9841b8 /src
parent9f7700c080a6be16790dc5fe872edf0d56c8f3d0 (diff)
parent68d1c61fe03ea517890107d12f90d76d0b27c273 (diff)
.......... [DEV-2159] update from branch 'release/6.0' of ssh://git.zabbix.com:7999/zbx/zabbix into feature/DEV-2159-6.0
Diffstat (limited to 'src')
-rw-r--r--src/go/cmd/mock_server/mock_server.go4
-rw-r--r--src/go/cmd/zabbix_agent2/config.go2
-rw-r--r--src/go/cmd/zabbix_agent2/external.go6
-rw-r--r--src/go/cmd/zabbix_agent2/external_nix.go4
-rw-r--r--src/go/cmd/zabbix_agent2/service_windows.go2
-rw-r--r--src/go/cmd/zabbix_agent2/zabbix_agent2.go4
-rw-r--r--src/go/cmd/zabbix_agent2/zabbix_agent2_nix.go2
-rw-r--r--src/go/cmd/zabbix_web_service/pdf_report_creator.go4
-rw-r--r--src/go/cmd/zabbix_web_service/zabbix_web_service.go4
-rw-r--r--src/go/go.mod4
-rw-r--r--src/go/go.sum9
-rw-r--r--src/go/internal/agent/alias/alias_test.go4
-rw-r--r--src/go/internal/agent/keyaccess/key_access_rules.go4
-rw-r--r--src/go/internal/agent/keyaccess/key_access_rules_test.go2
-rw-r--r--src/go/internal/agent/options.go2
-rw-r--r--src/go/internal/agent/plugin_agent.go4
-rw-r--r--src/go/internal/agent/plugin_userparameter.go2
-rw-r--r--src/go/internal/agent/plugin_userparameter_test.go2
-rw-r--r--src/go/internal/agent/remotecontrol/remote_nix.go2
-rw-r--r--src/go/internal/agent/remotecontrol/remote_windows.go2
-rw-r--r--src/go/internal/agent/resultcache/diskcache.go4
-rw-r--r--src/go/internal/agent/resultcache/memorycache.go4
-rw-r--r--src/go/internal/agent/resultcache/resultcache.go4
-rw-r--r--src/go/internal/agent/resultcache/resultcache_test.go4
-rw-r--r--src/go/internal/agent/scheduler/client.go4
-rw-r--r--src/go/internal/agent/scheduler/manager.go6
-rw-r--r--src/go/internal/agent/scheduler/manager_test.go6
-rw-r--r--src/go/internal/agent/scheduler/plugin.go2
-rw-r--r--src/go/internal/agent/scheduler/query.go2
-rw-r--r--src/go/internal/agent/scheduler/task.go4
-rw-r--r--src/go/internal/agent/serverconnector/serverconnector.go4
-rw-r--r--src/go/internal/agent/serverlistener/passivecheck.go2
-rw-r--r--src/go/internal/agent/serverlistener/serverlistener.go2
-rw-r--r--src/go/internal/agent/statuslistener/statuslistener.go2
-rw-r--r--src/go/pkg/conf/conf.go726
-rw-r--r--src/go/pkg/conf/conf_test.go597
-rw-r--r--src/go/pkg/conf/node.go152
-rw-r--r--src/go/pkg/conf/session.go28
-rw-r--r--src/go/pkg/itemutil/value.go2
-rw-r--r--src/go/pkg/log/log.go270
-rw-r--r--src/go/pkg/log/log_nix.go51
-rw-r--r--src/go/pkg/log/log_windows.go32
-rw-r--r--src/go/pkg/log/logger.go48
-rw-r--r--src/go/pkg/metric/metric.go445
-rw-r--r--src/go/pkg/metric/metric_test.go388
-rw-r--r--src/go/pkg/metric/validators.go131
-rw-r--r--src/go/pkg/metric/validators_test.go203
-rw-r--r--src/go/pkg/pdh/pdh_windows.go2
-rw-r--r--src/go/pkg/plugin/base.go70
-rw-r--r--src/go/pkg/plugin/comms/connection.go124
-rw-r--r--src/go/pkg/plugin/comms/protocol.go142
-rw-r--r--src/go/pkg/plugin/container/handler.go380
-rw-r--r--src/go/pkg/plugin/container/handler_linux.go49
-rw-r--r--src/go/pkg/plugin/container/handler_windows.go50
-rw-r--r--src/go/pkg/plugin/container/interface.go55
-rw-r--r--src/go/pkg/plugin/registry.go160
-rw-r--r--src/go/pkg/plugin/types.go144
-rw-r--r--src/go/pkg/tls/tls.go4
-rw-r--r--src/go/pkg/tlsconfig/tlsconfig.go2
-rw-r--r--src/go/pkg/version/version.go4
-rw-r--r--src/go/pkg/watch/manager.go2
-rw-r--r--src/go/pkg/win32/pdh.go2
-rw-r--r--src/go/pkg/wmi/wmi.go2
-rw-r--r--src/go/pkg/zbxcmd/zbxcmd_nix.go2
-rw-r--r--src/go/pkg/zbxcmd/zbxcmd_windows.go2
-rw-r--r--src/go/pkg/zbxcomms/comms.go2
-rw-r--r--src/go/pkg/zbxerr/zbxerr.go101
-rw-r--r--src/go/pkg/zbxerr/zbxerr_test.go208
-rw-r--r--src/go/pkg/zbxlib/logger.go2
-rw-r--r--src/go/plugins/ceph/ceph.go4
-rw-r--r--src/go/plugins/ceph/config.go4
-rw-r--r--src/go/plugins/ceph/handler_df.go2
-rw-r--r--src/go/plugins/ceph/handler_discovery.go2
-rw-r--r--src/go/plugins/ceph/handler_osd.go2
-rw-r--r--src/go/plugins/ceph/handler_osd_dump.go2
-rw-r--r--src/go/plugins/ceph/handler_status.go2
-rw-r--r--src/go/plugins/ceph/metrics.go6
-rw-r--r--src/go/plugins/ceph/request.go4
-rw-r--r--src/go/plugins/debug/collector/collector.go4
-rw-r--r--src/go/plugins/debug/empty/empty.go2
-rw-r--r--src/go/plugins/debug/external/full/full.go4
-rw-r--r--src/go/plugins/debug/external/full/main.go2
-rw-r--r--src/go/plugins/debug/external/multikey/main.go2
-rw-r--r--src/go/plugins/debug/external/multikey/multikey.go2
-rw-r--r--src/go/plugins/debug/external/test/main.go2
-rw-r--r--src/go/plugins/debug/external/test/test.go2
-rw-r--r--src/go/plugins/debug/filewatcher/filewatcher.go2
-rw-r--r--src/go/plugins/debug/log/log.go2
-rw-r--r--src/go/plugins/debug/trapper/trapper.go4
-rw-r--r--src/go/plugins/docker/client.go2
-rw-r--r--src/go/plugins/docker/config.go4
-rw-r--r--src/go/plugins/docker/discovery.go2
-rw-r--r--src/go/plugins/docker/docker.go4
-rw-r--r--src/go/plugins/docker/metrics.go4
-rw-r--r--src/go/plugins/external/broker.go8
-rw-r--r--src/go/plugins/external/plugin.go4
-rw-r--r--src/go/plugins/kernel/kernel.go6
-rw-r--r--src/go/plugins/kernel/kernel_test.go2
-rw-r--r--src/go/plugins/log/log.go4
-rw-r--r--src/go/plugins/memcached/config.go4
-rw-r--r--src/go/plugins/memcached/conn.go6
-rw-r--r--src/go/plugins/memcached/conn_test.go2
-rw-r--r--src/go/plugins/memcached/handler_stats.go2
-rw-r--r--src/go/plugins/memcached/handler_stats_test.go2
-rw-r--r--src/go/plugins/memcached/memcached.go6
-rw-r--r--src/go/plugins/memcached/memcached_test.go4
-rw-r--r--src/go/plugins/memcached/metrics.go6
-rw-r--r--src/go/plugins/modbus/modbus.go4
-rw-r--r--src/go/plugins/mongodb/config.go4
-rw-r--r--src/go/plugins/mongodb/conn.go4
-rw-r--r--src/go/plugins/mongodb/handler_collection_stats.go2
-rw-r--r--src/go/plugins/mongodb/handler_collection_stats_test.go2
-rw-r--r--src/go/plugins/mongodb/handler_collections_discovery.go2
-rw-r--r--src/go/plugins/mongodb/handler_collections_discovery_test.go2
-rw-r--r--src/go/plugins/mongodb/handler_collections_usage.go2
-rw-r--r--src/go/plugins/mongodb/handler_config_discovery.go2
-rw-r--r--src/go/plugins/mongodb/handler_connPool_stats.go2
-rw-r--r--src/go/plugins/mongodb/handler_connPool_stats_test.go2
-rw-r--r--src/go/plugins/mongodb/handler_database_stats.go2
-rw-r--r--src/go/plugins/mongodb/handler_database_stats_test.go2
-rw-r--r--src/go/plugins/mongodb/handler_databases_discovery.go2
-rw-r--r--src/go/plugins/mongodb/handler_databases_discovery_test.go2
-rw-r--r--src/go/plugins/mongodb/handler_jumbo_chunks.go2
-rw-r--r--src/go/plugins/mongodb/handler_oplog_stats.go2
-rw-r--r--src/go/plugins/mongodb/handler_replset_config.go2
-rw-r--r--src/go/plugins/mongodb/handler_replset_status.go2
-rw-r--r--src/go/plugins/mongodb/handler_server_status.go2
-rw-r--r--src/go/plugins/mongodb/handler_shards_discovery.go2
-rw-r--r--src/go/plugins/mongodb/metrics.go6
-rw-r--r--src/go/plugins/mongodb/mockconn.go2
-rw-r--r--src/go/plugins/mongodb/mongodb.go6
-rw-r--r--src/go/plugins/mqtt/mqtt.go4
-rw-r--r--src/go/plugins/mysql/config.go4
-rw-r--r--src/go/plugins/mysql/conn.go6
-rw-r--r--src/go/plugins/mysql/handler_database_size.go2
-rw-r--r--src/go/plugins/mysql/handler_databases_discovery.go2
-rw-r--r--src/go/plugins/mysql/handler_replication_discovery.go2
-rw-r--r--src/go/plugins/mysql/handler_replication_status.go2
-rw-r--r--src/go/plugins/mysql/handler_status_variables.go2
-rw-r--r--src/go/plugins/mysql/handler_version.go2
-rw-r--r--src/go/plugins/mysql/metrics.go6
-rw-r--r--src/go/plugins/mysql/mysql.go6
-rw-r--r--src/go/plugins/net/dns/dns.go4
-rw-r--r--src/go/plugins/net/dns/dns_windows.go2
-rw-r--r--src/go/plugins/net/netif/netif.go2
-rw-r--r--src/go/plugins/net/netif/netif_linux.go4
-rw-r--r--src/go/plugins/net/netif/netif_test.go2
-rw-r--r--src/go/plugins/net/netif/netif_unsupported.go2
-rw-r--r--src/go/plugins/net/netif/netif_windows.go2
-rw-r--r--src/go/plugins/net/tcp/tcp.go6
-rw-r--r--src/go/plugins/net/tcp/tcp_nix.go2
-rw-r--r--src/go/plugins/net/tcp/tcp_windows.go2
-rw-r--r--src/go/plugins/net/udp/udp.go6
-rw-r--r--src/go/plugins/oracle/config.go4
-rw-r--r--src/go/plugins/oracle/conn.go6
-rw-r--r--src/go/plugins/oracle/conn_test.go2
-rw-r--r--src/go/plugins/oracle/handler_archive.go2
-rw-r--r--src/go/plugins/oracle/handler_archive_discovery.go2
-rw-r--r--src/go/plugins/oracle/handler_asm_diskgroups.go2
-rw-r--r--src/go/plugins/oracle/handler_asm_diskgroups_discovery.go2
-rw-r--r--src/go/plugins/oracle/handler_cdb.go2
-rw-r--r--src/go/plugins/oracle/handler_custom_query.go2
-rw-r--r--src/go/plugins/oracle/handler_databases_discovery.go2
-rw-r--r--src/go/plugins/oracle/handler_datafiles.go2
-rw-r--r--src/go/plugins/oracle/handler_fra.go2
-rw-r--r--src/go/plugins/oracle/handler_instance.go2
-rw-r--r--src/go/plugins/oracle/handler_pdb.go2
-rw-r--r--src/go/plugins/oracle/handler_pdb_discovery.go2
-rw-r--r--src/go/plugins/oracle/handler_pga.go2
-rw-r--r--src/go/plugins/oracle/handler_processes.go2
-rw-r--r--src/go/plugins/oracle/handler_redolog.go2
-rw-r--r--src/go/plugins/oracle/handler_sessions.go2
-rw-r--r--src/go/plugins/oracle/handler_sga.go2
-rw-r--r--src/go/plugins/oracle/handler_sysmetrics.go2
-rw-r--r--src/go/plugins/oracle/handler_sysparams.go2
-rw-r--r--src/go/plugins/oracle/handler_tablespaces.go2
-rw-r--r--src/go/plugins/oracle/handler_tablespaces_discovery.go2
-rw-r--r--src/go/plugins/oracle/handler_user.go2
-rw-r--r--src/go/plugins/oracle/metrics.go6
-rw-r--r--src/go/plugins/oracle/oracle.go6
-rw-r--r--src/go/plugins/oracle/oracle_test.go4
-rwxr-xr-xsrc/go/plugins/postgres/config.go4
-rwxr-xr-xsrc/go/plugins/postgres/conn.go6
-rw-r--r--src/go/plugins/postgres/handler_archive.go3
-rw-r--r--src/go/plugins/postgres/handler_autovacuum.go2
-rw-r--r--src/go/plugins/postgres/handler_bgwriter.go2
-rw-r--r--src/go/plugins/postgres/handler_cache.go2
-rw-r--r--src/go/plugins/postgres/handler_connections.go2
-rw-r--r--src/go/plugins/postgres/handler_custom_query.go2
-rw-r--r--src/go/plugins/postgres/handler_database_age.go2
-rw-r--r--src/go/plugins/postgres/handler_database_size.go2
-rw-r--r--src/go/plugins/postgres/handler_databases_bloating.go2
-rw-r--r--src/go/plugins/postgres/handler_databases_discovery.go2
-rw-r--r--src/go/plugins/postgres/handler_dbstat.go2
-rw-r--r--src/go/plugins/postgres/handler_locks.go2
-rw-r--r--src/go/plugins/postgres/handler_oldest_xid.go2
-rw-r--r--src/go/plugins/postgres/handler_queries.go2
-rw-r--r--src/go/plugins/postgres/handler_replication.go2
-rw-r--r--src/go/plugins/postgres/handler_replication_process_name_discovery.go2
-rw-r--r--src/go/plugins/postgres/handler_uptime.go2
-rw-r--r--src/go/plugins/postgres/handler_wal.go2
-rw-r--r--src/go/plugins/postgres/metrics.go6
-rwxr-xr-xsrc/go/plugins/postgres/postgres.go6
-rwxr-xr-xsrc/go/plugins/postgres/postgres_test.go4
-rw-r--r--src/go/plugins/postgres/testpool.go3
-rw-r--r--src/go/plugins/proc/proc_linux.go4
-rw-r--r--src/go/plugins/proc/proc_windows.go2
-rw-r--r--src/go/plugins/redis/config.go4
-rw-r--r--src/go/plugins/redis/conn.go6
-rw-r--r--src/go/plugins/redis/conn_test.go2
-rw-r--r--src/go/plugins/redis/handler_config.go2
-rw-r--r--src/go/plugins/redis/handler_info.go2
-rw-r--r--src/go/plugins/redis/handler_slowlog.go2
-rw-r--r--src/go/plugins/redis/metrics.go6
-rw-r--r--src/go/plugins/redis/redis.go6
-rw-r--r--src/go/plugins/redis/redis_test.go2
-rw-r--r--src/go/plugins/smart/smart.go6
-rw-r--r--src/go/plugins/smart/smartfs.go2
-rw-r--r--src/go/plugins/system/cpu/cpu.go2
-rw-r--r--src/go/plugins/system/cpu/cpu_linux.go2
-rw-r--r--src/go/plugins/system/cpu/cpu_windows.go4
-rw-r--r--src/go/plugins/system/cpu/pdhcollector_windows.go2
-rw-r--r--src/go/plugins/system/hw/hw_linux.go4
-rw-r--r--src/go/plugins/system/sw/sw.go4
-rw-r--r--src/go/plugins/system/swap/swap.go2
-rw-r--r--src/go/plugins/system/uname/uname.go2
-rw-r--r--src/go/plugins/system/uptime/uptime.go4
-rw-r--r--src/go/plugins/system/uptime/uptime_linux.go2
-rw-r--r--src/go/plugins/system/uptime/uptime_test.go2
-rw-r--r--src/go/plugins/system/users/users.go2
-rw-r--r--src/go/plugins/systemd/systemd.go2
-rw-r--r--src/go/plugins/systemrun/systemrun.go4
-rw-r--r--src/go/plugins/vfs/dev/dev.go2
-rw-r--r--src/go/plugins/vfs/dir/count.go4
-rw-r--r--src/go/plugins/vfs/dir/dir.go4
-rw-r--r--src/go/plugins/vfs/dir/size.go2
-rw-r--r--src/go/plugins/vfs/file/cksum.go4
-rw-r--r--src/go/plugins/vfs/file/cksum_test.go2
-rw-r--r--src/go/plugins/vfs/file/contents_test.go2
-rw-r--r--src/go/plugins/vfs/file/exists_test.go2
-rw-r--r--src/go/plugins/vfs/file/file.go6
-rw-r--r--src/go/plugins/vfs/file/get.go2
-rw-r--r--src/go/plugins/vfs/file/get_windows.go2
-rw-r--r--src/go/plugins/vfs/file/md5sum.go4
-rw-r--r--src/go/plugins/vfs/file/md5sum_test.go2
-rw-r--r--src/go/plugins/vfs/file/owner_nix.go2
-rw-r--r--src/go/plugins/vfs/file/owner_windows.go2
-rw-r--r--src/go/plugins/vfs/file/permissions_nix.go2
-rw-r--r--src/go/plugins/vfs/file/permissions_windows.go2
-rw-r--r--src/go/plugins/vfs/file/regexp_test.go2
-rw-r--r--src/go/plugins/vfs/file/regmatch_test.go2
-rw-r--r--src/go/plugins/vfs/file/sha256sum.go2
-rw-r--r--src/go/plugins/vfs/file/size.go2
-rw-r--r--src/go/plugins/vfs/file/size_test.go2
-rw-r--r--src/go/plugins/vfs/file/time_nix.go2
-rw-r--r--src/go/plugins/vfs/file/time_test.go2
-rw-r--r--src/go/plugins/vfs/file/time_windows.go2
-rw-r--r--src/go/plugins/vfs/fs/fs.go2
-rw-r--r--src/go/plugins/vfs/fs/fs_nix.go2
-rw-r--r--src/go/plugins/vfs/fs/fs_windows.go4
-rw-r--r--src/go/plugins/vm/memory/memory.go4
-rw-r--r--src/go/plugins/vm/memory/memory_linux.go2
-rw-r--r--src/go/plugins/vm/vmemory/vmemory_windows.go4
-rw-r--r--src/go/plugins/web/certificate/certificate.go8
-rw-r--r--src/go/plugins/web/certificate/certificate_test.go2
-rw-r--r--src/go/plugins/web/page/page.go4
-rw-r--r--src/go/plugins/windows/eventlog/eventlog_windows.go4
-rw-r--r--src/go/plugins/windows/perfinstance/perfinstance.go3
-rw-r--r--src/go/plugins/windows/perfmon/perfmon.go5
-rw-r--r--src/go/plugins/windows/services/services_windows.go2
-rw-r--r--src/go/plugins/windows/wmi/wmi.go2
-rw-r--r--src/go/plugins/zabbix/async/async.go2
-rw-r--r--src/go/plugins/zabbix/stats/stats.go4
-rw-r--r--src/go/plugins/zabbix/sync/sync.go2
-rw-r--r--src/libs/zbxdbcache/dbconfig.c2
-rw-r--r--src/libs/zbxdbhigh/host.c13
-rw-r--r--src/libs/zbxdbhigh/lld_override.c4
-rw-r--r--src/libs/zbxdbupgrade/dbupgrade_6000.c28
-rw-r--r--src/libs/zbxeval/calc.c24
-rw-r--r--src/libs/zbxeval/execute.c2
-rw-r--r--src/libs/zbxnix/fatal.c7
-rw-r--r--src/libs/zbxprometheus/zbxprometheus.c7
-rw-r--r--src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java4
-rw-r--r--src/zabbix_server/lld/lld.c4
-rw-r--r--src/zabbix_server/lld/lld.h2
-rw-r--r--src/zabbix_server/lld/lld_host.c30
-rw-r--r--src/zabbix_server/poller/checks_simple_vmware.c132
-rw-r--r--src/zabbix_server/server.c14
-rw-r--r--src/zabbix_server/vmware/vmware.c31
-rw-r--r--src/zabbix_server/vmware/vmware.h4
290 files changed, 577 insertions, 5034 deletions
diff --git a/src/go/cmd/mock_server/mock_server.go b/src/go/cmd/mock_server/mock_server.go
index e7eeaa70e8b..6f70016a3cc 100644
--- a/src/go/cmd/mock_server/mock_server.go
+++ b/src/go/cmd/mock_server/mock_server.go
@@ -28,8 +28,8 @@ import (
"strconv"
"time"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/pkg/zbxcomms"
)
diff --git a/src/go/cmd/zabbix_agent2/config.go b/src/go/cmd/zabbix_agent2/config.go
index e86c8eb1658..29416e35e6c 100644
--- a/src/go/cmd/zabbix_agent2/config.go
+++ b/src/go/cmd/zabbix_agent2/config.go
@@ -24,9 +24,9 @@ import (
"strings"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/internal/agent"
"zabbix.com/internal/agent/scheduler"
- "zabbix.com/pkg/log"
"zabbix.com/pkg/zbxcmd"
)
diff --git a/src/go/cmd/zabbix_agent2/external.go b/src/go/cmd/zabbix_agent2/external.go
index 8bedaa6bc02..5146295693a 100644
--- a/src/go/cmd/zabbix_agent2/external.go
+++ b/src/go/cmd/zabbix_agent2/external.go
@@ -26,10 +26,10 @@ import (
"os"
"time"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin/comms"
"zabbix.com/internal/agent"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/plugin/comms"
"zabbix.com/plugins/external"
)
diff --git a/src/go/cmd/zabbix_agent2/external_nix.go b/src/go/cmd/zabbix_agent2/external_nix.go
index 1e5a11ada03..5301e0b0386 100644
--- a/src/go/cmd/zabbix_agent2/external_nix.go
+++ b/src/go/cmd/zabbix_agent2/external_nix.go
@@ -29,8 +29,8 @@ import (
"os/signal"
"syscall"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/plugins/external"
)
diff --git a/src/go/cmd/zabbix_agent2/service_windows.go b/src/go/cmd/zabbix_agent2/service_windows.go
index c1da1708778..7e835dab555 100644
--- a/src/go/cmd/zabbix_agent2/service_windows.go
+++ b/src/go/cmd/zabbix_agent2/service_windows.go
@@ -28,6 +28,7 @@ import (
"sync"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
"golang.org/x/sys/windows/svc"
"golang.org/x/sys/windows/svc/eventlog"
"golang.org/x/sys/windows/svc/mgr"
@@ -35,7 +36,6 @@ import (
"zabbix.com/internal/agent/keyaccess"
"zabbix.com/internal/agent/scheduler"
"zabbix.com/internal/monitor"
- "zabbix.com/pkg/log"
)
var (
diff --git a/src/go/cmd/zabbix_agent2/zabbix_agent2.go b/src/go/cmd/zabbix_agent2/zabbix_agent2.go
index 38c82642d7e..dd6d853777d 100644
--- a/src/go/cmd/zabbix_agent2/zabbix_agent2.go
+++ b/src/go/cmd/zabbix_agent2/zabbix_agent2.go
@@ -29,6 +29,8 @@ import (
_ "zabbix.com/plugins"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/internal/agent"
"zabbix.com/internal/agent/keyaccess"
"zabbix.com/internal/agent/remotecontrol"
@@ -38,8 +40,6 @@ import (
"zabbix.com/internal/agent/serverlistener"
"zabbix.com/internal/agent/statuslistener"
"zabbix.com/internal/monitor"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/log"
"zabbix.com/pkg/pidfile"
"zabbix.com/pkg/tls"
"zabbix.com/pkg/version"
diff --git a/src/go/cmd/zabbix_agent2/zabbix_agent2_nix.go b/src/go/cmd/zabbix_agent2/zabbix_agent2_nix.go
index 60b66af6143..eddb7319a8f 100644
--- a/src/go/cmd/zabbix_agent2/zabbix_agent2_nix.go
+++ b/src/go/cmd/zabbix_agent2/zabbix_agent2_nix.go
@@ -27,7 +27,7 @@ import (
"os/signal"
"syscall"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/log"
)
func loadOSDependentItems() error {
diff --git a/src/go/cmd/zabbix_web_service/pdf_report_creator.go b/src/go/cmd/zabbix_web_service/pdf_report_creator.go
index 391b58bc29b..22221a6a46e 100644
--- a/src/go/cmd/zabbix_web_service/pdf_report_creator.go
+++ b/src/go/cmd/zabbix_web_service/pdf_report_creator.go
@@ -31,12 +31,12 @@ import (
"strconv"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/chromedp/cdproto/emulation"
"github.com/chromedp/cdproto/network"
"github.com/chromedp/cdproto/page"
"github.com/chromedp/chromedp"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/zbxerr"
)
type requestBody struct {
diff --git a/src/go/cmd/zabbix_web_service/zabbix_web_service.go b/src/go/cmd/zabbix_web_service/zabbix_web_service.go
index 21b65855c91..902f0450b54 100644
--- a/src/go/cmd/zabbix_web_service/zabbix_web_service.go
+++ b/src/go/cmd/zabbix_web_service/zabbix_web_service.go
@@ -31,8 +31,8 @@ import (
"os/signal"
"syscall"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/pkg/version"
"zabbix.com/pkg/zbxnet"
)
diff --git a/src/go/go.mod b/src/go/go.mod
index ac513bf57d2..b8d5d3a6dea 100644
--- a/src/go/go.mod
+++ b/src/go/go.mod
@@ -3,6 +3,7 @@ module zabbix.com
go 1.16
require (
+ git.zabbix.com/ap/plugin-support v0.0.2
github.com/BurntSushi/locker v0.0.0-20171006230638-a6e239ea1c69
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5
github.com/chromedp/cdproto v0.0.0-20210104223854-2cc87dae3ee3
@@ -25,10 +26,9 @@ require (
github.com/natefinch/npipe v0.0.0-20160621034901-c1b8fa8bdcce
github.com/omeid/go-yarn v0.0.1
github.com/pkg/errors v0.9.1 // indirect
- golang.org/x/sys v0.0.0-20210303074136-134d130e1a04
+ golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
- gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
)
diff --git a/src/go/go.sum b/src/go/go.sum
index 5959d1f6cde..f6ff11f256f 100644
--- a/src/go/go.sum
+++ b/src/go/go.sum
@@ -1,3 +1,5 @@
+git.zabbix.com/ap/plugin-support v0.0.2 h1:ce5LDuqEK4yYrD0g2BNWrSlnr33AVB3QT4G3wmjhDts=
+git.zabbix.com/ap/plugin-support v0.0.2/go.mod h1:R3QzQWgpxlA+ddJNkOhsPTcGOVtrR69WS0hXIsnBurY=
github.com/BurntSushi/locker v0.0.0-20171006230638-a6e239ea1c69 h1:+tu3HOoMXB7RXEINRVIpxJCT+KdYiI7LAEAUrOw3dIU=
github.com/BurntSushi/locker v0.0.0-20171006230638-a6e239ea1c69/go.mod h1:L1AbZdiDllfyYH5l5OkAaZtk7VkWe89bPJFmnDBNHxg=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
@@ -187,7 +189,6 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
@@ -206,11 +207,11 @@ golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210104204734-6f8348627aad h1:MCsdmFSdEd4UEa5TKS5JztCRHK/WtvNei1edOj5RSRo=
-golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210303074136-134d130e1a04 h1:cEhElsAv9LUt9ZUUocxzWe05oFLVd+AA2nstydTeI8g=
+golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng=
+golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
diff --git a/src/go/internal/agent/alias/alias_test.go b/src/go/internal/agent/alias/alias_test.go
index 97f4d455e37..f68e744f92f 100644
--- a/src/go/internal/agent/alias/alias_test.go
+++ b/src/go/internal/agent/alias/alias_test.go
@@ -22,9 +22,9 @@ package alias
import (
"testing"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/internal/agent"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/log"
)
func TestGetAlias(t *testing.T) {
diff --git a/src/go/internal/agent/keyaccess/key_access_rules.go b/src/go/internal/agent/keyaccess/key_access_rules.go
index da35581a864..38fe3004d73 100644
--- a/src/go/internal/agent/keyaccess/key_access_rules.go
+++ b/src/go/internal/agent/keyaccess/key_access_rules.go
@@ -25,9 +25,9 @@ import (
"math"
"sort"
- "zabbix.com/pkg/conf"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/log"
"zabbix.com/pkg/wildcard"
)
diff --git a/src/go/internal/agent/keyaccess/key_access_rules_test.go b/src/go/internal/agent/keyaccess/key_access_rules_test.go
index 5834a377dcf..100abc6c84b 100644
--- a/src/go/internal/agent/keyaccess/key_access_rules_test.go
+++ b/src/go/internal/agent/keyaccess/key_access_rules_test.go
@@ -25,7 +25,7 @@ package keyaccess
import (
"testing"
- "zabbix.com/pkg/conf"
+ "git.zabbix.com/ap/plugin-support/conf"
"zabbix.com/pkg/itemutil"
)
diff --git a/src/go/internal/agent/options.go b/src/go/internal/agent/options.go
index 399c15c4a2f..21825eb87e9 100644
--- a/src/go/internal/agent/options.go
+++ b/src/go/internal/agent/options.go
@@ -28,7 +28,7 @@ import (
"strings"
"unicode"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/tls"
)
diff --git a/src/go/internal/agent/plugin_agent.go b/src/go/internal/agent/plugin_agent.go
index 2b698686ab0..0592f6e8abe 100644
--- a/src/go/internal/agent/plugin_agent.go
+++ b/src/go/internal/agent/plugin_agent.go
@@ -25,8 +25,8 @@ import (
"time"
"unicode/utf8"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/version"
)
diff --git a/src/go/internal/agent/plugin_userparameter.go b/src/go/internal/agent/plugin_userparameter.go
index 5b9598079c6..510f9454ae8 100644
--- a/src/go/internal/agent/plugin_userparameter.go
+++ b/src/go/internal/agent/plugin_userparameter.go
@@ -26,8 +26,8 @@ import (
"time"
"unicode"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/zbxcmd"
)
diff --git a/src/go/internal/agent/plugin_userparameter_test.go b/src/go/internal/agent/plugin_userparameter_test.go
index 5911a4a834e..facb76357cf 100644
--- a/src/go/internal/agent/plugin_userparameter_test.go
+++ b/src/go/internal/agent/plugin_userparameter_test.go
@@ -3,7 +3,7 @@ package agent
import (
"testing"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type Input struct {
diff --git a/src/go/internal/agent/remotecontrol/remote_nix.go b/src/go/internal/agent/remotecontrol/remote_nix.go
index 9f49ad8ee05..aa41c9d6945 100644
--- a/src/go/internal/agent/remotecontrol/remote_nix.go
+++ b/src/go/internal/agent/remotecontrol/remote_nix.go
@@ -30,7 +30,7 @@ import (
"syscall"
"time"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/log"
)
func New(path string, timeout time.Duration) (conn *Conn, err error) {
diff --git a/src/go/internal/agent/remotecontrol/remote_windows.go b/src/go/internal/agent/remotecontrol/remote_windows.go
index e81f218520f..cfcd8b7a6f2 100644
--- a/src/go/internal/agent/remotecontrol/remote_windows.go
+++ b/src/go/internal/agent/remotecontrol/remote_windows.go
@@ -26,7 +26,7 @@ import (
"os"
"time"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/log"
"github.com/natefinch/npipe"
)
diff --git a/src/go/internal/agent/resultcache/diskcache.go b/src/go/internal/agent/resultcache/diskcache.go
index 4f13e0a125b..f1e87419368 100644
--- a/src/go/internal/agent/resultcache/diskcache.go
+++ b/src/go/internal/agent/resultcache/diskcache.go
@@ -28,11 +28,11 @@ import (
"sync/atomic"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
"zabbix.com/internal/monitor"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/version"
_ "github.com/mattn/go-sqlite3"
diff --git a/src/go/internal/agent/resultcache/memorycache.go b/src/go/internal/agent/resultcache/memorycache.go
index ce8049174c1..b603b91488f 100644
--- a/src/go/internal/agent/resultcache/memorycache.go
+++ b/src/go/internal/agent/resultcache/memorycache.go
@@ -25,11 +25,11 @@ import (
"sync/atomic"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
"zabbix.com/internal/monitor"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/version"
)
diff --git a/src/go/internal/agent/resultcache/resultcache.go b/src/go/internal/agent/resultcache/resultcache.go
index 712e455cc89..e99cad7f7e0 100644
--- a/src/go/internal/agent/resultcache/resultcache.go
+++ b/src/go/internal/agent/resultcache/resultcache.go
@@ -49,9 +49,9 @@ import (
"os"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
)
const (
diff --git a/src/go/internal/agent/resultcache/resultcache_test.go b/src/go/internal/agent/resultcache/resultcache_test.go
index 986427f8d6e..25dbe098387 100644
--- a/src/go/internal/agent/resultcache/resultcache_test.go
+++ b/src/go/internal/agent/resultcache/resultcache_test.go
@@ -25,9 +25,9 @@ import (
"testing"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
)
type mockWriter struct {
diff --git a/src/go/internal/agent/scheduler/client.go b/src/go/internal/agent/scheduler/client.go
index a958c237ce2..92c4641a037 100644
--- a/src/go/internal/agent/scheduler/client.go
+++ b/src/go/internal/agent/scheduler/client.go
@@ -27,10 +27,10 @@ import (
"time"
"unsafe"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
"zabbix.com/pkg/glexpr"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/zbxlib"
)
diff --git a/src/go/internal/agent/scheduler/manager.go b/src/go/internal/agent/scheduler/manager.go
index 47fc7cc399e..fce6572f379 100644
--- a/src/go/internal/agent/scheduler/manager.go
+++ b/src/go/internal/agent/scheduler/manager.go
@@ -27,15 +27,15 @@ import (
"sort"
"time"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
"zabbix.com/internal/agent/alias"
"zabbix.com/internal/agent/keyaccess"
"zabbix.com/internal/monitor"
- "zabbix.com/pkg/conf"
"zabbix.com/pkg/glexpr"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
"zabbix.com/plugins/external"
)
diff --git a/src/go/internal/agent/scheduler/manager_test.go b/src/go/internal/agent/scheduler/manager_test.go
index 305876e9943..ffc3ad162ac 100644
--- a/src/go/internal/agent/scheduler/manager_test.go
+++ b/src/go/internal/agent/scheduler/manager_test.go
@@ -27,12 +27,12 @@ import (
"testing"
"time"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
"zabbix.com/internal/agent/alias"
- "zabbix.com/pkg/conf"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
)
// getNextCheck calculates simplified nextcheck based on the specified delay string and current time
diff --git a/src/go/internal/agent/scheduler/plugin.go b/src/go/internal/agent/scheduler/plugin.go
index 83f99194a96..202dca8b2e5 100644
--- a/src/go/internal/agent/scheduler/plugin.go
+++ b/src/go/internal/agent/scheduler/plugin.go
@@ -22,7 +22,7 @@ package scheduler
import (
"container/heap"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// pluginAgent manages plugin usage
diff --git a/src/go/internal/agent/scheduler/query.go b/src/go/internal/agent/scheduler/query.go
index bf20d546220..935d78dcc73 100644
--- a/src/go/internal/agent/scheduler/query.go
+++ b/src/go/internal/agent/scheduler/query.go
@@ -25,7 +25,7 @@ import (
"sort"
"strings"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/plugins/external"
)
diff --git a/src/go/internal/agent/scheduler/task.go b/src/go/internal/agent/scheduler/task.go
index 2c812a07a0e..b50446084bb 100644
--- a/src/go/internal/agent/scheduler/task.go
+++ b/src/go/internal/agent/scheduler/task.go
@@ -25,10 +25,10 @@ import (
"reflect"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/zbxlib"
)
diff --git a/src/go/internal/agent/serverconnector/serverconnector.go b/src/go/internal/agent/serverconnector/serverconnector.go
index a0d2796d19b..4c1bb713601 100644
--- a/src/go/internal/agent/serverconnector/serverconnector.go
+++ b/src/go/internal/agent/serverconnector/serverconnector.go
@@ -29,13 +29,13 @@ import (
"time"
"unicode/utf8"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
"zabbix.com/internal/agent/resultcache"
"zabbix.com/internal/agent/scheduler"
"zabbix.com/internal/monitor"
"zabbix.com/pkg/glexpr"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/tls"
"zabbix.com/pkg/version"
"zabbix.com/pkg/zbxcomms"
diff --git a/src/go/internal/agent/serverlistener/passivecheck.go b/src/go/internal/agent/serverlistener/passivecheck.go
index 437d84bc799..6a8151d9c68 100644
--- a/src/go/internal/agent/serverlistener/passivecheck.go
+++ b/src/go/internal/agent/serverlistener/passivecheck.go
@@ -22,9 +22,9 @@ package serverlistener
import (
"time"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/internal/agent"
"zabbix.com/internal/agent/scheduler"
- "zabbix.com/pkg/log"
)
const notsupported = "ZBX_NOTSUPPORTED"
diff --git a/src/go/internal/agent/serverlistener/serverlistener.go b/src/go/internal/agent/serverlistener/serverlistener.go
index 739d4335215..ab6eb8c7706 100644
--- a/src/go/internal/agent/serverlistener/serverlistener.go
+++ b/src/go/internal/agent/serverlistener/serverlistener.go
@@ -25,10 +25,10 @@ import (
"strings"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/internal/agent"
"zabbix.com/internal/agent/scheduler"
"zabbix.com/internal/monitor"
- "zabbix.com/pkg/log"
"zabbix.com/pkg/tls"
"zabbix.com/pkg/zbxcomms"
"zabbix.com/pkg/zbxnet"
diff --git a/src/go/internal/agent/statuslistener/statuslistener.go b/src/go/internal/agent/statuslistener/statuslistener.go
index 4c43469bcf4..cb5f534ae0a 100644
--- a/src/go/internal/agent/statuslistener/statuslistener.go
+++ b/src/go/internal/agent/statuslistener/statuslistener.go
@@ -26,10 +26,10 @@ import (
"net/http"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/internal/agent"
"zabbix.com/internal/agent/scheduler"
"zabbix.com/internal/monitor"
- "zabbix.com/pkg/log"
"zabbix.com/pkg/version"
)
diff --git a/src/go/pkg/conf/conf.go b/src/go/pkg/conf/conf.go
deleted file mode 100644
index 5aa1a958590..00000000000
--- a/src/go/pkg/conf/conf.go
+++ /dev/null
@@ -1,726 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-// Package conf provides .conf file loading and unmarshalling
-package conf
-
-import (
- "bytes"
- "encoding/base64"
- "errors"
- "fmt"
- "os"
- "path/filepath"
- "reflect"
- "runtime"
- "strconv"
- "strings"
- "unicode/utf8"
-
- "zabbix.com/pkg/std"
-)
-
-// Meta structure is used to store the 'conf' tag metadata.
-type Meta struct {
- name string
- defaultValue *string
- optional bool
- min int64
- max int64
-}
-type Suffix struct {
- suffix string
- factor int
-}
-
-var currentConfigPath string
-
-// setCurrentConfigPath sets a path of the current config file.
-func setCurrentConfigPath(path string) {
- currentConfigPath = path
-}
-
-// GetCurrentConfigPath returns a path of the current config file.
-func GetCurrentConfigPath() string {
- return currentConfigPath
-}
-
-func validateParameterName(key []byte) (err error) {
- for i, b := range key {
- if ('A' > b || b > 'Z') && ('a' > b || b > 'z') && ('0' > b || b > '9') && b != '_' && b != '.' {
- return fmt.Errorf("invalid character '%c' at position %d", b, i+1)
- }
- }
- return
-}
-
-// parseLine parses parameter configuration line and returns key,value pair.
-// The line must have format: <key>[ ]=[ ]<value> where whitespace surrounding
-// '=' is optional.
-func parseLine(line []byte) (key []byte, value []byte, err error) {
- valueStart := bytes.IndexByte(line, '=')
- if valueStart == -1 {
- return nil, nil, errors.New("missing assignment operator")
- }
-
- if key = bytes.TrimSpace(line[:valueStart]); len(key) == 0 {
- return nil, nil, errors.New("missing variable name")
- }
-
- if err = validateParameterName(key); err != nil {
- return
- }
-
- return key, bytes.TrimSpace(line[valueStart+1:]), nil
-}
-
-// getMeta returns 'conf' tag metadata.
-// The metadata has format [name=<name>,][optional,][range=<range>,][default=<default value>]
-// where:
-// <name> - the parameter name,
-// optional - set if the value is optional,
-// <range> - the allowed range <min>:<max>, where <min>, <max> values are optional,
-// <default value> - the default value. If specified it must always be the last tag.
-func getMeta(field reflect.StructField) (meta *Meta, err error) {
- m := Meta{name: "", optional: false, min: -1, max: -1}
- conf := field.Tag.Get("conf")
-
-loop:
- for conf != "" {
- tags := strings.SplitN(conf, ",", 2)
- fields := strings.SplitN(tags[0], "=", 2)
- tag := strings.TrimSpace(fields[0])
- if len(fields) == 1 {
- // boolean tag
- switch tag {
- case "optional":
- m.optional = true
- default:
- return nil, fmt.Errorf("invalid conf tag '%s'", tag)
- }
- } else {
- // value tag
- switch tag {
- case "default":
- value := fields[1]
- if len(tags) == 2 {
- value += "," + tags[1]
- }
- m.defaultValue = &value
- break loop
- case "name":
- m.name = strings.TrimSpace(fields[1])
- case "range":
- limits := strings.Split(fields[1], ":")
- if len(limits) != 2 {
- return nil, errors.New("invalid range format")
- }
- if limits[0] != "" {
- m.min, _ = strconv.ParseInt(limits[0], 10, 64)
- }
- if limits[1] != "" {
- m.max, _ = strconv.ParseInt(limits[1], 10, 64)
- }
- default:
- return nil, fmt.Errorf("invalid conf tag '%s'", tag)
- }
- }
-
- if len(tags) == 1 {
- break
- }
- conf = tags[1]
- }
-
- if m.name == "" {
- m.name = field.Name
- }
- return &m, nil
-}
-
-func getTimeSuffix(str string) (string, int) {
- suffixes := []Suffix{
- Suffix{
- suffix: "s",
- factor: 1,
- },
- Suffix{
- suffix: "m",
- factor: 60,
- },
- Suffix{
- suffix: "h",
- factor: 3600,
- },
- Suffix{
- suffix: "d",
- factor: 86400,
- },
- Suffix{
- suffix: "w",
- factor: (7 * 86400),
- },
- }
-
- for _, s := range suffixes {
- if strings.HasSuffix(str, s.suffix) == true {
- str = strings.TrimSuffix(str, s.suffix)
- return str, s.factor
- }
- }
- return str, 1
-
-}
-
-func setBasicValue(value reflect.Value, meta *Meta, str *string) (err error) {
- if str == nil {
- return nil
- }
- switch value.Type().Kind() {
- case reflect.String:
- value.SetString(*str)
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- var v int64
- var r int
- *str, r = getTimeSuffix(*str)
- if v, err = strconv.ParseInt(*str, 10, 64); err == nil {
- v = v * int64(r)
- if meta != nil {
- if meta.min != -1 && v < meta.min || meta.max != -1 && v > meta.max {
- return errors.New("value out of range")
- }
- }
- value.SetInt(v)
- }
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- var v uint64
- var r int
- *str, r = getTimeSuffix(*str)
- if v, err = strconv.ParseUint(*str, 10, 64); err == nil {
- v = v * uint64(r)
- if meta != nil {
- if meta.min != -1 && v < uint64(meta.min) || meta.max != -1 && v > uint64(meta.max) {
- return errors.New("value out of range")
- }
- }
- value.SetUint(v)
- }
- case reflect.Float32, reflect.Float64:
- var v float64
- if v, err = strconv.ParseFloat(*str, 64); err == nil {
- if meta != nil {
- if meta.min != -1 && v < float64(meta.min) || meta.max != -1 && v > float64(meta.max) {
- return errors.New("value out of range")
- }
- }
- value.SetFloat(v)
- }
- case reflect.Bool:
- var v bool
- switch *str {
- case "true":
- v = true
- case "false":
- v = false
- default:
- return errors.New("invalid boolean value")
- }
- value.SetBool(v)
- case reflect.Ptr:
- v := reflect.New(value.Type().Elem())
- value.Set(v)
- return setBasicValue(v.Elem(), meta, str)
- default:
- err = fmt.Errorf("unsupported variable type %v", value.Type().Kind())
- }
- return err
-}
-
-func setStructValue(value reflect.Value, node *Node) (err error) {
- rt := value.Type()
- for i := 0; i < rt.NumField(); i++ {
- var meta *Meta
- if meta, err = getMeta(rt.Field(i)); err != nil {
- return
- }
- child := node.get(meta.name)
- if child != nil || meta.defaultValue != nil {
- if err = setValue(value.Field(i), meta, child); err != nil {
- return
- }
- } else if !meta.optional {
- return fmt.Errorf("cannot find mandatory parameter %s", meta.name)
- }
- }
- return
-}
-
-func setMapValue(value reflect.Value, node *Node) (err error) {
- m := reflect.MakeMap(reflect.MapOf(value.Type().Key(), value.Type().Elem()))
- for _, v := range node.Nodes {
- if child, ok := v.(*Node); ok {
- k := reflect.New(value.Type().Key())
- if err = setBasicValue(k.Elem(), nil, &child.Name); err != nil {
- return
- }
- v := reflect.New(value.Type().Elem())
- if err = setValue(v.Elem(), nil, child); err != nil {
- return
- }
- m.SetMapIndex(k.Elem(), v.Elem())
- }
- }
- value.Set(m)
- return
-}
-
-func setSliceValue(value reflect.Value, node *Node) (err error) {
- tmpValues := make([][]byte, 0)
- for _, v := range node.Nodes {
- if val, ok := v.(*Value); ok {
- tmpValues = append(tmpValues, val.Value)
- }
- }
- size := len(tmpValues)
- values := reflect.MakeSlice(reflect.SliceOf(value.Type().Elem()), 0, size)
-
- if len(tmpValues) > 0 {
- for _, data := range tmpValues {
- v := reflect.New(value.Type().Elem())
- str := string(data)
- if err = setBasicValue(v.Elem(), nil, &str); err != nil {
- return
- }
- values = reflect.Append(values, v.Elem())
- }
- } else {
- for _, n := range node.Nodes {
- if child, ok := n.(*Node); ok {
- v := reflect.New(value.Type().Elem())
- if err = setValue(v.Elem(), nil, child); err != nil {
- return
- }
- values = reflect.Append(values, v.Elem())
- }
- }
- }
- value.Set(values)
- return
-}
-
-func setValue(value reflect.Value, meta *Meta, node *Node) (err error) {
- var str *string
- if node != nil {
- node.used = true
- }
- switch value.Type().Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
- reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
- reflect.Float32, reflect.Float64, reflect.Bool, reflect.String:
- if str, err = node.getValue(meta); err == nil {
- if err = setBasicValue(value, meta, str); err != nil {
- return node.newError("%s", err.Error())
- }
- }
- case reflect.Struct:
- if node != nil {
- return setStructValue(value, node)
- }
- case reflect.Map:
- if node != nil {
- return setMapValue(value, node)
- }
- case reflect.Slice:
- if node != nil {
- return setSliceValue(value, node)
- }
- case reflect.Ptr:
- v := reflect.New(value.Type().Elem())
- value.Set(v)
- return setValue(v.Elem(), meta, node)
- case reflect.Interface:
- value.Set(reflect.ValueOf(node))
- node.markUsed(true)
- }
-
- return nil
-}
-
-// assignValues assigns parsed nodes to the specified structure
-func assignValues(v interface{}, root *Node) (err error) {
- rv := reflect.ValueOf(v)
-
- switch rv.Type().Kind() {
- case reflect.Ptr:
- rv = rv.Elem()
- default:
- return errors.New("output variable must be a pointer to a structure")
- }
-
- switch rv.Type().Kind() {
- case reflect.Struct:
- if err = setStructValue(rv, root); err != nil {
- return err
- }
- default:
- return errors.New("output variable must be a pointer to a structure")
- }
- return root.checkUsage()
-}
-
-func newIncludeError(root *Node, filename *string, errmsg string) (err error) {
- if root.includeFail {
- return errors.New(errmsg)
- }
- root.includeFail = true
- if filename != nil {
- return fmt.Errorf(`cannot include "%s": %s`, *filename, errmsg)
- }
- return fmt.Errorf(`cannot load file: %s`, errmsg)
-}
-
-func hasMeta(path string) bool {
- var metaChars string
- if runtime.GOOS != "windows" {
- metaChars = `*?[\`
- } else {
- metaChars = `*?[`
- }
- return strings.ContainsAny(path, metaChars)
-}
-
-func loadInclude(root *Node, path string) (err error) {
- path = filepath.Clean(path)
- if err := checkGlobPattern(path); err != nil {
- return newIncludeError(root, &path, err.Error())
- }
-
- absPath, err := filepath.Abs(path)
- if err != nil {
- return newIncludeError(root, &path, err.Error())
- }
-
- // If a path is relative, pad it with a directory of the current config file
- if path != absPath {
- confDir := filepath.Dir(GetCurrentConfigPath())
- path = filepath.Join(confDir, path)
- }
-
- if hasMeta(filepath.Dir(path)) {
- return newIncludeError(root, &path, "glob pattern is supported only in file names")
- }
- if !hasMeta(path) {
- var fi os.FileInfo
- if fi, err = stdOs.Stat(path); err != nil {
- return newIncludeError(root, &path, err.Error())
- }
- if fi.IsDir() {
- path = filepath.Join(path, "*")
- }
- } else {
- var fi os.FileInfo
- if fi, err = stdOs.Stat(filepath.Dir(path)); err != nil {
- return newIncludeError(root, &path, err.Error())
- }
- if !fi.IsDir() {
- return newIncludeError(root, &path, "base path is not a directory")
- }
- }
-
- var paths []string
- if hasMeta(path) {
- if paths, err = filepath.Glob(path); err != nil {
- return newIncludeError(root, nil, err.Error())
- }
- } else {
- paths = append(paths, path)
- }
-
- for _, path := range paths {
- // skip directories
- var fi os.FileInfo
- if fi, err = stdOs.Stat(path); err != nil {
- return newIncludeError(root, &path, err.Error())
- }
- if fi.IsDir() {
- continue
- }
-
- var file std.File
- if file, err = stdOs.Open(path); err != nil {
- return newIncludeError(root, &path, err.Error())
- }
- defer file.Close()
-
- buf := bytes.Buffer{}
- if _, err = buf.ReadFrom(file); err != nil {
- return newIncludeError(root, &path, err.Error())
- }
-
- if err = parseConfig(root, buf.Bytes()); err != nil {
- return newIncludeError(root, &path, err.Error())
- }
- }
- return
-}
-
-func checkGlobPattern(path string) error {
- if strings.HasPrefix(path, "*") {
- return errors.New("path should be absolute")
- }
-
- var isGlob, hasSepLeft, hasSepRight bool
-
- for _, p := range path {
- switch p {
- case '*':
- isGlob = true
- case filepath.Separator:
- switch isGlob {
- case true:
- hasSepRight = true
- case false:
- hasSepLeft = true
- }
- }
- }
-
- if (isGlob && !hasSepLeft && hasSepRight) || (isGlob && !hasSepLeft && !hasSepRight) {
- return errors.New("path should be absolute")
- }
-
- return nil
-}
-
-func parseConfig(root *Node, data []byte) (err error) {
- const maxStringLen = 2048
- var line []byte
-
- root.level++
-
- for offset, end, num := 0, 0, 1; end != -1; offset, num = offset+end+1, num+1 {
- if end = bytes.IndexByte(data[offset:], '\n'); end != -1 {
- line = bytes.TrimSpace(data[offset : offset+end])
- } else {
- line = bytes.TrimSpace(data[offset:])
- }
-
- if len(line) > maxStringLen {
- return fmt.Errorf("cannot parse configuration at line %d: limit of %d bytes is exceeded", num, maxStringLen)
- }
-
- if len(line) == 0 || line[0] == '#' {
- continue
- }
-
- if !utf8.ValidString(string(line)) {
- return fmt.Errorf("cannot parse configuration at line %d: not a valid UTF-8 character found", num)
- }
-
- var key, value []byte
- if key, value, err = parseLine(line); err != nil {
- return fmt.Errorf("cannot parse configuration at line %d: %s", num, err.Error())
- }
-
- if string(key) == "Include" {
- if root.level == 10 {
- return fmt.Errorf("include depth exceeded limits")
- }
- if err = loadInclude(root, string(value)); err != nil {
- return
- }
- } else {
- root.add(key, value, num)
- }
- }
- root.level--
- return nil
-}
-
-func addObject(parent *Node, v interface{}) error {
- if attr, ok := v.(map[string]interface{}); ok {
- if _, ok := attr["Nodes"]; ok {
- node := &Node{}
- if err := setObjectNode(node, attr); err != nil {
- return err
- }
- parent.Nodes = append(parent.Nodes, node)
- } else {
- value := &Value{}
- if err := setObjectValue(value, attr); err != nil {
- return err
- }
- parent.Nodes = append(parent.Nodes, value)
- }
- } else {
- return fmt.Errorf("invalid object type %T", v)
- }
- return nil
-}
-
-func setObjectValue(value *Value, attr map[string]interface{}) error {
- var line float64
- var ok bool
- if line, ok = attr["Line"].(float64); !ok {
- return fmt.Errorf("invalid line attribute type %T", attr["Line"])
- }
- value.Line = int(line)
-
- var err error
- var data string
- if data, ok = attr["Value"].(string); !ok {
- return fmt.Errorf("invalid value type %T", attr["Value"])
- }
-
- if value.Value, err = base64.StdEncoding.DecodeString(data); err != nil {
- return err
- }
-
- return nil
-}
-
-func setObjectNode(node *Node, attr map[string]interface{}) error {
- var line float64
- var ok bool
-
- if line, ok = attr["Line"].(float64); !ok {
- return fmt.Errorf("invalid line attribute type %T", attr["Line"])
- }
- node.Line = int(line)
-
- if node.Name, ok = attr["Name"].(string); !ok {
- return fmt.Errorf("invalid node name type %T", attr["Name"])
- }
-
- var nodes []interface{}
- if nodes, ok = attr["Nodes"].([]interface{}); !ok {
- return fmt.Errorf("invalid node children type %T", attr["u"])
- }
-
- for _, a := range nodes {
- if err := addObject(node, a); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// Unmarshal unmarshals input data into specified structure. The input data can be either
-// a byte array ([]byte) with configuration file or interface{} either returned by Marshal
-// or a configuration file Unmarshaled into interface{} variable before.
-// The third is optional 'strict' parameter that forces strict validation of configuration
-// and structure fields (enabled by default). When disabled it will unmarshal part of
-// configuration into incomplete target structures.
-func Unmarshal(data interface{}, v interface{}, args ...interface{}) (err error) {
- rv := reflect.ValueOf(v)
- if rv.Kind() != reflect.Ptr || rv.IsNil() {
- return errors.New("Invalid output parameter")
- }
-
- strict := true
- if len(args) > 0 {
- var ok bool
- if strict, ok = args[0].(bool); !ok {
- return errors.New("Invalid mode parameter")
- }
- }
-
- var root *Node
- switch u := data.(type) {
- case nil:
- root = &Node{
- Name: "",
- used: false,
- Nodes: make([]interface{}, 0),
- parent: nil,
- Line: 0}
- case []byte:
- root = &Node{
- Name: "",
- used: false,
- Nodes: make([]interface{}, 0),
- parent: nil,
- Line: 0}
-
- if err = parseConfig(root, u); err != nil {
- return fmt.Errorf("Cannot read configuration: %s", err.Error())
- }
- case *Node:
- root = u
- root.markUsed(false)
- case map[string]interface{}: // JSON unmarshaling result
- root = &Node{}
- if err = setObjectNode(root, u); err != nil {
- return fmt.Errorf("Cannot unmarshal JSON data: %s", err)
- }
- default:
- return fmt.Errorf("Invalid input parameter of type %T", u)
- }
-
- if !strict {
- root.markUsed(true)
- }
-
- if err = assignValues(v, root); err != nil {
- return fmt.Errorf("Cannot assign configuration: %s", err.Error())
- }
-
- return nil
-}
-
-func Load(filename string, v interface{}) (err error) {
- var file std.File
-
- if file, err = stdOs.Open(filename); err != nil {
- return fmt.Errorf(`cannot open configuration file: %s`, err.Error())
- }
- defer file.Close()
-
- buf := bytes.Buffer{}
- if _, err = buf.ReadFrom(file); err != nil {
- return fmt.Errorf("cannot load configuration: %s", err.Error())
- }
-
- setCurrentConfigPath(filename)
-
- return Unmarshal(buf.Bytes(), v)
-}
-
-func LoadUserParams(v interface{}) (err error) {
- var file std.File
-
- if file, err = stdOs.Open(currentConfigPath); err != nil {
- return fmt.Errorf(`cannot open configuration file: %s`, err.Error())
- }
- defer file.Close()
-
- buf := bytes.Buffer{}
- if _, err = buf.ReadFrom(file); err != nil {
- return fmt.Errorf("cannot load configuration: %s", err.Error())
- }
-
- return Unmarshal(buf.Bytes(), v, false)
-}
-
-var stdOs std.Os
-
-func init() {
- stdOs = std.NewOs()
-}
diff --git a/src/go/pkg/conf/conf_test.go b/src/go/pkg/conf/conf_test.go
deleted file mode 100644
index aaf19e94c4b..00000000000
--- a/src/go/pkg/conf/conf_test.go
+++ /dev/null
@@ -1,597 +0,0 @@
-//go:build linux && amd64
-// +build linux,amd64
-
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package conf
-
-import (
- "encoding/json"
- "fmt"
- "reflect"
- "sort"
- "strings"
- "testing"
-
- "zabbix.com/pkg/std"
-)
-
-func TestParserErrors(t *testing.T) {
- type Options struct {
- Test string `conf:"name=Te$t,optional"`
- Range string `conf:"optional,range="`
- }
-
- var input = []string{
- "abc",
- "abc =",
- " = abc",
- "Test = value",
- "Te$t = value",
- "Range=1",
- }
-
- for _, data := range input {
- var options Options
- if err := Unmarshal([]byte(data), &options); err != nil {
- t.Logf("Returned error: %s", err.Error())
- } else {
- t.Errorf("Successfully parsed conf: %s", data)
- }
- }
-}
-
-func TestParserSuccess(t *testing.T) {
- type Options struct {
- Text string `conf:"optional"`
- }
-
- var input = []string{
- "Text=1",
- " Text = 2 ",
- "Text = 3\nText=4",
- "# comments\nText=5",
- " # comments\nText=6",
- " \nText=7",
- "Text=8=9",
- "Text=",
- "Text=9\n#",
- "Text=10\n",
- "\n Text = 11 \n",
- "\n#####Text=x\nText=12",
- }
-
- var output = []Options{
- {Text: "1"},
- {Text: "2"},
- {Text: "4"},
- {Text: "5"},
- {Text: "6"},
- {Text: "7"},
- {Text: "8=9"},
- {Text: ""},
- {Text: "9"},
- {Text: "10"},
- {Text: "11"},
- {Text: "12"},
- }
-
- for i, data := range input {
- var options Options
- if err := Unmarshal([]byte(data), &options); err != nil {
- t.Logf("[%d] returned error: %s", i, err.Error())
- t.Fail()
- }
- if options.Text != output[i].Text {
- t.Errorf("[%d] expected %s while got %s\n", i, output[i].Text, options.Text)
- }
- }
-}
-
-func TestUtf8(t *testing.T) {
- type Options struct {
- Text string `conf:"optional"`
- }
-
- var input = []string{
- "Text=\xFE",
- "Text\xFE=2",
- }
-
- for i, data := range input {
- var options Options
- if err := Unmarshal([]byte(data), &options); err == nil {
- t.Errorf("[%d] expected error while got success\n", i)
- }
- }
-}
-
-func TestParserRangeErrors(t *testing.T) {
- type Options struct {
- Value int `conf:"range=-10:10"`
- }
-
- var input = []string{
- `Value=-11`,
- `Value=-10.5`,
- `Value=10.5`,
- `Value=11`,
- }
-
- for i, data := range input {
- var options Options
- if err := Unmarshal([]byte(data), &options); err != nil {
- t.Logf("Returned error: %s", err.Error())
- } else {
- t.Errorf("[%d] expected error while got success", i)
- }
- }
-}
-
-func TestParserExistanceErrors(t *testing.T) {
- type Options struct {
- Text string
- Value int
- }
-
- var input = []string{
- `Value=1`,
- `Value=1
- Text=1
- None=1`,
- }
-
- for i, data := range input {
- var options Options
- if err := Unmarshal([]byte(data), &options); err != nil {
- t.Logf("Returned error: %s", err.Error())
- } else {
- t.Errorf("[%d] expected error while got %+v", i, options)
- }
- }
-}
-
-func checkUnmarshal(t *testing.T, data []byte, expected interface{}, options interface{}) {
- if err := Unmarshal([]byte(data), options); err != nil {
- t.Errorf("Expected success while got error: %s", err.Error())
- }
- if !reflect.DeepEqual(options, expected) {
- t.Errorf("Expected %+v while got %+v", expected, options)
- }
-}
-
-func TestNestedPointer(t *testing.T) {
- type Options struct {
- Pointer ***int
- }
- input := `Pointer = 42`
-
- value := 42
- pvalue := &value
- ppvalue := &pvalue
- var options Options
- var expected Options = Options{&ppvalue}
- checkUnmarshal(t, []byte(input), &expected, &options)
-}
-
-func TestArray(t *testing.T) {
- type Options struct {
- Values []int `conf:"name=Value"`
- }
- input := `
- Value = 1
- Value = 2
- Value = 3`
-
- var options Options
- var expected Options = Options{[]int{1, 2, 3}}
- checkUnmarshal(t, []byte(input), &expected, &options)
-}
-
-func TestNestedArray(t *testing.T) {
- type Options struct {
- Values [][]int `conf:"name=Value"`
- }
- input := `
- Value.1 = 1
- Value.1 = 2
- Value.2 = 3
- Value.2 = 4
- Value.3 = 5
- Value.3 = 6`
-
- var options Options
- var expected Options = Options{[][]int{[]int{1, 2}, []int{3, 4}, []int{5, 6}}}
- checkUnmarshal(t, []byte(input), &expected, &options)
-}
-
-func TestOptional(t *testing.T) {
- type Options struct {
- Text *string `conf:"optional"`
- }
- input := ``
-
- var options Options
- var expected Options = Options{nil}
- checkUnmarshal(t, []byte(input), &expected, &options)
-}
-
-func TestDefault(t *testing.T) {
- type Options struct {
- Text string `conf:"default=Default, \"value\""`
- }
- input := ``
-
- var options Options
- var expected Options = Options{`Default, "value"`}
- checkUnmarshal(t, []byte(input), &expected, &options)
-}
-
-func TestMap(t *testing.T) {
- type Options struct {
- Index map[string]uint64
- }
- input := `
- Index.apple = 9
- Index.orange = 7
- Index.banana = 3
- `
-
- var options Options
- var expected Options = Options{map[string]uint64{"apple": 9, "orange": 7, "banana": 3}}
- checkUnmarshal(t, []byte(input), &expected, &options)
-}
-
-func TestStructMap(t *testing.T) {
- type Object struct {
- Id uint64
- Description string
- }
- type Options struct {
- Index map[string]Object
- }
- input := `
- Index.apple.Id = 9
- Index.apple.Description = An apple
- Index.orange.Id = 7
- Index.orange.Description = An orange
- Index.banana.Id = 3
- Index.banana.Description = A banana
- `
-
- var options Options
- var expected Options = Options{map[string]Object{
- "apple": Object{9, "An apple"},
- "orange": Object{7, "An orange"},
- "banana": Object{3, "A banana"}}}
- checkUnmarshal(t, []byte(input), &expected, &options)
-}
-
-func TestStructPtrMap(t *testing.T) {
- type Object struct {
- Id uint64
- Description string
- }
- type Options struct {
- Index map[string]*Object
- }
- input := `
- Index.apple.Id = 9
- Index.apple.Description = An apple
- Index.orange.Id = 7
- Index.orange.Description = An orange
- Index.banana.Id = 3
- Index.banana.Description = A banana
- `
-
- objects := []Object{Object{9, "An apple"}, Object{7, "An orange"}, Object{3, "A banana"}}
- var options Options
- var expected Options = Options{map[string]*Object{
- "apple": &objects[0],
- "orange": &objects[1],
- "banana": &objects[2]}}
- checkUnmarshal(t, []byte(input), &expected, &options)
-}
-
-func TestNestedStruct(t *testing.T) {
- type Object struct {
- Id uint64
- Name string
- }
- type Options struct {
- Chair Object
- Desk Object
- }
- input := `
- Chair.Id = 1
- Chair.Name = a chair
- Desk.Id = 2
- Desk.Name = a desk
- `
-
- var options Options
- var expected Options = Options{Object{1, "a chair"}, Object{2, "a desk"}}
- checkUnmarshal(t, []byte(input), &expected, &options)
-}
-
-func TestInclude(t *testing.T) {
- stdOs = std.NewMockOs()
- stdOs.(std.MockOs).MockFile("/tmp/array10.conf", []byte("Value=10\nValue=20"))
- stdOs.(std.MockOs).MockFile("/tmp/array100.conf", []byte("Value=100\nValue=200"))
-
- type Options struct {
- Values []int `conf:"name=Value"`
- }
- input := `
- Value = 1
- Include = /tmp/array10.conf
- Value = 2
- Include = /tmp/array100.conf
- Value = 3
- `
-
- var options Options
- var expected Options = Options{[]int{1, 10, 20, 2, 100, 200, 3}}
- checkUnmarshal(t, []byte(input), &expected, &options)
-}
-
-func TestRecursiveInclude(t *testing.T) {
- stdOs = std.NewMockOs()
- stdOs.(std.MockOs).MockFile("/tmp/array10.conf", []byte("Value=10\nValue=20\nInclude = /tmp/array10.conf"))
-
- type Options struct {
- Values []int `conf:"name=Value"`
- }
- input := `
- Value = 1
- Include = /tmp/array10.conf
- Value = 2
- `
-
- var options Options
- if err := Unmarshal([]byte(input), &options); err != nil {
- if !strings.Contains(err.Error(), "include depth exceeded limits") {
- t.Errorf("Expected recursion error message while got: %s", err.Error())
- }
- } else {
- t.Errorf("Expected error while got success")
- }
-}
-
-func TestEmptyOptional(t *testing.T) {
- type Options struct {
- Text *string `conf:"optional"`
- }
-
- var options Options
- var expected Options = Options{nil}
- checkUnmarshal(t, nil, &expected, &options)
-}
-
-func TestEmptyMandatory(t *testing.T) {
- type Options struct {
- Text *string
- }
- var options Options
-
- if err := Unmarshal(nil, &options); err == nil {
- t.Errorf("Expected error while got success")
- }
-}
-
-func TestInterface(t *testing.T) {
- type Options struct {
- LogFile string
- LogLevel int
- Timeout int
- Plugins map[string]interface{}
- }
-
- type RedisSession struct {
- Address string
- Port int `conf:"default=10001"`
- }
- type RedisOptions struct {
- Enable int
- Sessions map[string]RedisSession
- }
-
- input := `
- LogFile = /tmp/log
- LogLevel = 3
- Timeout = 10
- Plugins.Log.MaxLinesPerSecond = 25
- Plugins.Redis.Enable = 1
- Plugins.Redis.Sessions.Server1.Address = 127.0.0.1
- Plugins.Redis.Sessions.Server2.Address = 127.0.0.2
- Plugins.Redis.Sessions.Server2.Port = 10002
- Plugins.Redis.Sessions.Server3.Address = 127.0.0.3
- Plugins.Redis.Sessions.Server3.Port = 10003
- `
-
- var o Options
- if err := Unmarshal([]byte(input), &o); err != nil {
- t.Errorf("Failed unmarshaling options: %s", err)
- }
-
- var returnedOpts RedisOptions
- _ = Unmarshal(o.Plugins["Redis"], &returnedOpts)
-
- expectedOpts := RedisOptions{
- Enable: 1,
- Sessions: map[string]RedisSession{
- "Server1": RedisSession{"127.0.0.1", 10001},
- "Server2": RedisSession{"127.0.0.2", 10002},
- "Server3": RedisSession{"127.0.0.3", 10003},
- },
- }
-
- if !reflect.DeepEqual(expectedOpts, returnedOpts) {
- t.Errorf("Expected %+v while got %+v", expectedOpts, returnedOpts)
- }
-}
-
-func TestRawAccess(t *testing.T) {
- type Options struct {
- LogFile string
- LogLevel int
- Timeout int
- AllowKey interface{} `conf:"optional"`
- DenyKey interface{} `conf:"optional"`
- }
-
- input := `
- LogFile = /tmp/log
- LogLevel = 3
- Timeout = 10
- AllowKey=system.localtime
- DenyKey=*
- AllowKey=vfs.*[*]
- `
- var o Options
- if err := Unmarshal([]byte(input), &o); err != nil {
- t.Errorf("Failed unmarshaling options: %s", err)
- }
-
- values := make([]*Value, 0)
- if node, ok := o.AllowKey.(*Node); ok {
- for _, v := range node.Nodes {
- if value, ok := v.(*Value); ok {
- value.Value = []byte(fmt.Sprintf("%s: %s", node.Name, string(value.Value)))
- values = append(values, value)
- }
- }
- }
- if node, ok := o.DenyKey.(*Node); ok {
- for _, v := range node.Nodes {
- if value, ok := v.(*Value); ok {
- value.Value = []byte(fmt.Sprintf("%s: %s", node.Name, string(value.Value)))
- values = append(values, value)
- }
- }
- }
-
- sort.SliceStable(values, func(i, j int) bool {
- return values[i].Line < values[j].Line
- })
-
- var returnedOpts []string
-
- for _, value := range values {
- returnedOpts = append(returnedOpts, string(value.Value))
- }
-
- expectedOpts := []string{
- "AllowKey: system.localtime",
- "DenyKey: *",
- "AllowKey: vfs.*[*]",
- }
-
- if !reflect.DeepEqual(expectedOpts, returnedOpts) {
- t.Errorf("Expected '%+v' while got '%+v'", expectedOpts, returnedOpts)
- }
-}
-
-func Test_checkGlobPattern(t *testing.T) {
- type args struct {
- path string
- }
- tests := []struct {
- name string
- args args
- wantErr bool
- }{
- {"+no_glob", args{"/foo/bar"}, false},
- {"+glob", args{"/foo/bar/*.conf"}, false},
- {"+glob_only", args{"/foo/bar/*"}, false},
- {"+glob_in_name", args{"/foo/bar/foo*bar.conf"}, false},
- {"+relative_name_with_glob", args{"./foo*bar"}, false},
- {"+empty", args{""}, false},
- {"-name_only_with_glob", args{"foo*bar"}, true},
- {"-name_start_glob", args{"*bar"}, true},
- {"-invalid_prefix", args{"*/foo/bar"}, true},
- {"-invalid_string", args{"*"}, true},
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- if err := checkGlobPattern(tt.args.path); (err != nil) != tt.wantErr {
- t.Errorf("checkGlobPattern() error = %v, wantErr %v", err, tt.wantErr)
- }
- })
- }
-}
-
-func Test_jsonMarshaling(t *testing.T) {
- type Options struct {
- LogFile string
- LogLevel int
- Timeout int
- Plugins map[string]interface{}
- }
-
- type RedisSession struct {
- Address string
- Port int `conf:"default=10001"`
- }
- type RedisOptions struct {
- Enable int
- Sessions map[string]RedisSession
- }
-
- input := `
- LogFile = /tmp/log
- LogLevel = 3
- Timeout = 10
- Plugins.Log.MaxLinesPerSecond = 25
- Plugins.Redis.Enable = 1
- Plugins.Redis.Sessions.Server1.Address = 127.0.0.1
- Plugins.Redis.Sessions.Server2.Address = 127.0.0.2
- Plugins.Redis.Sessions.Server2.Port = 10002
- Plugins.Redis.Sessions.Server3.Address = 127.0.0.3
- Plugins.Redis.Sessions.Server3.Port = 10003
- `
-
- var o Options
- if err := Unmarshal([]byte(input), &o); err != nil {
- t.Errorf("Failed unmarshaling options: %s", err)
- }
-
- dataOut, _ := json.Marshal(o.Plugins["Redis"])
- var dataIn map[string]interface{}
- _ = json.Unmarshal(dataOut, &dataIn)
-
- var returnedOpts RedisOptions
- if err := Unmarshal(dataIn, &returnedOpts); err != nil {
- t.Error(err)
- }
-
- expectedOpts := RedisOptions{
- Enable: 1,
- Sessions: map[string]RedisSession{
- "Server1": {"127.0.0.1", 10001},
- "Server2": {"127.0.0.2", 10002},
- "Server3": {"127.0.0.3", 10003},
- },
- }
-
- if !reflect.DeepEqual(expectedOpts, returnedOpts) {
- t.Errorf("Expected %+v while got %+v", expectedOpts, returnedOpts)
- }
-}
diff --git a/src/go/pkg/conf/node.go b/src/go/pkg/conf/node.go
deleted file mode 100644
index 29bd18a61d9..00000000000
--- a/src/go/pkg/conf/node.go
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-// Package conf provides .conf file loading and unmarshalling
-package conf
-
-import (
- "bytes"
- "fmt"
-)
-
-// Node structure is used to store parsed conf file parameters or parameter components.
-type Node struct {
- Name string
- Nodes []interface{}
- Line int
-
- used bool
- parent *Node
- level int
- includeFail bool
-}
-
-type Value struct {
- Value []byte
- Line int
-}
-
-// get returns child node by name
-func (n *Node) get(name string) (node *Node) {
- for _, v := range n.Nodes {
- if child, ok := v.(*Node); ok && child.Name == name {
- return child
- }
- }
- return nil
-}
-
-// add appends new child node
-func (n *Node) add(name []byte, value []byte, lineNum int) {
- var node *Node
- var key string
-
- split := bytes.IndexByte(name, '.')
- if split == -1 {
- key = string(name)
- } else {
- key = string(name[:split])
- }
-
- if node = n.get(key); node == nil {
- node = &Node{
- Name: string(key),
- used: false,
- Nodes: make([]interface{}, 0),
- parent: n,
- Line: lineNum}
- n.Nodes = append(n.Nodes, node)
- }
-
- if split != -1 {
- node.add(name[split+1:], value, lineNum)
- } else {
- node.Nodes = append(node.Nodes, &Value{Value: value, Line: lineNum})
- }
-}
-
-// checkUsage checks if all conf nodes were recognized.
-// This is done by recursively checking 'used' flag for all nodes.
-func (n *Node) checkUsage() (err error) {
- for _, v := range n.Nodes {
- if child, ok := v.(*Node); ok {
- if !child.used {
- return child.newError("unknown parameter")
- }
- if err = child.checkUsage(); err != nil {
- return
- }
- }
- }
- return
-}
-
-// markUsed marks node and its children as used
-func (n *Node) markUsed(used bool) {
- n.used = used
- for _, v := range n.Nodes {
- if child, ok := v.(*Node); ok {
- child.markUsed(used)
- }
- }
-}
-
-// getValue returns node value or meta data default value or nil if
-// metadata 'optional' tag is set. Otherwise error is returned.
-func (n *Node) getValue(meta *Meta) (value *string, err error) {
- if n != nil {
- var tmp string
- for _, v := range n.Nodes {
- if val, ok := v.(*Value); ok {
- tmp = string(val.Value)
- }
- value = &tmp
- }
- }
-
- if value == nil && meta != nil {
- if meta.defaultValue != nil {
- value = meta.defaultValue
- } else if meta.optional {
- return
- } else {
- return nil, fmt.Errorf("cannot find mandatory parameter %s", meta.name)
- }
- }
- return
-}
-
-// newNodeError creates error based on the specified node. The error message will
-// have full node name (parameter name up to the node, including it) and the line
-// number where parameter was defined.
-func (n *Node) newError(format string, a ...interface{}) (err error) {
- if n == nil {
- return fmt.Errorf(format, a...)
- }
- var name string
- for parent := n; parent.parent != nil; parent = parent.parent {
- if name == "" {
- name = parent.Name
- } else {
- name = parent.Name + "." + name
- }
- }
- desc := fmt.Sprintf(format, a...)
- return fmt.Errorf("invalid parameter %s at line %d: %s", name, n.Line, desc)
-}
diff --git a/src/go/pkg/conf/session.go b/src/go/pkg/conf/session.go
deleted file mode 100644
index e4fe53ea6de..00000000000
--- a/src/go/pkg/conf/session.go
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-// Package conf provides .conf file loading and unmarshalling
-package conf
-
-// Session is a general structure for storing sessions' configuration.
-type Session struct {
- URI string `conf:"name=Uri,optional"`
- Password string `conf:"optional"`
- User string `conf:"optional"`
-}
diff --git a/src/go/pkg/itemutil/value.go b/src/go/pkg/itemutil/value.go
index 57e3b289cbf..bf3653cf7d6 100644
--- a/src/go/pkg/itemutil/value.go
+++ b/src/go/pkg/itemutil/value.go
@@ -24,7 +24,7 @@ import (
"strconv"
"time"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
const StateNotSupported = 1
diff --git a/src/go/pkg/log/log.go b/src/go/pkg/log/log.go
deleted file mode 100644
index 39250fae1d6..00000000000
--- a/src/go/pkg/log/log.go
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package log
-
-import (
- "bytes"
- "errors"
- "fmt"
- "log"
- "os"
- "path/filepath"
- "runtime"
- "runtime/debug"
- "sync"
-)
-
-const Info = 0
-const Crit = 1
-const Err = 2
-const Warning = 3
-const Debug = 4
-const Trace = 5
-
-const None = -1
-
-const Undefined = 0
-const System = 1
-const File = 2
-const Console = 3
-
-const MB = 1048576
-
-//DefaultLogger is the default Zabbix agent 2 and Zabbix web service logger.
-var DefaultLogger *log.Logger
-
-var logLevel int
-
-type LogStat struct {
- logType int
- filename string
- filesize int64
- f *os.File
- currentSize int64
-}
-
-var logStat LogStat
-var logAccess sync.Mutex
-
-func CheckLogLevel(level int) bool {
- if level > logLevel {
- return false
- }
- return true
-}
-
-func Level() string {
- switch logLevel {
- case None:
- return "none"
- case Info:
- return "info"
- case Crit:
- return "critical"
- case Err:
- return "error"
- case Warning:
- return "warning"
- case Debug:
- return "debug"
- case Trace:
- return "trace"
- default:
- return "unknown"
- }
-}
-
-func IncreaseLogLevel() (success bool) {
- if logLevel != Trace {
- logLevel++
- return true
- }
- return false
-}
-
-func DecreaseLogLevel() (success bool) {
- if logLevel != Info {
- logLevel--
- return true
- }
- return false
-}
-
-// Open sets a new logger based on the log type and a new log output level
-func Open(logType int, level int, filename string, filesize int) error {
- logStat.logType = logType
- logStat.filename = filename
- logStat.filesize = int64(filesize) * MB
- var err error
-
- switch logType {
- case System:
- err = createSyslog()
- if err != nil {
- return err
- }
- case Console:
- DefaultLogger = log.New(os.Stdout, "", log.Lmicroseconds|log.Ldate)
- case File:
- logStat.f, err = os.OpenFile(filename, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
- if err != nil {
- return err
- }
- DefaultLogger = log.New(logStat.f, "", log.Lmicroseconds|log.Ldate)
- default:
- return errors.New("invalid argument")
- }
-
- logLevel = level
- return nil
-}
-
-func Infof(format string, args ...interface{}) {
- if CheckLogLevel(Info) {
- procLog(format, args, Info)
- }
-}
-
-func Critf(format string, args ...interface{}) {
- if CheckLogLevel(Crit) {
- procLog(format, args, Crit)
- }
-}
-
-func Errf(format string, args ...interface{}) {
- if CheckLogLevel(Err) {
- procLog(format, args, Err)
- }
-}
-
-func Warningf(format string, args ...interface{}) {
- if CheckLogLevel(Warning) {
- procLog(format, args, Warning)
- }
-}
-
-func Tracef(format string, args ...interface{}) {
- if CheckLogLevel(Trace) {
- procLog(format, args, Trace)
- }
-}
-
-func Debugf(format string, args ...interface{}) {
- if CheckLogLevel(Debug) {
- procLog(format, args, Debug)
- }
-}
-
-func procLog(format string, args []interface{}, level int) {
- if logStat.logType == System {
- procSysLog(format, args, level)
- return
- }
-
- logAccess.Lock()
- defer logAccess.Unlock()
- rotateLog()
- DefaultLogger.Printf(format, args...)
-}
-
-func rotateLog() {
- if logStat.logType == File {
- fstat, err := os.Stat(logStat.filename)
- if err != nil || fstat.Size() == 0 || logStat.currentSize > fstat.Size() {
-
- logStat.f.Close()
-
- if logStat.f, err = os.OpenFile(logStat.filename, os.O_CREATE|os.O_WRONLY, 0644); err != nil {
- logStat.logType = Undefined
- log.Fatal(fmt.Sprintf("Cannot open log file %s", logStat.filename))
- }
-
- DefaultLogger = log.New(logStat.f, "", log.Lmicroseconds|log.Ldate)
- logStat.currentSize = 0
- return
- }
-
- if logStat.filesize != 0 {
- var printError string
-
- logStat.currentSize = fstat.Size()
-
- if logStat.currentSize > logStat.filesize {
- filenameOld := logStat.filename + ".old"
- logStat.f.Close()
- os.Remove(filenameOld)
-
- err = os.Rename(logStat.filename, filenameOld)
- if err != nil {
- printError = err.Error()
- }
-
- logStat.f, err = os.OpenFile(logStat.filename, os.O_CREATE|os.O_WRONLY, 0644)
- if err != nil {
- errmsg := fmt.Sprintf("Cannot open log file %s", logStat.filename)
- if printError != "" {
- errmsg = fmt.Sprintf("%s and cannot rename it: %s", errmsg, printError)
- }
- logStat.logType = Undefined
- log.Fatal(errmsg)
- }
-
- DefaultLogger = log.New(logStat.f, "", log.Lmicroseconds|log.Ldate)
- if printError != "" {
- DefaultLogger.Printf("cannot rename log file \"%s\" to \"%s\":%s\n",
- logStat.filename, filenameOld, printError)
- DefaultLogger.Printf("Logfile \"%s\" size reached configured limit LogFileSize but"+
- " moving it to \"%s\" failed. The logfile was truncated.",
- logStat.filename, filenameOld)
- }
- }
- }
- }
-}
-
-func PanicHook() {
- if r := recover(); r != nil {
- if logStat.logType != Undefined {
- data := debug.Stack()
- Critf("Critical failure: %v", r)
- var tail int
- for offset, end, num := 0, 0, 1; end != -1; offset, num = offset+end+1, num+1 {
- end = bytes.IndexByte(data[offset:], '\n')
- if end != -1 {
- tail = offset + end
- } else {
- tail = len(data)
- }
- Critf("%s", string(data[offset:tail]))
- }
- }
- panic(r)
- }
-}
-
-func Caller() (name string) {
- pc := make([]uintptr, 2)
- n := runtime.Callers(2, pc)
- frames := runtime.CallersFrames(pc[:n])
- if frame, ok := frames.Next(); ok {
- return filepath.Base(frame.Func.Name())
- }
- return ""
-}
diff --git a/src/go/pkg/log/log_nix.go b/src/go/pkg/log/log_nix.go
deleted file mode 100644
index 80aa5b0ba03..00000000000
--- a/src/go/pkg/log/log_nix.go
+++ /dev/null
@@ -1,51 +0,0 @@
-//go:build !windows
-// +build !windows
-
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package log
-
-import (
- "fmt"
- "log/syslog"
-)
-
-var syslogWriter *syslog.Writer
-
-func createSyslog() (err error) {
- syslogWriter, err = syslog.New(syslog.LOG_WARNING|syslog.LOG_DAEMON, "zabbix_agent2")
- return
-}
-
-func procSysLog(format string, args []interface{}, level int) {
- switch level {
- case Info:
- syslogWriter.Info(fmt.Sprintf(format, args...))
- case Crit:
- syslogWriter.Crit(fmt.Sprintf(format, args...))
- case Err:
- syslogWriter.Err(fmt.Sprintf(format, args...))
- case Warning:
- syslogWriter.Warning(fmt.Sprintf(format, args...))
- case Debug, Trace:
- syslogWriter.Debug(fmt.Sprintf(format, args...))
- }
- return
-}
diff --git a/src/go/pkg/log/log_windows.go b/src/go/pkg/log/log_windows.go
deleted file mode 100644
index 8512ebb6377..00000000000
--- a/src/go/pkg/log/log_windows.go
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package log
-
-import (
- "errors"
-)
-
-func createSyslog() error {
- return errors.New("system log is not supported on Windows")
-}
-
-func procSysLog(format string, args []interface{}, level int) {
- return
-}
diff --git a/src/go/pkg/log/logger.go b/src/go/pkg/log/logger.go
deleted file mode 100644
index 778c696a0eb..00000000000
--- a/src/go/pkg/log/logger.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package log
-
-import "fmt"
-
-type Logger interface {
- Tracef(format string, args ...interface{})
- Debugf(format string, args ...interface{})
- Warningf(format string, args ...interface{})
- Infof(format string, args ...interface{})
- Errf(format string, args ...interface{})
- Critf(format string, args ...interface{})
-}
-
-type loggerImpl struct {
- prefix string
-}
-
-func New(module string) Logger {
- var prefix string
- if module != "" {
- prefix = fmt.Sprintf("[%s] ", module)
- }
- return &loggerImpl{prefix: prefix}
-}
-
-func (l *loggerImpl) Critf(format string, args ...interface{}) {
- Critf(l.prefix+format, args...)
-}
-
-func (l *loggerImpl) Infof(format string, args ...interface{}) {
- Infof(l.prefix+format, args...)
-}
-
-func (l *loggerImpl) Warningf(format string, args ...interface{}) {
- Warningf(l.prefix+format, args...)
-}
-
-func (l *loggerImpl) Tracef(format string, args ...interface{}) {
- Tracef(l.prefix+format, args...)
-}
-
-func (l *loggerImpl) Debugf(format string, args ...interface{}) {
- Debugf(l.prefix+format, args...)
-}
-
-func (l *loggerImpl) Errf(format string, args ...interface{}) {
- Errf(l.prefix+format, args...)
-}
diff --git a/src/go/pkg/metric/metric.go b/src/go/pkg/metric/metric.go
deleted file mode 100644
index 68deafbc140..00000000000
--- a/src/go/pkg/metric/metric.go
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-// Package metric provides an interface for describing a schema of metric's parameters.
-package metric
-
-import (
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "unicode"
-
- "zabbix.com/pkg/zbxerr"
-)
-
-type paramKind int
-
-const (
- kindSession paramKind = iota
- kindConn
- kindGeneral
- kindSessionOnly
-)
-
-const (
- required = true
- optional = false
-)
-
-// Param stores parameters' metadata.
-type Param struct {
- name string
- description string
- kind paramKind
- required bool
- validator Validator
- defaultValue *string
-}
-
-func ucFirst(str string) string {
- for i, v := range str {
- return string(unicode.ToUpper(v)) + str[i+1:]
- }
-
- return ""
-}
-
-func newParam(name, description string, kind paramKind, required bool, validator Validator) *Param {
- name = strings.TrimSpace(name)
- if len(name) == 0 {
- panic("parameter name cannot be empty")
- }
-
- description = ucFirst(strings.TrimSpace(description))
- if len(description) == 0 {
- panic("parameter description cannot be empty")
- }
-
- if description[len(description)-1:] != "." {
- description += "."
- }
-
- return &Param{
- name: name,
- description: description,
- kind: kind,
- required: required,
- validator: validator,
- defaultValue: nil,
- }
-}
-
-// NewParam creates a new parameter with given name and validator.
-// Returns a pointer.
-func NewParam(name, description string) *Param {
- return newParam(name, description, kindGeneral, optional, nil)
-}
-
-// NewConnParam creates a new connection parameter with given name and validator.
-// Returns a pointer.
-func NewConnParam(name, description string) *Param {
- return newParam(name, description, kindConn, optional, nil)
-}
-
-// NewSessionParam creates a new connection parameter with given name and validator.
-// Returns a pointer.
-func NewSessionOnlyParam(name, description string) *Param {
- return newParam(name, description, kindSessionOnly, optional, nil)
-}
-
-// WithSession transforms a connection typed parameter to a dual purpose parameter which can be either
-// a connection parameter or session name.
-// Returns a pointer.
-func (p *Param) WithSession() *Param {
- if p.kind != kindConn {
- panic("only connection typed parameter can be transformed to session")
- }
-
- p.kind = kindSession
-
- return p
-}
-
-// WithDefault sets the default value for a parameter.
-// It panics if a default value is specified for a required parameter.
-func (p *Param) WithDefault(value string) *Param {
- if p.required {
- panic("default value cannot be applied to a required parameter")
- }
-
- p.defaultValue = &value
-
- return p
-}
-
-// WithValidator sets a validator for a parameter
-func (p *Param) WithValidator(validator Validator) *Param {
- if validator == nil {
- panic("validator cannot be nil")
- }
-
- p.validator = validator
-
- if p.defaultValue != nil {
- if err := p.validator.Validate(p.defaultValue); err != nil {
- panic(fmt.Sprintf("invalid default value %q for parameter %q: %s",
- *p.defaultValue, p.name, err.Error()))
- }
- }
-
- return p
-}
-
-// SetRequired makes the parameter mandatory.
-// It panics if default value is specified for required parameter.
-func (p *Param) SetRequired() *Param {
- if p.defaultValue != nil {
- panic("required parameter cannot have a default value")
- }
-
- p.required = required
-
- return p
-}
-
-// Metric stores a description of a metric and its parameters.
-type Metric struct {
- description string
- params []*Param
- varParam bool
-}
-
-// ordinalize convert a given number to an ordinal numeral.
-func ordinalize(num int) string {
- var ordinals = map[int]string{
- 1: "first",
- 2: "second",
- 3: "third",
- 4: "fourth",
- 5: "fifth",
- 6: "sixth",
- 7: "seventh",
- 8: "eighth",
- 9: "ninth",
- 10: "tenth",
- }
-
- if num >= 1 && num <= 10 {
- return ordinals[num]
- }
-
- suffix := "th"
- switch num % 10 {
- case 1:
- if num%100 != 11 {
- suffix = "st"
- }
- case 2:
- if num%100 != 12 {
- suffix = "nd"
- }
- case 3:
- if num%100 != 13 {
- suffix = "rd"
- }
- }
-
- return strconv.Itoa(num) + suffix
-}
-
-// New creates an instance of a Metric and returns a pointer to it.
-// It panics if a metric is not satisfied to one of the following rules:
-// 1. Parameters must be named (and names must be unique).
-// 2. It's forbidden to duplicate parameters' names.
-// 3. Session must be placed first.
-// 4. Connection parameters must be placed in a row.
-func New(description string, params []*Param, varParam bool) *Metric {
- connParamIdx := -1
-
- description = ucFirst(strings.TrimSpace(description))
- if len(description) == 0 {
- panic("metric description cannot be empty")
- }
-
- if description[len(description)-1:] != "." {
- description += "."
- }
-
- if params == nil {
- params = []*Param{}
- }
-
- if len(params) > 0 {
- if params[0].kind != kindGeneral {
- connParamIdx = 0
- }
- }
-
- paramsMap := make(map[string]bool)
-
- for i, p := range params {
- if _, exists := paramsMap[p.name]; exists {
- panic(fmt.Sprintf("name of parameter %q must be unique", p.name))
- }
-
- paramsMap[p.name] = true
-
- if i > 0 && p.kind == kindSession {
- panic("session must be placed first")
- }
-
- if p.kind == kindConn {
- if i-connParamIdx > 1 {
- panic("parameters describing a connection must be placed in a row")
- }
-
- connParamIdx = i
- }
- }
-
- return &Metric{
- description: description,
- params: params,
- varParam: varParam,
- }
-}
-
-func findSession(name string, sessions interface{}) (session interface{}) {
- v := reflect.ValueOf(sessions)
- if v.Kind() != reflect.Map {
- panic("sessions must be map of strings")
- }
-
- for _, key := range v.MapKeys() {
- if name == key.String() {
- session = v.MapIndex(key).Interface()
- break
- }
- }
-
- return
-}
-
-func mergeWithSessionData(out map[string]string, metricParams []*Param, session interface{}) error {
- v := reflect.ValueOf(session)
- for i := 0; i < v.NumField(); i++ {
- var p *Param = nil
-
- val := v.Field(i).String()
-
- j := 0
- for j = range metricParams {
- if metricParams[j].name == v.Type().Field(i).Name {
- p = metricParams[j]
- break
- }
- }
-
- ordNum := ordinalize(j + 1)
-
- if p == nil {
- panic(fmt.Sprintf("cannot find parameter %q in schema", v.Type().Field(i).Name))
- }
-
- if val == "" {
- if p.required {
- return zbxerr.ErrorTooFewParameters.Wrap(
- fmt.Errorf("%s parameter %q is required", ordNum, p.name))
- }
-
- if p.defaultValue != nil {
- val = *p.defaultValue
- }
- }
-
- if p.validator != nil {
- if err := p.validator.Validate(&val); err != nil {
- return zbxerr.New(fmt.Sprintf("invalid %s parameter %q", ordNum, p.name)).Wrap(err)
- }
- }
-
- out[p.name] = val
- }
-
- return nil
-}
-
-// EvalParams returns a mapping of parameters' names to their values passed to a plugin and/or
-// sessions specified in the configuration file and extra remaining parameters.
-// If a session is configured, then an other connection parameters must not be accepted and an error will be returned.
-// Also it returns error in following cases:
-// * incorrect number of parameters are passed;
-// * missing required parameter;
-// * value validation is failed.
-func (m *Metric) EvalParams(rawParams []string, sessions interface{}) (params map[string]string, extraParams []string,
- err error) {
- session, err := m.parseRawParams(rawParams, sessions)
- if err != nil {
- return
- }
-
- params = make(map[string]string)
-
- var i int
- for _, p := range m.params {
- kind := p.kind
- if kind == kindSession {
- if session != nil {
- i++
-
- continue
- }
-
- kind = kindConn
- } else if kind == kindSessionOnly {
- continue
- }
-
- var val *string
- skipConnIfSessionIsSet := !(session != nil && kind == kindConn)
- ordNum := ordinalize(i + 1)
-
- if i >= len(rawParams) || rawParams[i] == "" {
- if p.required && skipConnIfSessionIsSet {
- return nil, nil, zbxerr.ErrorTooFewParameters.Wrap(
- fmt.Errorf("%s parameter %q is required", ordNum, p.name))
- }
-
- if p.defaultValue != nil && skipConnIfSessionIsSet {
- val = p.defaultValue
- }
- } else {
- val = &rawParams[i]
- }
-
- i++
-
- if val == nil {
- continue
- }
-
- if p.validator != nil && skipConnIfSessionIsSet {
- if err = p.validator.Validate(val); err != nil {
- return nil, nil, zbxerr.New(fmt.Sprintf("invalid %s parameter %q", ordNum, p.name)).Wrap(err)
- }
- }
-
- if kind == kindConn {
- if session == nil {
- params[p.name] = *val
- } else {
- return nil, nil, zbxerr.ErrorInvalidParams.Wrap(
- fmt.Errorf("%s parameter %q cannot be passed along with session", ordNum, p.name))
- }
- }
-
- if kind == kindGeneral {
- params[p.name] = *val
- }
- }
-
- // Fill connection parameters with data from a session
- if session != nil {
- if err = mergeWithSessionData(params, m.params, session); err != nil {
- return nil, nil, err
- }
-
- params["sessionName"] = rawParams[0]
- }
-
- if i < len(rawParams) {
- extraParams = rawParams[i:]
- }
-
- return params, extraParams, nil
-}
-
-func (m *Metric) parseRawParams(rawParams []string, sessions interface{}) (interface{}, error) {
- var nonsessionParams int
-
- for _, p := range m.params {
- if p.kind != kindSessionOnly {
- nonsessionParams++
- }
- }
-
- if !m.varParam && len(rawParams) > nonsessionParams {
- return nil, zbxerr.ErrorTooManyParameters
- }
-
- if len(rawParams) > 0 && m.params[0].kind == kindSession {
- return findSession(rawParams[0], sessions), nil
- }
-
- return nil, nil
-}
-
-// MetricSet stores a mapping of keys to metrics.
-type MetricSet map[string]*Metric
-
-// List returns an array of metrics' keys and their descriptions suitable to pass to plugin.RegisterMetrics.
-func (ml MetricSet) List() (list []string) {
- for key, metric := range ml {
- list = append(list, key, metric.description)
- }
-
- return
-}
diff --git a/src/go/pkg/metric/metric_test.go b/src/go/pkg/metric/metric_test.go
deleted file mode 100644
index 3a4c683fe6c..00000000000
--- a/src/go/pkg/metric/metric_test.go
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package metric
-
-import (
- "reflect"
- "testing"
-
- "zabbix.com/pkg/conf"
-)
-
-var (
- paramURI = NewConnParam("URI", "Description.").WithDefault("localhost:1521").WithSession()
- paramUsername = NewConnParam("User", "Description.").WithDefault("")
- paramRequiredUsername = NewConnParam("User", "Description.").SetRequired()
- paramUserValidation = NewConnParam("User", "Description.").WithDefault("").WithValidator(
- SetValidator{Set: []string{"", "supervisor", "admin", "guest"}})
- paramPassword = NewConnParam("Password", "Description.").WithDefault("")
- paramGeneral = NewParam("GeneralParam", "Description.")
-)
-
-var metricSet = MetricSet{
- "metric.foo": New("Foo description.",
- []*Param{paramURI, paramUsername, paramPassword,
- NewParam("Param1", "Description.").WithDefault("60").WithValidator(SetValidator{Set: []string{"15", "60"}}),
- }, false),
- "metric.bar": New("bar description.",
- []*Param{paramURI, paramUsername, NewSessionOnlyParam("Password", "Description.")}, true),
- "metric.bar.strict": New("bar description.",
- []*Param{paramURI, paramUsername, paramPassword,
- NewSessionOnlyParam("Param1", "Description.").SetRequired(),
- }, false),
- "metric.query": New("Query description.",
- []*Param{paramURI, paramUsername, paramPassword,
- NewParam("QueryName", "Description.").SetRequired(),
- }, true),
- "metric.requiredSessionParam": New("RequiredSessionParam description.",
- []*Param{paramURI, paramRequiredUsername, paramPassword}, false),
- "metric.withoutPassword": New("WithoutPassword description.",
- []*Param{paramURI, paramUsername}, false),
- "metric.userValidation": New("UserValidation description.",
- []*Param{paramURI, paramUserValidation, paramPassword}, false),
-}
-
-func TestMetric_EvalParams(t *testing.T) {
- type args struct {
- rawParams []string
- sessions interface{}
- }
- tests := []struct {
- name string
- m *Metric
- args args
- want map[string]string
- wantExtra []string
- wantErr bool
- wantPanic bool
- }{
- {
- name: "Must fail if too many parameters passed",
- m: metricSet["metric.foo"],
- args: args{
- rawParams: []string{"localhost", "user", "password", "15", "excessParam"},
- sessions: map[string]conf.Session{},
- },
- want: nil,
- wantErr: true,
- wantPanic: false,
- },
- {
- name: "Must not fail if passed more parameters than described, but the metric has the varParam enabled",
- m: metricSet["metric.query"],
- args: args{
- rawParams: []string{"localhost", "user", "password", "queryName", "queryParam1", "queryParam2"},
- sessions: map[string]conf.Session{},
- },
- want: map[string]string{"Password": "password", "QueryName": "queryName", "URI": "localhost", "User": "user"},
- wantExtra: []string{"queryParam1", "queryParam2"},
- wantErr: false,
- wantPanic: false,
- },
- {
- name: "Must not fail if passed more parameters than described, " +
- "but the metric has the varParam enabled (with session)",
- m: metricSet["metric.query"],
- args: args{
- rawParams: []string{"Session1", "", "", "queryName", "queryParam1", "queryParam2"},
- sessions: map[string]conf.Session{
- "Session1": {URI: "localhost", User: "user", Password: "password"},
- },
- },
- want: map[string]string{
- "Password": "password", "QueryName": "queryName", "URI": "localhost", "User": "user", "sessionName": "Session1",
- },
- wantExtra: []string{"queryParam1", "queryParam2"},
- wantErr: false,
- wantPanic: false,
- },
- {
- name: "Must not fail if passed session only parameters none strict",
- m: metricSet["metric.bar"],
- args: args{
- rawParams: []string{"Session1", "", "queryParam1"},
- sessions: map[string]conf.Session{
- "Session1": {URI: "localhost", User: "user", Password: "password"},
- },
- },
- want: map[string]string{
- "Password": "password", "URI": "localhost", "User": "user", "sessionName": "Session1",
- },
- wantExtra: []string{"queryParam1"},
- wantErr: false,
- wantPanic: false,
- },
- {
- name: "Must not fail if missing session only parameters none strict",
- m: metricSet["metric.bar"],
- args: args{
- rawParams: []string{"Session1", "", "queryParam1"},
- sessions: map[string]conf.Session{
- "Session1": {URI: "localhost", User: "user"},
- },
- },
- want: map[string]string{
- "Password": "", "URI": "localhost", "User": "user", "sessionName": "Session1",
- },
- wantExtra: []string{"queryParam1"},
- wantErr: false,
- wantPanic: false,
- },
- {
- name: "Must not fail if passed session only parameters none strict",
- m: metricSet["metric.bar"],
- args: args{
- rawParams: []string{"Session1", "", "queryParam1"},
- sessions: map[string]conf.Session{
- "Session1": {URI: "localhost", User: "user", Password: "password"},
- },
- },
- want: map[string]string{
- "Password": "password", "URI": "localhost", "User": "user", "sessionName": "Session1",
- },
- wantExtra: []string{"queryParam1"},
- wantErr: false,
- wantPanic: false,
- },
- {
- name: "Must fail if missing session only parameters with strict required",
- m: metricSet["metric.bar.strict"],
- args: args{
- rawParams: []string{"Session1", "", "queryParam1"},
- sessions: map[string]conf.Session{
- "Session1": {URI: "localhost", User: "user"},
- },
- },
- want: nil,
- wantExtra: nil,
- wantErr: true,
- wantPanic: false,
- },
- {
- name: "Must fail if session only parameter passed in key",
- m: metricSet["metric.bar.strict"],
- args: args{
- rawParams: []string{"localhost", "user", "password", "param1"},
- sessions: map[string]conf.Session{},
- },
- want: nil,
- wantExtra: nil,
- wantErr: true,
- wantPanic: false,
- },
- {
- name: "Must fail if a required parameter is not specified",
- m: metricSet["metric.query"],
- args: args{
- rawParams: []string{"localhost", "user", "password", "", "queryParam1"},
- sessions: map[string]conf.Session{},
- },
- want: nil,
- wantErr: true,
- wantPanic: false,
- },
- {
- name: "Must fail if validation failed",
- m: metricSet["metric.foo"],
- args: args{
- rawParams: []string{"localhost", "user", "password", "wrongValue"},
- sessions: map[string]conf.Session{},
- },
- want: nil,
- wantErr: true,
- wantPanic: false,
- },
- {
- name: "Must fail if a session parameter did not pass validation",
- m: metricSet["metric.userValidation"],
- args: args{
- rawParams: []string{"Session1"},
- sessions: map[string]conf.Session{
- "Session1": {URI: "localhost", User: "bob", Password: "password"},
- },
- },
- want: nil,
- wantErr: true,
- wantPanic: false,
- },
- {
- name: "Must fail if a connection parameter passed along with a session",
- m: metricSet["metric.foo"],
- args: args{
- rawParams: []string{"Session1", "", "password"},
- sessions: map[string]conf.Session{
- "Session1": {URI: "localhost", User: "user", Password: "password"},
- },
- },
- want: nil,
- wantErr: true,
- wantPanic: false,
- },
- {
- name: "Must fail if a required parameter is omitted in a session",
- m: metricSet["metric.requiredSessionParam"],
- args: args{
- rawParams: []string{"Session1"},
- sessions: map[string]conf.Session{
- "Session1": {URI: "localhost", Password: "password"},
- },
- },
- want: nil,
- wantErr: true,
- wantPanic: false,
- },
- {
- name: "Must panic if cannot find any session's parameter in a schema",
- m: metricSet["metric.withoutPassword"],
- args: args{
- rawParams: []string{"Session1"},
- sessions: map[string]conf.Session{
- "Session1": {URI: "localhost", User: "user", Password: "password"},
- },
- },
- want: nil,
- wantErr: false,
- wantPanic: true,
- },
- {
- name: "Must successfully return parsed parameters (without session)",
- m: metricSet["metric.foo"],
- args: args{
- rawParams: []string{"localhost", "user", "password", "15"},
- sessions: map[string]conf.Session{},
- },
- want: map[string]string{"URI": "localhost", "User": "user", "Password": "password", "Param1": "15"},
- wantErr: false,
- wantPanic: false,
- },
- {
- name: "Must successfully return parsed parameters (with session)",
- m: metricSet["metric.foo"],
- args: args{
- rawParams: []string{"Session1", "", "", "15"},
- sessions: map[string]conf.Session{
- "Session1": {URI: "localhost", User: "user", Password: "password"},
- },
- },
- want: map[string]string{
- "URI": "localhost", "User": "user", "Password": "password", "Param1": "15", "sessionName": "Session1",
- },
- wantErr: false,
- wantPanic: false,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- if tt.wantPanic {
- defer func() {
- if r := recover(); r == nil {
- t.Error("Metric.EvalParams() must panic with runtime error")
- }
- }()
- }
-
- gotParams, gotExtraParams, err := tt.m.EvalParams(tt.args.rawParams, tt.args.sessions)
- if (err != nil) != tt.wantErr {
- t.Errorf("EvalParams() error = %v, wantErr %v", err, tt.wantErr)
- return
- }
- if !reflect.DeepEqual(gotParams, tt.want) {
- t.Errorf("EvalParams() got = %v, want %v", gotParams, tt.want)
- }
- if !reflect.DeepEqual(gotExtraParams, tt.wantExtra) {
- t.Errorf("EvalParams() got extraParams = %v, want %v", gotExtraParams, tt.wantExtra)
- }
- })
- }
-}
-
-func TestNew(t *testing.T) {
- type args struct {
- description string
- params []*Param
- varParam bool
- }
- tests := []struct {
- name string
- args args
- want *Metric
- wantPanic bool
- }{
- {
- name: "Must fail if a parameter has a non-unique name",
- args: args{
- "Metric description.",
- []*Param{paramURI, paramUsername, paramUsername, paramPassword, NewParam("Param", "Description.")},
- false,
- },
- want: nil,
- wantPanic: true,
- },
- {
- name: "Must fail if a session placed not first",
- args: args{
- "Metric description.",
- []*Param{paramUsername, paramPassword, paramURI, NewParam("Param", "Description.")},
- false,
- },
- want: nil,
- wantPanic: true,
- },
- {
- name: "Must fail if parameters describing a connection placed not in a row",
- args: args{
- "Metric description.",
- []*Param{paramURI, paramUsername, NewParam("Param", "Description."), paramPassword},
- false,
- },
- want: nil,
- wantPanic: true,
- },
- {
- name: "Must successfully return a new metric",
- args: args{
- "Metric description.",
- []*Param{paramURI, paramUsername, paramPassword, paramGeneral},
- false,
- },
- want: &Metric{
- "Metric description.",
- []*Param{paramURI, paramUsername, paramPassword, paramGeneral},
- false,
- },
- wantPanic: false,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- if tt.wantPanic {
- defer func() {
- if r := recover(); r == nil {
- t.Error("New() must panic with runtime error")
- }
- }()
- }
-
- if got := New(tt.args.description, tt.args.params, tt.args.varParam); !reflect.DeepEqual(got, tt.want) {
- t.Errorf("New() = %v, want %v", got, tt.want)
- }
- })
- }
-}
diff --git a/src/go/pkg/metric/validators.go b/src/go/pkg/metric/validators.go
deleted file mode 100644
index c40acdf41ba..00000000000
--- a/src/go/pkg/metric/validators.go
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-// Package metric provides an interface for describing a schema of metric's parameters.
-package metric
-
-import (
- "fmt"
- "regexp"
- "strconv"
- "strings"
-)
-
-type Validator interface {
- Validate(value *string) error
-}
-
-type SetValidator struct {
- Set []string
- CaseInsensitive bool
-}
-
-func (v SetValidator) Validate(value *string) error {
- if v.Set != nil && len(v.Set) == 0 {
- panic("set cannot be empty")
- }
-
- if value == nil {
- return nil
- }
-
- for _, s := range v.Set {
- if (v.CaseInsensitive && strings.ToLower(*value) == strings.ToLower(s)) || (!v.CaseInsensitive && *value == s) {
- return nil
- }
- }
-
- return fmt.Errorf("allowed values: %s", strings.Join(v.Set, ", "))
-}
-
-type PatternValidator struct {
- Pattern string
-}
-
-func (v PatternValidator) Validate(value *string) error {
- if value == nil {
- return nil
- }
-
- b, err := regexp.MatchString(v.Pattern, *value)
- if err != nil {
- return err
- }
-
- if !b {
- return fmt.Errorf("value does not match pattern %q", v.Pattern)
- }
-
- return nil
-}
-
-type LenValidator struct {
- Min *int
- Max *int
-}
-
-func (v LenValidator) Validate(value *string) error {
- if value == nil || (v.Min == nil && v.Max == nil) {
- return nil
- }
-
- if v.Min != nil && len(*value) < *v.Min {
- return fmt.Errorf("value cannot be shorter than %d characters", v.Min)
- }
-
- if v.Max != nil && len(*value) > *v.Max {
- return fmt.Errorf("value cannot be longer than %d characters", v.Max)
- }
-
- return nil
-}
-
-type RangeValidator struct {
- Min int
- Max int
-}
-
-func (v RangeValidator) Validate(value *string) error {
- if value == nil {
- return nil
- }
-
- intVal, err := strconv.Atoi(*value)
- if err != nil {
- return err
- }
-
- if intVal < v.Min || intVal > v.Max {
- return fmt.Errorf("value is out of range [%d..%d]", v.Min, v.Max)
- }
-
- return nil
-}
-
-type NumberValidator struct{}
-
-func (v NumberValidator) Validate(value *string) error {
- if value == nil {
- return nil
- }
-
- _, err := strconv.Atoi(*value)
-
- return err
-}
diff --git a/src/go/pkg/metric/validators_test.go b/src/go/pkg/metric/validators_test.go
deleted file mode 100644
index bf9d078b7fb..00000000000
--- a/src/go/pkg/metric/validators_test.go
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package metric
-
-import "testing"
-
-var (
- number = "42"
- notNumber = "foo"
-)
-
-func TestNumberValidator_Validate(t *testing.T) {
- type args struct {
- value *string
- }
- tests := []struct {
- name string
- args args
- wantErr bool
- }{
- {
- name: "Must successfully validate a number",
- args: args{&number},
- wantErr: false,
- },
- {
- name: "Must successfully validate nil",
- args: args{nil},
- wantErr: false,
- },
- {
- name: "Must fail if a given value is not a number",
- args: args{&notNumber},
- wantErr: true,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- v := NumberValidator{}
- if err := v.Validate(tt.args.value); (err != nil) != tt.wantErr {
- t.Errorf("Validate() error = %v, wantErr %v", err, tt.wantErr)
- }
- })
- }
-}
-
-var (
- string1 = "hello123"
- string2 = "hello world"
-)
-
-func TestPatternValidator_Validate(t *testing.T) {
- type fields struct {
- Pattern string
- }
- type args struct {
- value *string
- }
- tests := []struct {
- name string
- fields fields
- args args
- wantErr bool
- }{
- {
- name: "Must successfully validate a string value",
- fields: fields{"^hello[0-9]+$"},
- args: args{&string1},
- wantErr: false,
- },
- {
- name: "Must successfully validate nil",
- args: args{nil},
- wantErr: false,
- },
- {
- name: "Must fail if a given value does not match a given pattern",
- fields: fields{"^hello[0-9]+$"},
- args: args{&string2},
- wantErr: true,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- v := PatternValidator{
- Pattern: tt.fields.Pattern,
- }
- if err := v.Validate(tt.args.value); (err != nil) != tt.wantErr {
- t.Errorf("Validate() error = %v, wantErr %v", err, tt.wantErr)
- }
- })
- }
-}
-
-var (
- valInRange = "50"
- valNotInRange = "1000"
-)
-
-func TestRangeValidator_Validate(t *testing.T) {
- type fields struct {
- Min int
- Max int
- }
- type args struct {
- value *string
- }
- tests := []struct {
- name string
- fields fields
- args args
- wantErr bool
- }{
- {
- name: "Must successfully validate a value in a range",
- fields: fields{0, 100},
- args: args{&valInRange},
- wantErr: false,
- },
- {
- name: "Must successfully validate nil",
- args: args{nil},
- wantErr: false,
- },
- {
- name: "Must fail if a given value is out of a range",
- fields: fields{0, 100},
- args: args{&valNotInRange},
- wantErr: true,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- v := RangeValidator{
- Min: tt.fields.Min,
- Max: tt.fields.Max,
- }
- if err := v.Validate(tt.args.value); (err != nil) != tt.wantErr {
- t.Errorf("Validate() error = %v, wantErr %v", err, tt.wantErr)
- }
- })
- }
-}
-
-func TestSetValidator_Validate(t *testing.T) {
- type fields struct {
- Set []string
- }
- type args struct {
- value *string
- }
- tests := []struct {
- name string
- fields fields
- args args
- wantErr bool
- }{
- {
- name: "Must successfully validate a value in a set",
- fields: fields{[]string{"foo", "42", "100500"}},
- args: args{&number},
- wantErr: false,
- },
- {
- name: "Must successfully validate nil",
- args: args{nil},
- wantErr: false,
- },
- {
- name: "Must fail if a given value is out of a set",
- fields: fields{[]string{"foo", "42", "100500"}},
- args: args{&string1},
- wantErr: true,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- v := SetValidator{
- Set: tt.fields.Set,
- }
- if err := v.Validate(tt.args.value); (err != nil) != tt.wantErr {
- t.Errorf("Validate() error = %v, wantErr %v", err, tt.wantErr)
- }
- })
- }
-}
diff --git a/src/go/pkg/pdh/pdh_windows.go b/src/go/pkg/pdh/pdh_windows.go
index af1cd0d1fb4..d900a9b8333 100644
--- a/src/go/pkg/pdh/pdh_windows.go
+++ b/src/go/pkg/pdh/pdh_windows.go
@@ -25,7 +25,7 @@ import (
"syscall"
"unsafe"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/pkg/win32"
"golang.org/x/sys/windows"
diff --git a/src/go/pkg/plugin/base.go b/src/go/pkg/plugin/base.go
deleted file mode 100644
index fccc5ea85f9..00000000000
--- a/src/go/pkg/plugin/base.go
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package plugin
-
-import (
- "zabbix.com/pkg/log"
-)
-
-type Accessor interface {
- Init(name string)
- Name() string
- Capacity() int
- SetCapacity(capactity int)
- IsExternal() bool
-}
-
-type Base struct {
- log.Logger
- name string
- capacity int
- external bool
-}
-
-func (b *Base) Init(name string) {
- b.Logger = log.New(name)
- b.name = name
- b.capacity = DefaultCapacity
-}
-
-func (b *Base) Name() string {
- return b.name
-}
-
-func (b *Base) Capacity() int {
- return b.capacity
-}
-
-func (b *Base) SetCapacity(capacity int) {
- b.capacity = capacity
-}
-
-func (b *Base) IsExternal() bool {
- return b.external
-}
-
-func (b *Base) SetExternal(isExternal bool) {
- b.external = isExternal
-}
-
-type SystemOptions struct {
- Path string `conf:"optional"`
- Capacity string `conf:"optional"`
-}
diff --git a/src/go/pkg/plugin/comms/connection.go b/src/go/pkg/plugin/comms/connection.go
deleted file mode 100644
index 34fdceb88af..00000000000
--- a/src/go/pkg/plugin/comms/connection.go
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package comms
-
-import (
- "bytes"
- "encoding/binary"
- "encoding/json"
- "fmt"
- "net"
-)
-
-const JSONType = uint32(1)
-const headerTypeLen = 4
-const headerDataLen = 4
-
-func Read(conn net.Conn) (dataType uint32, requestData []byte, err error) {
- reqByteType := make([]byte, headerTypeLen)
- reqByteLen := make([]byte, headerDataLen)
- n, err := conn.Read(reqByteType)
- if err != nil {
- return
- }
-
- if n < headerTypeLen {
- err = fmt.Errorf(
- "incomplete protocol header type value, %d bytes read, must be 4 bytes",
- n,
- )
-
- return
- }
-
- if JSONType != binary.LittleEndian.Uint32(reqByteType) {
- err = fmt.Errorf("only json data type (%d) supported", JSONType)
-
- return
- }
-
- n, err = conn.Read(reqByteLen)
- if err != nil {
- return
- }
-
- if n < headerDataLen {
- err = fmt.Errorf(
- "incomplete protocol header length value, %d bytes read, must be 4 bytes",
- n,
- )
-
- return
- }
-
- reqLen := int32(binary.LittleEndian.Uint32(reqByteLen))
- data := make([]byte, reqLen)
-
- n, err = conn.Read(data)
- if err != nil {
- return
- }
-
- if n < int(reqLen) {
- err = fmt.Errorf(
- "incomplete protocol body value, %d bytes read, must be %d bytes",
- n,
- reqLen,
- )
-
- return
- }
-
- var c Common
- if err := json.Unmarshal(data, &c); err != nil {
- return 0, nil, err
- }
-
- return c.Type, data, nil
-}
-
-func Write(conn net.Conn, in interface{}) (err error) {
- reqBytes, err := json.Marshal(in)
- if err != nil {
- return
- }
-
- buf := new(bytes.Buffer)
- err = binary.Write(buf, binary.LittleEndian, JSONType)
- if err != nil {
- return
- }
-
- err = binary.Write(buf, binary.LittleEndian, uint32(len(reqBytes)))
- if err != nil {
- return
- }
-
- _, err = buf.Write(reqBytes)
- if err != nil {
- return
- }
-
- if _, err = conn.Write(buf.Bytes()); err != nil {
- return
- }
-
- return
-}
diff --git a/src/go/pkg/plugin/comms/protocol.go b/src/go/pkg/plugin/comms/protocol.go
deleted file mode 100644
index 57b3fad7bb5..00000000000
--- a/src/go/pkg/plugin/comms/protocol.go
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package comms
-
-import (
- "zabbix.com/pkg/plugin"
-)
-
-const Version = "1.0"
-
-const NonRequiredID = 0
-
-const (
- Exporter = 1 << iota
- Configurator
- Runner
-)
-
-const (
- LogRequestType = iota + 1
- RegisterRequestType
- RegisterResponseType
- StartRequestType
- TerminateRequestType
- ExportRequestType
- ExportResponseType
- ConfigureRequestType
- ValidateRequestType
- ValidateResponseType
- PeriodRequestType
- PeriodResponseType
-)
-
-type request int
-
-var toString = map[request]string{
- LogRequestType: "Log Request",
- RegisterRequestType: "Register Request",
- RegisterResponseType: "Register Response",
- StartRequestType: "Start Request",
- TerminateRequestType: "Terminate Request",
- ExportRequestType: "Export Request",
- ExportResponseType: "Export Response",
- ConfigureRequestType: "Configure Request",
- ValidateRequestType: "Validate Request",
- ValidateResponseType: "Validate Response",
- PeriodRequestType: "Period Request",
- PeriodResponseType: "Period Response",
-}
-
-func GetRequestName(reqType uint32) string {
- return toString[request(reqType)]
-}
-
-func ImplementsConfigurator(in uint32) bool {
- return in&Configurator != 0
-}
-
-func ImplementsExporter(in uint32) bool {
- return in&Exporter != 0
-}
-
-func ImplementsRunner(in uint32) bool {
- return in&Runner != 0
-}
-
-type Common struct {
- Id uint32 `json:"id"`
- Type uint32 `json:"type"`
-}
-
-type LogRequest struct {
- Common
- Severity uint32 `json:"severity"`
- Message string `json:"message"`
-}
-
-type RegisterRequest struct {
- Common
- Version string `json:"version"`
-}
-
-type RegisterResponse struct {
- Common
- Name string `json:"name"`
- Metrics []string `json:"metrics,omitempty"`
- Interfaces uint32 `json:"interfaces,omitempty"`
- Error string `json:"error,omitempty"`
-}
-
-type ValidateRequest struct {
- Common
- PrivateOptions interface{} `json:"private_options,omitempty"`
-}
-
-type ValidateResponse struct {
- Common
- Error string `json:"error,omitempty"`
-}
-
-type StartRequest struct {
- Common
-}
-
-type TerminateRequest struct {
- Common
-}
-
-type ExportRequest struct {
- Common
- Key string `json:"key"`
- Params []string `json:"parameters,omitempty"`
-}
-
-type ExportResponse struct {
- Common
- Value interface{} `json:"value,omitempty"`
- Error string `json:"error,omitempty"`
-}
-
-type ConfigureRequest struct {
- Common
- GlobalOptions *plugin.GlobalOptions `json:"global_options"`
- PrivateOptions interface{} `json:"private_options,omitempty"`
-}
diff --git a/src/go/pkg/plugin/container/handler.go b/src/go/pkg/plugin/container/handler.go
deleted file mode 100644
index bb44b307ad6..00000000000
--- a/src/go/pkg/plugin/container/handler.go
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package container
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "net"
- "os"
- "os/signal"
- "strconv"
- "syscall"
- "time"
-
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/plugin/comms"
-)
-
-const defaultTimeout = 3
-const socketArg = 2
-const startTypeArg = 3
-
-const (
- Info = 0
- Crit = 1
- Err = 2
- Warning = 3
- Debug = 4
- Trace = 5
-)
-
-type handler struct {
- name string
- accessor plugin.Accessor
- socket string
- registerStart bool
- connection net.Conn
-}
-
-var supportedVersion map[string]bool
-
-func NewHandler(name string) (h handler, err error) {
- h.name = name
-
- if len(os.Args) < socketArg {
- err = errors.New("no socket provided")
-
- return
- }
-
- h.socket = os.Args[1]
-
- if len(os.Args) < startTypeArg {
- h.registerStart = false
-
- return
- }
-
- h.registerStart, err = strconv.ParseBool(os.Args[2])
- if err != nil {
- err = fmt.Errorf("failed to parse third parameter %s", err.Error())
-
- return
- }
-
- return
-}
-
-func (h *handler) Execute() error {
- err := h.setConnection(h.socket, defaultTimeout*time.Second)
- if err != nil {
- return err
- }
-
- h.accessor, err = plugin.GetByName(h.name)
- if err != nil {
- h.Errf("failed to get accessor for plugin %s, %s", h.name, err.Error())
-
- return err
- }
-
- h.run()
-
- return nil
-}
-
-func (h *handler) run() {
- go ignoreSIGINTandSIGTERM()
-
- for {
- err := h.handle()
- if err != nil {
- h.Errf("failed to handle request for plugin %s, %s", h.name, err.Error())
- }
- }
-}
-
-func (h *handler) handle() error {
- reqType, data, err := comms.Read(h.connection)
- if err != nil {
- return err
- }
-
- h.Tracef("plugin %s executing %s", h.name, comms.GetRequestName(reqType))
-
- switch reqType {
- case comms.RegisterRequestType:
- err = h.register(data)
- if err != nil {
- return err
- }
- case comms.StartRequestType:
- err = h.start()
- if err != nil {
- return err
- }
- case comms.TerminateRequestType:
- h.terminate()
- case comms.ValidateRequestType:
- err = h.validate(data)
- if err != nil {
- return err
- }
- case comms.ExportRequestType:
- err = h.export(data)
- if err != nil {
- return err
- }
- case comms.ConfigureRequestType:
- err = h.configure(data)
- if err != nil {
- return err
- }
- default:
- return fmt.Errorf("unknown request recivied: %d", reqType)
- }
-
- h.Tracef("plugin %s executed %s", h.name, comms.GetRequestName(reqType))
-
- return nil
-}
-
-func (h *handler) start() error {
- p, ok := h.accessor.(plugin.Runner)
- if !ok {
- return nil
- }
-
- p.Start()
-
- return nil
-}
-
-func (h *handler) stop() {
- if h.registerStart {
- return
- }
-
- p, ok := h.accessor.(plugin.Runner)
- if !ok {
- return
- }
-
- p.Stop()
-}
-
-func (h *handler) register(data []byte) error {
- var req comms.RegisterRequest
- err := json.Unmarshal(data, &req)
- if err != nil {
- return err
- }
-
- response := createEmptyRegisterResponse(req.Id)
-
- err = checkVersion(req.Version)
- if err != nil {
- response.Error = err.Error()
-
- return comms.Write(h.connection, response)
- }
-
- var metrics []string
-
- for key, metric := range plugin.Metrics {
- metrics = append(metrics, key)
- metrics = append(metrics, metric.Description)
- }
-
- interfaces := h.getInterfaces()
- response.Name = h.name
- response.Metrics = metrics
- response.Interfaces = interfaces
-
- return comms.Write(h.connection, response)
-}
-
-func checkVersion(version string) error {
- if supportedVersion[version] {
- return nil
- }
-
- return fmt.Errorf("plugin does not support version %s", version)
-}
-
-func (h *handler) validate(data []byte) error {
- var req comms.ValidateRequest
- err := json.Unmarshal(data, &req)
- if err != nil {
- return err
- }
-
- response := createEmptyValidateResponse(req.Id)
-
- p, ok := h.accessor.(plugin.Configurator)
- if !ok {
- panic("plugin does not implement Configurator interface")
- }
-
- err = p.Validate(req.PrivateOptions)
- if err != nil {
- response.Error = err.Error()
- }
-
- return comms.Write(h.connection, response)
-}
-
-func (h *handler) configure(data []byte) error {
- var req comms.ConfigureRequest
- err := json.Unmarshal(data, &req)
- if err != nil {
- return err
- }
-
- p, ok := h.accessor.(plugin.Configurator)
- if !ok {
- panic("plugin does not implement Configurator interface")
- }
-
- p.Configure(req.GlobalOptions, req.PrivateOptions)
-
- return nil
-}
-
-func (h *handler) export(data []byte) error {
- var req comms.ExportRequest
- err := json.Unmarshal(data, &req)
- if err != nil {
- return err
- }
-
- p, ok := h.accessor.(plugin.Exporter)
- if !ok {
- panic("plugin does not implement Exporter interface")
- }
-
- response := createEmptyExportResponse(req.Id)
- response.Value, err = p.Export(req.Key, req.Params, &emptyCtx{})
- if err != nil {
- response.Error = err.Error()
- }
-
- return comms.Write(h.connection, response)
-}
-
-func (h *handler) terminate() {
- h.stop()
- os.Exit(0)
-}
-
-func (h *handler) getInterfaces() uint32 {
- var interfaces uint32
-
- _, ok := h.accessor.(plugin.Exporter)
- if ok {
- interfaces |= comms.Exporter
- }
-
- _, ok = h.accessor.(plugin.Configurator)
- if ok {
- interfaces |= comms.Configurator
- }
-
- _, ok = h.accessor.(plugin.Runner)
- if ok {
- interfaces |= comms.Runner
- }
-
- return interfaces
-}
-
-func (h *handler) Tracef(format string, args ...interface{}) {
- h.sendLog(createLogRequest(Trace, fmt.Sprintf(format, args...)))
-}
-
-func (h *handler) Debugf(format string, args ...interface{}) {
- h.sendLog(createLogRequest(Debug, fmt.Sprintf(format, args...)))
-}
-
-func (h *handler) Warningf(format string, args ...interface{}) {
- h.sendLog(createLogRequest(Warning, fmt.Sprintf(format, args...)))
-}
-
-func (h *handler) Infof(format string, args ...interface{}) {
- h.sendLog(createLogRequest(Info, fmt.Sprintf(format, args...)))
-}
-
-func (h *handler) Errf(format string, args ...interface{}) {
- h.sendLog(createLogRequest(Err, fmt.Sprintf(format, args...)))
-}
-
-func (h *handler) Critf(format string, args ...interface{}) {
- h.sendLog(createLogRequest(Crit, fmt.Sprintf(format, args...)))
-}
-
-func createLogRequest(severity uint32, message string) comms.LogRequest {
- return comms.LogRequest{
- Common: comms.Common{
- Id: comms.NonRequiredID,
- Type: comms.LogRequestType,
- },
- Severity: severity,
- Message: message,
- }
-}
-
-func createEmptyRegisterResponse(id uint32) comms.RegisterResponse {
- return comms.RegisterResponse{
- Common: comms.Common{
- Id: id,
- Type: comms.RegisterResponseType,
- },
- }
-}
-
-func createEmptyExportResponse(id uint32) comms.ExportResponse {
- return comms.ExportResponse{Common: comms.Common{Id: id, Type: comms.ExportResponseType}}
-}
-
-func createEmptyValidateResponse(id uint32) comms.ValidateResponse {
- return comms.ValidateResponse{Common: comms.Common{Id: id, Type: comms.ValidateResponseType}}
-}
-
-func (h *handler) sendLog(request comms.LogRequest) {
- err := comms.Write(h.connection, request)
- if err != nil {
- panic(fmt.Sprintf("failed to log message %s", err.Error()))
- }
-}
-
-func ignoreSIGINTandSIGTERM() {
- sigs := make(chan os.Signal, 1)
- signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
- for {
- <-sigs
- }
-}
-
-func init() {
- supportedVersion = map[string]bool{}
- supportedVersion[comms.Version] = true
-}
diff --git a/src/go/pkg/plugin/container/handler_linux.go b/src/go/pkg/plugin/container/handler_linux.go
deleted file mode 100644
index 7c5e07ea50f..00000000000
--- a/src/go/pkg/plugin/container/handler_linux.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package container
-
-import (
- "net"
- "time"
-)
-
-func (h *handler) setConnection(path string, timeout time.Duration) (err error) {
- var i int
-
- for start := time.Now(); ; {
- if i%5 == 0 {
- if time.Since(start) > timeout {
- break
- }
- }
-
- var conn net.Conn
- conn, err = net.DialTimeout("unix", path, timeout)
- if err != nil {
- continue
- }
-
- h.connection = conn
-
- return
- }
-
- return
-}
diff --git a/src/go/pkg/plugin/container/handler_windows.go b/src/go/pkg/plugin/container/handler_windows.go
deleted file mode 100644
index f05588d47da..00000000000
--- a/src/go/pkg/plugin/container/handler_windows.go
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package container
-
-import (
- "net"
- "time"
-
- "github.com/natefinch/npipe"
-)
-
-func (h *handler) setConnection(path string, timeout time.Duration) (err error) {
- var i int
-
- for start := time.Now(); ; {
- if i%5 == 0 {
- if time.Since(start) > timeout {
- break
- }
- }
-
- var conn net.Conn
- if conn, err = npipe.DialTimeout(path, timeout); err != nil {
- return
- }
-
- h.connection = conn
-
- return
- }
-
- return
-}
diff --git a/src/go/pkg/plugin/container/interface.go b/src/go/pkg/plugin/container/interface.go
deleted file mode 100644
index dccdeee56c3..00000000000
--- a/src/go/pkg/plugin/container/interface.go
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-package container
-
-import "zabbix.com/pkg/plugin"
-
-type emptyCtx struct {
- resultWriter emptyResultWriter
- matcher emptyMatcher
-}
-
-func (ctx emptyCtx) ClientID() uint64 {
- return 0
-}
-func (ctx emptyCtx) ItemID() uint64 {
- return 0
-}
-func (ctx emptyCtx) Output() plugin.ResultWriter {
- return ctx.resultWriter
-}
-func (ctx emptyCtx) Meta() *plugin.Meta {
- return nil
-}
-func (ctx emptyCtx) GlobalRegexp() plugin.RegexpMatcher {
- return ctx.matcher
-}
-
-type emptyMatcher struct{}
-
-func (em emptyMatcher) Match(value string, pattern string, mode int, output_template *string) (bool, string) {
- return false, ""
-}
-
-type emptyResultWriter struct{}
-
-func (rw emptyResultWriter) Write(result *plugin.Result) {}
-func (rw emptyResultWriter) Flush() {}
-func (rw emptyResultWriter) SlotsAvailable() int { return 0 }
-func (rw emptyResultWriter) PersistSlotsAvailable() int { return 0 }
diff --git a/src/go/pkg/plugin/registry.go b/src/go/pkg/plugin/registry.go
deleted file mode 100644
index 3176fbf7667..00000000000
--- a/src/go/pkg/plugin/registry.go
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package plugin
-
-import (
- "fmt"
- "reflect"
- "regexp"
- "unicode"
-)
-
-type Metric struct {
- Plugin Accessor
- Key string
- Description string
- UsrPrm bool
-}
-
-var Metrics map[string]*Metric = make(map[string]*Metric)
-var Plugins map[string]Accessor = make(map[string]Accessor)
-
-func registerMetric(plugin Accessor, name string, key string, description string) {
- var usrprm bool
-
- if ok, _ := regexp.MatchString(`^[A-Za-z0-9\._-]+$`, key); !ok {
- panic(fmt.Sprintf(`cannot register metric "%s" having invalid format`, key))
- }
-
- if 0 == len(description) {
- panic(fmt.Sprintf(`cannot register metric "%s" with empty description`, key))
- }
-
- if unicode.IsLower([]rune(description)[0]) {
- panic(fmt.Sprintf(`cannot register metric "%s" with description without capital first letter: "%s"`, key, description))
- }
-
- if description[len(description)-1] != '.' {
- panic(fmt.Sprintf(`cannot register metric "%s" without dot at the end of description: "%s"`, key, description))
- }
-
- if _, ok := Metrics[key]; ok {
- panic(fmt.Sprintf(`cannot register duplicate metric "%s"`, key))
- }
-
- t := reflect.TypeOf(plugin)
- for i := 0; i < t.NumMethod(); i++ {
- method := t.Method(i)
- switch method.Name {
- case "Export":
- if _, ok := plugin.(Exporter); !ok {
- panic(fmt.Sprintf(`the "%s" plugin has %s method, but does implement Exporter interface`, name, method.Name))
- }
- case "Collect", "Period":
- if _, ok := plugin.(Collector); !ok {
- panic(fmt.Sprintf(`the "%s" plugin has %s method, but does not implement Collector interface`, name, method.Name))
- }
- case "Watch":
- if _, ok := plugin.(Watcher); !ok {
- panic(fmt.Sprintf(`the "%s" plugin has %s method, but does not implement Watcher interface`, name, method.Name))
- }
- case "Configure", "Validate":
- if _, ok := plugin.(Configurator); !ok {
- panic(fmt.Sprintf(`the "%s" plugin has %s method, but does not implement Configurator interface`, name, method.Name))
- }
- case "Start", "Stop":
- if _, ok := plugin.(Runner); !ok {
- panic(fmt.Sprintf(`the "%s" plugin has %s method, but does not implement Runner interface`, name, method.Name))
- }
- }
- }
- switch plugin.(type) {
- case Exporter, Collector, Runner, Watcher, Configurator:
- default:
- panic(fmt.Sprintf(`plugin "%s" does not implement any plugin interfaces`, name))
- }
-
- if p, ok := Plugins[name]; ok {
- if p != plugin {
- panic(fmt.Sprintf(`plugin name "%s" has been already registered by other plugin`, name))
- }
- } else {
- Plugins[name] = plugin
- plugin.Init(name)
- }
-
- if name == "UserParameter" {
- usrprm = true
- } else {
- usrprm = false
- }
-
- Metrics[key] = &Metric{Plugin: plugin, Key: key, Description: description, UsrPrm: usrprm}
-}
-
-func RegisterMetrics(impl Accessor, name string, params ...string) {
- if len(params) < 2 {
- panic("expected at least one metric and its description")
- }
- if len(params)&1 != 0 {
- panic("expected even number of metric and description parameters")
- }
- for i := 0; i < len(params); i += 2 {
- registerMetric(impl, name, params[i], params[i+1])
- }
-}
-
-func Get(key string) (acc Accessor, err error) {
- if m, ok := Metrics[key]; ok {
- return m.Plugin, nil
- }
- return nil, UnsupportedMetricError
-}
-
-func ClearRegistry() {
- Metrics = make(map[string]*Metric)
- Plugins = make(map[string]Accessor)
-}
-
-func GetByName(name string) (acc Accessor, err error) {
- if p, ok := Plugins[name]; ok {
- return p, nil
- }
- return nil, UnsupportedMetricError
-}
-
-func ClearUserParamMetrics() (metricsFallback map[string]*Metric) {
- metricsFallback = make(map[string]*Metric)
-
- for key, metric := range Metrics {
- if metric.UsrPrm {
- metricsFallback[key] = metric
- delete(Metrics, key)
- }
- }
-
- return
-}
-
-func RestoreUserParamMetrics(metrics map[string]*Metric) {
- for key, metric := range metrics {
- Metrics[key] = metric
- }
-}
diff --git a/src/go/pkg/plugin/types.go b/src/go/pkg/plugin/types.go
deleted file mode 100644
index fc693f0bab4..00000000000
--- a/src/go/pkg/plugin/types.go
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package plugin
-
-import (
- "errors"
- "sync/atomic"
- "time"
-)
-
-const (
- DefaultCapacity = 100
-)
-
-var UnsupportedMetricError error
-
-// Collector - interface for periodical metric collection
-type Collector interface {
- Collect() error
- Period() int
-}
-
-// Exporter - interface for exporting collected metrics
-type Exporter interface {
- // Export method exports data based on the key 'key' and its parameters 'params'.
- Export(key string, params []string, context ContextProvider) (interface{}, error)
-}
-
-// Runner - interface for managing background processes
-type Runner interface {
- // Start method activates plugin.
- Start()
- // Stop method deactivates pluing.
- Stop()
-}
-
-// Watcher - interface for fully custom monitoring
-type Watcher interface {
- // Watch method instructs plugin to watch for events based on item configuration in 'requests'.
- Watch(requests []*Request, context ContextProvider)
-}
-
-// Configurator - interface for plugin configuration in agent conf files
-type Configurator interface {
- // Configure method passes global and private plugin configuration after it has been activated.
- Configure(globalOptions *GlobalOptions, privateOptions interface{})
- // Validate method validates private plugin configuration during agent startup.
- Validate(privateOptions interface{}) error
-}
-
-type ResultWriter interface {
- Write(result *Result)
- Flush()
- SlotsAvailable() int
- PersistSlotsAvailable() int
-}
-
-type Meta struct {
- lastLogsize uint64
- mtime int32
- Data interface{}
-}
-
-func (m *Meta) SetLastLogsize(value uint64) {
- atomic.StoreUint64(&m.lastLogsize, value)
-}
-
-func (m *Meta) LastLogsize() uint64 {
- return atomic.LoadUint64(&m.lastLogsize)
-}
-
-func (m *Meta) SetMtime(value int32) {
- atomic.StoreInt32(&m.mtime, value)
-}
-
-func (m *Meta) Mtime() int32 {
- return atomic.LoadInt32(&m.mtime)
-}
-
-type RegexpMatcher interface {
- Match(value string, pattern string, mode int, output_template *string) (match bool, output string)
-}
-
-type ContextProvider interface {
- ClientID() uint64
- ItemID() uint64
- Output() ResultWriter
- Meta() *Meta
- GlobalRegexp() RegexpMatcher
-}
-
-type Result struct {
- Itemid uint64
- Value *string
-
- // additional windows eventlog fields
- EventSource *string
- EventID *int
- EventTimestamp *int
- EventSeverity *int
-
- Ts time.Time
- Error error
- LastLogsize *uint64
- Mtime *int
- Persistent bool
-}
-
-type Request struct {
- Itemid uint64 `json:"itemid"`
- Key string `json:"key"`
- Delay string `json:"delay"`
- LastLogsize *uint64 `json:"lastlogsize"`
- Mtime *int `json:"mtime"`
-}
-
-// GlobalOptions are global agent configuration parameters that can be accessed by plugins.
-// In most cases it's recommended to allow plugins overriding global configuration parameters
-// they are using with plugin specific parameters.
-type GlobalOptions struct {
- Timeout int
- SourceIP string
-}
-
-func init() {
- UnsupportedMetricError = errors.New("Unsupported item key.")
-}
diff --git a/src/go/pkg/tls/tls.go b/src/go/pkg/tls/tls.go
index 4514eb8ec3c..d5995820e1f 100644
--- a/src/go/pkg/tls/tls.go
+++ b/src/go/pkg/tls/tls.go
@@ -942,8 +942,8 @@ import (
"time"
"unsafe"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/uri"
)
// TLS initialization
diff --git a/src/go/pkg/tlsconfig/tlsconfig.go b/src/go/pkg/tlsconfig/tlsconfig.go
index f580183cace..492a920bb4c 100644
--- a/src/go/pkg/tlsconfig/tlsconfig.go
+++ b/src/go/pkg/tlsconfig/tlsconfig.go
@@ -7,7 +7,7 @@ import (
"fmt"
"io/ioutil"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/uri"
)
type Details struct {
diff --git a/src/go/pkg/version/version.go b/src/go/pkg/version/version.go
index b0735954730..7068975ca34 100644
--- a/src/go/pkg/version/version.go
+++ b/src/go/pkg/version/version.go
@@ -26,10 +26,10 @@ import (
)
const (
- ZABBIX_REVDATE = "4 April 2022"
+ ZABBIX_REVDATE = "3 May 2022"
ZABBIX_VERSION_MAJOR = 6
ZABBIX_VERSION_MINOR = 0
- ZABBIX_VERSION_PATCH = 4
+ ZABBIX_VERSION_PATCH = 5
ZABBIX_VERSION_RC = "rc1"
ZABBIX_VERSION_RC_NUM = "{ZABBIX_RC_NUM}"
ZABBIX_VERSION_REVISION = "{ZABBIX_REVISION}"
diff --git a/src/go/pkg/watch/manager.go b/src/go/pkg/watch/manager.go
index 9f28dad5317..c34342a5b25 100644
--- a/src/go/pkg/watch/manager.go
+++ b/src/go/pkg/watch/manager.go
@@ -27,7 +27,7 @@ import (
"sync"
"time"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// EventSource generates events by calling Manager.Notify() method and passing arbitrary
diff --git a/src/go/pkg/win32/pdh.go b/src/go/pkg/win32/pdh.go
index 938249eabea..547d4933634 100644
--- a/src/go/pkg/win32/pdh.go
+++ b/src/go/pkg/win32/pdh.go
@@ -29,7 +29,7 @@ import (
"time"
"unsafe"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/log"
"golang.org/x/sys/windows"
)
diff --git a/src/go/pkg/wmi/wmi.go b/src/go/pkg/wmi/wmi.go
index e8b32e63fcf..86a6ac3d194 100644
--- a/src/go/pkg/wmi/wmi.go
+++ b/src/go/pkg/wmi/wmi.go
@@ -26,7 +26,7 @@ import (
"github.com/go-ole/go-ole"
"github.com/go-ole/go-ole/oleutil"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/log"
)
const S_FALSE = 0x1
diff --git a/src/go/pkg/zbxcmd/zbxcmd_nix.go b/src/go/pkg/zbxcmd/zbxcmd_nix.go
index 59f83a49303..afe71abdaf5 100644
--- a/src/go/pkg/zbxcmd/zbxcmd_nix.go
+++ b/src/go/pkg/zbxcmd/zbxcmd_nix.go
@@ -30,7 +30,7 @@ import (
"syscall"
"time"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/log"
)
func execute(s string, timeout time.Duration, path string, strict bool) (string, error) {
diff --git a/src/go/pkg/zbxcmd/zbxcmd_windows.go b/src/go/pkg/zbxcmd/zbxcmd_windows.go
index f13ac4d2ea7..9f55b19e29a 100644
--- a/src/go/pkg/zbxcmd/zbxcmd_windows.go
+++ b/src/go/pkg/zbxcmd/zbxcmd_windows.go
@@ -28,7 +28,7 @@ import (
"time"
"unsafe"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/log"
"golang.org/x/sys/windows"
)
diff --git a/src/go/pkg/zbxcomms/comms.go b/src/go/pkg/zbxcomms/comms.go
index ab9cee74d92..1584e38bb97 100644
--- a/src/go/pkg/zbxcomms/comms.go
+++ b/src/go/pkg/zbxcomms/comms.go
@@ -29,7 +29,7 @@ import (
"net"
"time"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/pkg/tls"
)
diff --git a/src/go/pkg/zbxerr/zbxerr.go b/src/go/pkg/zbxerr/zbxerr.go
deleted file mode 100644
index a704400d5e8..00000000000
--- a/src/go/pkg/zbxerr/zbxerr.go
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package zbxerr
-
-import (
- "errors"
- "unicode"
-)
-
-type ZabbixError struct {
- err error
- cause error
-}
-
-// New creates a new ZabbixError
-func New(msg string) ZabbixError {
- return ZabbixError{errors.New(msg), nil}
-}
-
-// Wrap creates a new ZabbixError with wrapped cause
-func (e ZabbixError) Wrap(cause error) error {
- return ZabbixError{err: e, cause: cause}
-}
-
-// Unwrap extracts an original underlying error
-func (e ZabbixError) Unwrap() error {
- return e.err
-}
-
-// Cause returns a cause of original error
-func (e ZabbixError) Cause() error {
- return e.cause
-}
-
-// Error stringifies an error according to Zabbix requirements:
-// * the first letter must be capitalized;
-// * an error text should be trailed by a dot.
-func (e ZabbixError) Error() string {
- var msg string
-
- ucFirst := func(str string) string {
- for i, v := range str {
- return string(unicode.ToUpper(v)) + str[i+1:]
- }
-
- return ""
- }
-
- if zbxErr, ok := e.err.(ZabbixError); ok {
- msg = zbxErr.Raw()
- } else {
- msg = e.err.Error()
- }
-
- if e.cause != nil {
- msg += ": " + e.cause.Error()
- }
-
- if msg[len(msg)-1:] != "." {
- msg += "."
- }
-
- return ucFirst(msg)
-}
-
-// Raw returns a non-modified error message
-func (e ZabbixError) Raw() string {
- return e.err.Error()
-}
-
-var (
- ErrorInvalidParams = New("invalid parameters")
- ErrorTooFewParameters = New("too few parameters")
- ErrorTooManyParameters = New("too many parameters")
- ErrorInvalidConfiguration = New("invalid configuration")
- ErrorCannotFetchData = New("cannot fetch data")
- ErrorCannotUnmarshalJSON = New("cannot unmarshal JSON")
- ErrorCannotMarshalJSON = New("cannot marshal JSON")
- ErrorCannotParseResult = New("cannot parse result")
- ErrorConnectionFailed = New("connection failed")
- ErrorUnsupportedMetric = New("unsupported metric")
- ErrorEmptyResult = New("empty result")
- ErrorUnknownSession = New("unknown session")
-)
diff --git a/src/go/pkg/zbxerr/zbxerr_test.go b/src/go/pkg/zbxerr/zbxerr_test.go
deleted file mode 100644
index 9a7b9a5a3fc..00000000000
--- a/src/go/pkg/zbxerr/zbxerr_test.go
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
-** Zabbix
-** Copyright (C) 2001-2022 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.
-**/
-
-package zbxerr
-
-import (
- "errors"
- "reflect"
- "testing"
-)
-
-var (
- errorFooBar = errors.New("foo bar")
- errorFoo = errors.New("foo")
- errorBar = errors.New("bar")
-)
-
-func TestNew(t *testing.T) {
- type args struct {
- msg string
- }
- tests := []struct {
- name string
- args args
- want ZabbixError
- }{
- {
- "New must create a new ZabbixError with a corresponding message",
- args{"foo"},
- ZabbixError{errorFoo, nil},
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- if got := New(tt.args.msg); !reflect.DeepEqual(got, tt.want) {
- t.Errorf("New() = %v, want %v", got, tt.want)
- }
- })
- }
-}
-
-func TestZabbixError_Cause(t *testing.T) {
- type fields struct {
- err error
- cause error
- }
- tests := []struct {
- name string
- fields fields
- want error
- }{
- {
- "Cause must return a cause of original error",
- fields{errorFoo, errorBar},
- errorBar,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- e := ZabbixError{
- err: tt.fields.err,
- cause: tt.fields.cause,
- }
- if got := e.Cause(); got != tt.want {
- t.Errorf("Cause() = %v, want %v", got, tt.want)
- }
- })
- }
-}
-
-func TestZabbixError_Error(t *testing.T) {
- tests := []struct {
- name string
- e ZabbixError
- want string
- }{
- {
- "ZabbixError stringify",
- ZabbixError{errorFooBar, nil},
- "Foo bar.",
- },
- {
- "ZabbixError stringify with wrapping",
- ZabbixError{errorFoo, errorBar},
- "Foo: bar.",
- },
- {
- "ZabbixError stringify with wrapped ZabbixError",
- ZabbixError{ZabbixError{errorFoo, nil}, errorBar},
- "Foo: bar.",
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- if got := tt.e.Error(); got != tt.want {
- t.Errorf("Error() = %v, want %v", got, tt.want)
- }
- })
- }
-}
-
-func TestZabbixError_Raw(t *testing.T) {
- type fields struct {
- err error
- cause error
- }
- tests := []struct {
- name string
- fields fields
- want string
- }{
- {
- "Raw must return a non-modified error message",
- fields{errorFoo, nil},
- "foo",
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- e := ZabbixError{
- err: tt.fields.err,
- cause: tt.fields.cause,
- }
- if got := e.Raw(); got != tt.want {
- t.Errorf("Raw() = %v, want %v", got, tt.want)
- }
- })
- }
-}
-
-func TestZabbixError_Unwrap(t *testing.T) {
- type fields struct {
- err error
- cause error
- }
- tests := []struct {
- name string
- fields fields
- want error
- }{
- {
- "Unwrap must return an original underlying error",
- fields{errorFoo, nil},
- errorFoo,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- e := ZabbixError{
- err: tt.fields.err,
- cause: tt.fields.cause,
- }
- if got := e.Unwrap(); got != tt.want {
- t.Errorf("Unwrap() = %v, want %v", got, tt.want)
- }
- })
- }
-}
-
-func TestZabbixError_Wrap(t *testing.T) {
- type fields struct {
- err error
- cause error
- }
- type args struct {
- cause error
- }
- tests := []struct {
- name string
- fields fields
- args args
- want error
- }{
- {
- "Wrap must return a new ZabbixError with wrapped cause",
- fields{errorFoo, nil},
- args{errorBar},
- ZabbixError{ZabbixError{errorFoo, nil}, errorBar},
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- e := ZabbixError{
- err: tt.fields.err,
- cause: tt.fields.cause,
- }
- if got := e.Wrap(tt.args.cause); got != tt.want {
- t.Errorf("Wrap() = %v, want %v", got, tt.want)
- }
- })
- }
-}
diff --git a/src/go/pkg/zbxlib/logger.go b/src/go/pkg/zbxlib/logger.go
index 09b30ef5126..326df6f428c 100644
--- a/src/go/pkg/zbxlib/logger.go
+++ b/src/go/pkg/zbxlib/logger.go
@@ -22,7 +22,7 @@ package zbxlib
import (
"C"
)
-import "zabbix.com/pkg/log"
+import "git.zabbix.com/ap/plugin-support/log"
const c_info = 127
diff --git a/src/go/plugins/ceph/ceph.go b/src/go/plugins/ceph/ceph.go
index 0a2bfbae0cc..226ef6c657c 100644
--- a/src/go/plugins/ceph/ceph.go
+++ b/src/go/plugins/ceph/ceph.go
@@ -25,9 +25,9 @@ import (
"net/http"
"time"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/uri"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
const pluginName = "Ceph"
diff --git a/src/go/plugins/ceph/config.go b/src/go/plugins/ceph/config.go
index 3efe75d845d..3f5926207c3 100644
--- a/src/go/plugins/ceph/config.go
+++ b/src/go/plugins/ceph/config.go
@@ -20,8 +20,8 @@
package ceph
import (
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type Session struct {
diff --git a/src/go/plugins/ceph/handler_df.go b/src/go/plugins/ceph/handler_df.go
index 54f5bbe6f54..29e3f124438 100644
--- a/src/go/plugins/ceph/handler_df.go
+++ b/src/go/plugins/ceph/handler_df.go
@@ -23,7 +23,7 @@ import (
"encoding/json"
"math"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type cephDf struct {
diff --git a/src/go/plugins/ceph/handler_discovery.go b/src/go/plugins/ceph/handler_discovery.go
index e7e28c8e766..cfa019ca818 100644
--- a/src/go/plugins/ceph/handler_discovery.go
+++ b/src/go/plugins/ceph/handler_discovery.go
@@ -24,7 +24,7 @@ import (
"fmt"
"strconv"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type node struct {
diff --git a/src/go/plugins/ceph/handler_osd.go b/src/go/plugins/ceph/handler_osd.go
index 79c1bef7eea..f61d1b3e376 100644
--- a/src/go/plugins/ceph/handler_osd.go
+++ b/src/go/plugins/ceph/handler_osd.go
@@ -24,7 +24,7 @@ import (
"math"
"sort"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type aggDataInt struct {
diff --git a/src/go/plugins/ceph/handler_osd_dump.go b/src/go/plugins/ceph/handler_osd_dump.go
index 22af13604c6..e7fc19d0f70 100644
--- a/src/go/plugins/ceph/handler_osd_dump.go
+++ b/src/go/plugins/ceph/handler_osd_dump.go
@@ -23,7 +23,7 @@ import (
"encoding/json"
"math"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type cephOsdDump struct {
diff --git a/src/go/plugins/ceph/handler_status.go b/src/go/plugins/ceph/handler_status.go
index 04a08ecb0ce..b3ed9b1316f 100644
--- a/src/go/plugins/ceph/handler_status.go
+++ b/src/go/plugins/ceph/handler_status.go
@@ -24,7 +24,7 @@ import (
"fmt"
"strings"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type cephStatus struct {
diff --git a/src/go/plugins/ceph/metrics.go b/src/go/plugins/ceph/metrics.go
index c672ecc6c0a..683f824e81c 100644
--- a/src/go/plugins/ceph/metrics.go
+++ b/src/go/plugins/ceph/metrics.go
@@ -20,9 +20,9 @@
package ceph
import (
- "zabbix.com/pkg/metric"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/metric"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/uri"
)
type command string
diff --git a/src/go/plugins/ceph/request.go b/src/go/plugins/ceph/request.go
index efb5436fe8a..577f1cf1c94 100644
--- a/src/go/plugins/ceph/request.go
+++ b/src/go/plugins/ceph/request.go
@@ -25,8 +25,8 @@ import (
"encoding/json"
"net/http"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type cephResponse struct {
diff --git a/src/go/plugins/debug/collector/collector.go b/src/go/plugins/debug/collector/collector.go
index c2f3540b1fd..bec50ed61f3 100644
--- a/src/go/plugins/debug/collector/collector.go
+++ b/src/go/plugins/debug/collector/collector.go
@@ -20,8 +20,8 @@
package empty
import (
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type Options struct {
diff --git a/src/go/plugins/debug/empty/empty.go b/src/go/plugins/debug/empty/empty.go
index 45ee99b7397..806ebd7bb81 100644
--- a/src/go/plugins/debug/empty/empty.go
+++ b/src/go/plugins/debug/empty/empty.go
@@ -20,7 +20,7 @@
package empty
import (
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Plugin -
diff --git a/src/go/plugins/debug/external/full/full.go b/src/go/plugins/debug/external/full/full.go
index b5eb06d198b..6bdcff7bc49 100644
--- a/src/go/plugins/debug/external/full/full.go
+++ b/src/go/plugins/debug/external/full/full.go
@@ -23,8 +23,8 @@ import (
"fmt"
"strings"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type Options struct {
diff --git a/src/go/plugins/debug/external/full/main.go b/src/go/plugins/debug/external/full/main.go
index 532ac4bc716..feb71460333 100644
--- a/src/go/plugins/debug/external/full/main.go
+++ b/src/go/plugins/debug/external/full/main.go
@@ -22,7 +22,7 @@ package main
import (
"fmt"
- "zabbix.com/pkg/plugin/container"
+ "git.zabbix.com/ap/plugin-support/plugin/container"
)
func main() {
diff --git a/src/go/plugins/debug/external/multikey/main.go b/src/go/plugins/debug/external/multikey/main.go
index 532ac4bc716..feb71460333 100644
--- a/src/go/plugins/debug/external/multikey/main.go
+++ b/src/go/plugins/debug/external/multikey/main.go
@@ -22,7 +22,7 @@ package main
import (
"fmt"
- "zabbix.com/pkg/plugin/container"
+ "git.zabbix.com/ap/plugin-support/plugin/container"
)
func main() {
diff --git a/src/go/plugins/debug/external/multikey/multikey.go b/src/go/plugins/debug/external/multikey/multikey.go
index 6ef29625d7d..b60c2dd75ff 100644
--- a/src/go/plugins/debug/external/multikey/multikey.go
+++ b/src/go/plugins/debug/external/multikey/multikey.go
@@ -22,7 +22,7 @@ package main
import (
"errors"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Plugin -
diff --git a/src/go/plugins/debug/external/test/main.go b/src/go/plugins/debug/external/test/main.go
index 158c675258b..4aa79a43433 100644
--- a/src/go/plugins/debug/external/test/main.go
+++ b/src/go/plugins/debug/external/test/main.go
@@ -22,7 +22,7 @@ package main
import (
"fmt"
- "zabbix.com/pkg/plugin/container"
+ "git.zabbix.com/ap/plugin-support/plugin/container"
)
func main() {
diff --git a/src/go/plugins/debug/external/test/test.go b/src/go/plugins/debug/external/test/test.go
index a31f30ecd62..ef5613cb935 100644
--- a/src/go/plugins/debug/external/test/test.go
+++ b/src/go/plugins/debug/external/test/test.go
@@ -20,7 +20,7 @@
package main
import (
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Plugin -
diff --git a/src/go/plugins/debug/filewatcher/filewatcher.go b/src/go/plugins/debug/filewatcher/filewatcher.go
index cd5a3e9c0c8..92223adc0b1 100644
--- a/src/go/plugins/debug/filewatcher/filewatcher.go
+++ b/src/go/plugins/debug/filewatcher/filewatcher.go
@@ -23,8 +23,8 @@ import (
"fmt"
"io/ioutil"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/watch"
"github.com/fsnotify/fsnotify"
diff --git a/src/go/plugins/debug/log/log.go b/src/go/plugins/debug/log/log.go
index 1f021cafad2..01c9e45321a 100644
--- a/src/go/plugins/debug/log/log.go
+++ b/src/go/plugins/debug/log/log.go
@@ -22,7 +22,7 @@ package log
import (
"time"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Plugin -
diff --git a/src/go/plugins/debug/trapper/trapper.go b/src/go/plugins/debug/trapper/trapper.go
index 50f7ada187a..3fc0d627f9f 100644
--- a/src/go/plugins/debug/trapper/trapper.go
+++ b/src/go/plugins/debug/trapper/trapper.go
@@ -27,9 +27,9 @@ import (
"regexp"
"strconv"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/watch"
)
diff --git a/src/go/plugins/docker/client.go b/src/go/plugins/docker/client.go
index bc2b93fd43e..f4cd5e171f4 100644
--- a/src/go/plugins/docker/client.go
+++ b/src/go/plugins/docker/client.go
@@ -28,7 +28,7 @@ import (
"path"
"time"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type client struct {
diff --git a/src/go/plugins/docker/config.go b/src/go/plugins/docker/config.go
index 814f4c5712c..101684612fb 100644
--- a/src/go/plugins/docker/config.go
+++ b/src/go/plugins/docker/config.go
@@ -23,8 +23,8 @@ import (
"errors"
"strings"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Options is a plugin configuration
diff --git a/src/go/plugins/docker/discovery.go b/src/go/plugins/docker/discovery.go
index 01e7ac8bf33..2f53a7210b5 100644
--- a/src/go/plugins/docker/discovery.go
+++ b/src/go/plugins/docker/discovery.go
@@ -22,7 +22,7 @@ package docker
import (
"encoding/json"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type containerDiscovery struct {
diff --git a/src/go/plugins/docker/docker.go b/src/go/plugins/docker/docker.go
index c16de4eee4b..c6b15b6c154 100644
--- a/src/go/plugins/docker/docker.go
+++ b/src/go/plugins/docker/docker.go
@@ -23,9 +23,9 @@ import (
"encoding/json"
"fmt"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
const (
diff --git a/src/go/plugins/docker/metrics.go b/src/go/plugins/docker/metrics.go
index cb10f086f6c..07f2b4a1ba6 100644
--- a/src/go/plugins/docker/metrics.go
+++ b/src/go/plugins/docker/metrics.go
@@ -20,8 +20,8 @@
package docker
import (
- "zabbix.com/pkg/metric"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/metric"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type metricMeta struct {
diff --git a/src/go/plugins/external/broker.go b/src/go/plugins/external/broker.go
index 6e344c969db..ecf6f463365 100644
--- a/src/go/plugins/external/broker.go
+++ b/src/go/plugins/external/broker.go
@@ -26,10 +26,10 @@ import (
"net"
"time"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/plugin/comms"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin/comms"
)
const queSize = 100
diff --git a/src/go/plugins/external/plugin.go b/src/go/plugins/external/plugin.go
index 6e260eb601d..62ff260e8be 100644
--- a/src/go/plugins/external/plugin.go
+++ b/src/go/plugins/external/plugin.go
@@ -28,8 +28,8 @@ import (
"sync"
"time"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/plugin/comms"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin/comms"
)
var startLock sync.Mutex
diff --git a/src/go/plugins/kernel/kernel.go b/src/go/plugins/kernel/kernel.go
index 93056d72d08..89e66383c42 100644
--- a/src/go/plugins/kernel/kernel.go
+++ b/src/go/plugins/kernel/kernel.go
@@ -20,9 +20,9 @@
package kernel
import (
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/std"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/std"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
// Plugin -
diff --git a/src/go/plugins/kernel/kernel_test.go b/src/go/plugins/kernel/kernel_test.go
index 324f24fb9fa..72a9a4a21cb 100644
--- a/src/go/plugins/kernel/kernel_test.go
+++ b/src/go/plugins/kernel/kernel_test.go
@@ -27,7 +27,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
var testSets = []testSet{
diff --git a/src/go/plugins/log/log.go b/src/go/plugins/log/log.go
index b93bd09f44b..1f73e2396fb 100644
--- a/src/go/plugins/log/log.go
+++ b/src/go/plugins/log/log.go
@@ -25,11 +25,11 @@ import (
"time"
"unsafe"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
- "zabbix.com/pkg/conf"
"zabbix.com/pkg/glexpr"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/zbxlib"
)
diff --git a/src/go/plugins/memcached/config.go b/src/go/plugins/memcached/config.go
index b3d5b64b610..4996f6bcbab 100644
--- a/src/go/plugins/memcached/config.go
+++ b/src/go/plugins/memcached/config.go
@@ -22,8 +22,8 @@ package memcached
import (
"fmt"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type PluginOptions struct {
diff --git a/src/go/plugins/memcached/conn.go b/src/go/plugins/memcached/conn.go
index 90eb8065c49..e4e3bd82d42 100644
--- a/src/go/plugins/memcached/conn.go
+++ b/src/go/plugins/memcached/conn.go
@@ -24,11 +24,11 @@ import (
"sync"
"time"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
+ "git.zabbix.com/ap/plugin-support/log"
"github.com/memcachier/mc/v3"
- "zabbix.com/pkg/log"
)
const poolSize = 1
diff --git a/src/go/plugins/memcached/conn_test.go b/src/go/plugins/memcached/conn_test.go
index da9f6adaff1..e648879e5f5 100644
--- a/src/go/plugins/memcached/conn_test.go
+++ b/src/go/plugins/memcached/conn_test.go
@@ -24,7 +24,7 @@ import (
"testing"
"time"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/uri"
)
func TestConnManager_closeUnused(t *testing.T) {
diff --git a/src/go/plugins/memcached/handler_stats.go b/src/go/plugins/memcached/handler_stats.go
index b149c6f1c48..2d0ceb181e9 100644
--- a/src/go/plugins/memcached/handler_stats.go
+++ b/src/go/plugins/memcached/handler_stats.go
@@ -22,7 +22,7 @@ package memcached
import (
"encoding/json"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
const (
diff --git a/src/go/plugins/memcached/handler_stats_test.go b/src/go/plugins/memcached/handler_stats_test.go
index 5ff42a83b59..b1792237248 100644
--- a/src/go/plugins/memcached/handler_stats_test.go
+++ b/src/go/plugins/memcached/handler_stats_test.go
@@ -24,7 +24,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/memcachier/mc/v3"
)
diff --git a/src/go/plugins/memcached/memcached.go b/src/go/plugins/memcached/memcached.go
index 8bf4f80db38..cfed5aebeea 100644
--- a/src/go/plugins/memcached/memcached.go
+++ b/src/go/plugins/memcached/memcached.go
@@ -23,10 +23,10 @@ import (
"fmt"
"time"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
const pluginName = "Memcached"
diff --git a/src/go/plugins/memcached/memcached_test.go b/src/go/plugins/memcached/memcached_test.go
index b9ec219b96f..8f535be23d5 100644
--- a/src/go/plugins/memcached/memcached_test.go
+++ b/src/go/plugins/memcached/memcached_test.go
@@ -26,9 +26,9 @@ import (
"testing"
"time"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/plugins/memcached/mockserver"
)
diff --git a/src/go/plugins/memcached/metrics.go b/src/go/plugins/memcached/metrics.go
index ba1abc7f00f..339b65bd0c4 100644
--- a/src/go/plugins/memcached/metrics.go
+++ b/src/go/plugins/memcached/metrics.go
@@ -20,9 +20,9 @@
package memcached
import (
- "zabbix.com/pkg/metric"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/metric"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/uri"
)
// handlerFunc defines an interface must be implemented by handlers.
diff --git a/src/go/plugins/modbus/modbus.go b/src/go/plugins/modbus/modbus.go
index 58dcd153c06..13909154346 100644
--- a/src/go/plugins/modbus/modbus.go
+++ b/src/go/plugins/modbus/modbus.go
@@ -31,11 +31,11 @@ import (
"encoding/binary"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
named "github.com/BurntSushi/locker"
"github.com/goburrow/modbus"
mblib "github.com/goburrow/modbus"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
)
// Plugin -
diff --git a/src/go/plugins/mongodb/config.go b/src/go/plugins/mongodb/config.go
index 3be5421665d..dbba4c6411c 100644
--- a/src/go/plugins/mongodb/config.go
+++ b/src/go/plugins/mongodb/config.go
@@ -20,8 +20,8 @@
package mongodb
import (
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type PluginOptions struct {
diff --git a/src/go/plugins/mongodb/conn.go b/src/go/plugins/mongodb/conn.go
index 403cfdecb35..1e9d787d02f 100644
--- a/src/go/plugins/mongodb/conn.go
+++ b/src/go/plugins/mongodb/conn.go
@@ -26,9 +26,9 @@ import (
"gopkg.in/mgo.v2/bson"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/uri"
"gopkg.in/mgo.v2"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/uri"
)
type MongoConn struct {
diff --git a/src/go/plugins/mongodb/handler_collection_stats.go b/src/go/plugins/mongodb/handler_collection_stats.go
index 0d65094ad2f..e1091fb48a5 100644
--- a/src/go/plugins/mongodb/handler_collection_stats.go
+++ b/src/go/plugins/mongodb/handler_collection_stats.go
@@ -22,8 +22,8 @@ package mongodb
import (
"encoding/json"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
// collectionStatsHandler
diff --git a/src/go/plugins/mongodb/handler_collection_stats_test.go b/src/go/plugins/mongodb/handler_collection_stats_test.go
index 5aeaca5ac3f..f8792ec776b 100644
--- a/src/go/plugins/mongodb/handler_collection_stats_test.go
+++ b/src/go/plugins/mongodb/handler_collection_stats_test.go
@@ -9,8 +9,8 @@ import (
"strings"
"testing"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
func Test_collectionStatsHandler(t *testing.T) {
diff --git a/src/go/plugins/mongodb/handler_collections_discovery.go b/src/go/plugins/mongodb/handler_collections_discovery.go
index 3fcc8d0c36b..eccc7f59689 100644
--- a/src/go/plugins/mongodb/handler_collections_discovery.go
+++ b/src/go/plugins/mongodb/handler_collections_discovery.go
@@ -23,7 +23,7 @@ import (
"encoding/json"
"sort"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type colEntity struct {
diff --git a/src/go/plugins/mongodb/handler_collections_discovery_test.go b/src/go/plugins/mongodb/handler_collections_discovery_test.go
index 029451ccea5..5f00491a087 100644
--- a/src/go/plugins/mongodb/handler_collections_discovery_test.go
+++ b/src/go/plugins/mongodb/handler_collections_discovery_test.go
@@ -5,7 +5,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func Test_collectionsDiscoveryHandler(t *testing.T) {
diff --git a/src/go/plugins/mongodb/handler_collections_usage.go b/src/go/plugins/mongodb/handler_collections_usage.go
index 9b1dc6a4e45..825a660c2ea 100644
--- a/src/go/plugins/mongodb/handler_collections_usage.go
+++ b/src/go/plugins/mongodb/handler_collections_usage.go
@@ -22,8 +22,8 @@ package mongodb
import (
"encoding/json"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
// collectionsUsageHandler
diff --git a/src/go/plugins/mongodb/handler_config_discovery.go b/src/go/plugins/mongodb/handler_config_discovery.go
index fc6e033a7cc..616ed2eca5d 100644
--- a/src/go/plugins/mongodb/handler_config_discovery.go
+++ b/src/go/plugins/mongodb/handler_config_discovery.go
@@ -25,8 +25,8 @@ import (
"net"
"strings"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
type lldCfgEntity struct {
diff --git a/src/go/plugins/mongodb/handler_connPool_stats.go b/src/go/plugins/mongodb/handler_connPool_stats.go
index 0ffcca08c5a..64e7a4393e6 100644
--- a/src/go/plugins/mongodb/handler_connPool_stats.go
+++ b/src/go/plugins/mongodb/handler_connPool_stats.go
@@ -22,8 +22,8 @@ package mongodb
import (
"encoding/json"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
// connPoolStatsHandler
diff --git a/src/go/plugins/mongodb/handler_connPool_stats_test.go b/src/go/plugins/mongodb/handler_connPool_stats_test.go
index 0b819e040de..abe88dae2cb 100644
--- a/src/go/plugins/mongodb/handler_connPool_stats_test.go
+++ b/src/go/plugins/mongodb/handler_connPool_stats_test.go
@@ -9,8 +9,8 @@ import (
"strings"
"testing"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
func Test_connPoolStatsHandler(t *testing.T) {
diff --git a/src/go/plugins/mongodb/handler_database_stats.go b/src/go/plugins/mongodb/handler_database_stats.go
index 9ad277fc358..7d7e3e8a5fd 100644
--- a/src/go/plugins/mongodb/handler_database_stats.go
+++ b/src/go/plugins/mongodb/handler_database_stats.go
@@ -22,8 +22,8 @@ package mongodb
import (
"encoding/json"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
// databaseStatsHandler
diff --git a/src/go/plugins/mongodb/handler_database_stats_test.go b/src/go/plugins/mongodb/handler_database_stats_test.go
index 38d752bd35d..7a441ee3412 100644
--- a/src/go/plugins/mongodb/handler_database_stats_test.go
+++ b/src/go/plugins/mongodb/handler_database_stats_test.go
@@ -9,8 +9,8 @@ import (
"strings"
"testing"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
func Test_databaseStatsHandler(t *testing.T) {
diff --git a/src/go/plugins/mongodb/handler_databases_discovery.go b/src/go/plugins/mongodb/handler_databases_discovery.go
index 96cf82f4578..b556930e0e5 100644
--- a/src/go/plugins/mongodb/handler_databases_discovery.go
+++ b/src/go/plugins/mongodb/handler_databases_discovery.go
@@ -23,7 +23,7 @@ import (
"encoding/json"
"sort"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type dbEntity struct {
diff --git a/src/go/plugins/mongodb/handler_databases_discovery_test.go b/src/go/plugins/mongodb/handler_databases_discovery_test.go
index 5eed8622bf8..803fba298d5 100644
--- a/src/go/plugins/mongodb/handler_databases_discovery_test.go
+++ b/src/go/plugins/mongodb/handler_databases_discovery_test.go
@@ -5,7 +5,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func Test_databasesDiscoveryHandler(t *testing.T) {
diff --git a/src/go/plugins/mongodb/handler_jumbo_chunks.go b/src/go/plugins/mongodb/handler_jumbo_chunks.go
index fc818657533..4860133d2d4 100644
--- a/src/go/plugins/mongodb/handler_jumbo_chunks.go
+++ b/src/go/plugins/mongodb/handler_jumbo_chunks.go
@@ -20,8 +20,8 @@
package mongodb
import (
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
// jumboChunksHandler
diff --git a/src/go/plugins/mongodb/handler_oplog_stats.go b/src/go/plugins/mongodb/handler_oplog_stats.go
index 835e8a29e42..6bf7d250b1e 100644
--- a/src/go/plugins/mongodb/handler_oplog_stats.go
+++ b/src/go/plugins/mongodb/handler_oplog_stats.go
@@ -23,9 +23,9 @@ import (
"encoding/json"
"time"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
type oplogStats struct {
diff --git a/src/go/plugins/mongodb/handler_replset_config.go b/src/go/plugins/mongodb/handler_replset_config.go
index cd693260f3e..6eb4c56396d 100644
--- a/src/go/plugins/mongodb/handler_replset_config.go
+++ b/src/go/plugins/mongodb/handler_replset_config.go
@@ -22,8 +22,8 @@ package mongodb
import (
"encoding/json"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
// replSetConfigHandler
diff --git a/src/go/plugins/mongodb/handler_replset_status.go b/src/go/plugins/mongodb/handler_replset_status.go
index 0ba46216e0b..889d0183a6b 100644
--- a/src/go/plugins/mongodb/handler_replset_status.go
+++ b/src/go/plugins/mongodb/handler_replset_status.go
@@ -24,8 +24,8 @@ import (
"errors"
"strings"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
const (
diff --git a/src/go/plugins/mongodb/handler_server_status.go b/src/go/plugins/mongodb/handler_server_status.go
index edf19661445..f5ee02dd4a9 100644
--- a/src/go/plugins/mongodb/handler_server_status.go
+++ b/src/go/plugins/mongodb/handler_server_status.go
@@ -22,8 +22,8 @@ package mongodb
import (
"encoding/json"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
// serverStatusHandler
diff --git a/src/go/plugins/mongodb/handler_shards_discovery.go b/src/go/plugins/mongodb/handler_shards_discovery.go
index 3278452bef1..d8cb1f1c3f0 100644
--- a/src/go/plugins/mongodb/handler_shards_discovery.go
+++ b/src/go/plugins/mongodb/handler_shards_discovery.go
@@ -26,7 +26,7 @@ import (
"strings"
"time"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type lldShEntity struct {
diff --git a/src/go/plugins/mongodb/metrics.go b/src/go/plugins/mongodb/metrics.go
index 5a92374cad8..9767eac9996 100644
--- a/src/go/plugins/mongodb/metrics.go
+++ b/src/go/plugins/mongodb/metrics.go
@@ -20,9 +20,9 @@
package mongodb
import (
- "zabbix.com/pkg/metric"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/metric"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/uri"
)
// handlerFunc defines an interface must be implemented by handlers.
diff --git a/src/go/plugins/mongodb/mockconn.go b/src/go/plugins/mongodb/mockconn.go
index aad8053a55f..09f9cce71c4 100644
--- a/src/go/plugins/mongodb/mockconn.go
+++ b/src/go/plugins/mongodb/mockconn.go
@@ -5,9 +5,9 @@ import (
"fmt"
"time"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
- "zabbix.com/pkg/zbxerr"
)
const (
diff --git a/src/go/plugins/mongodb/mongodb.go b/src/go/plugins/mongodb/mongodb.go
index 65b47804704..4b5b8284b03 100644
--- a/src/go/plugins/mongodb/mongodb.go
+++ b/src/go/plugins/mongodb/mongodb.go
@@ -24,10 +24,10 @@ import (
"gopkg.in/mgo.v2"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
const pluginName = "Mongo"
diff --git a/src/go/plugins/mqtt/mqtt.go b/src/go/plugins/mqtt/mqtt.go
index 571ecd85df6..15ad10fcf2d 100644
--- a/src/go/plugins/mqtt/mqtt.go
+++ b/src/go/plugins/mqtt/mqtt.go
@@ -35,10 +35,10 @@ import (
"strings"
"time"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
mqtt "github.com/eclipse/paho.mqtt.golang"
- "zabbix.com/pkg/conf"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/version"
"zabbix.com/pkg/watch"
)
diff --git a/src/go/plugins/mysql/config.go b/src/go/plugins/mysql/config.go
index 9156f19d845..06e210f39d7 100644
--- a/src/go/plugins/mysql/config.go
+++ b/src/go/plugins/mysql/config.go
@@ -20,8 +20,8 @@
package mysql
import (
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Session is a general structure for storing sessions' configuration.
diff --git a/src/go/plugins/mysql/conn.go b/src/go/plugins/mysql/conn.go
index 9a71783548c..e4b4a9fa10a 100644
--- a/src/go/plugins/mysql/conn.go
+++ b/src/go/plugins/mysql/conn.go
@@ -28,11 +28,11 @@ import (
"github.com/go-sql-driver/mysql"
+ "git.zabbix.com/ap/plugin-support/uri"
"zabbix.com/pkg/tlsconfig"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type MyClient interface {
diff --git a/src/go/plugins/mysql/handler_database_size.go b/src/go/plugins/mysql/handler_database_size.go
index 5badf554a1f..7e977077d3c 100644
--- a/src/go/plugins/mysql/handler_database_size.go
+++ b/src/go/plugins/mysql/handler_database_size.go
@@ -22,7 +22,7 @@ package mysql
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func databaseSizeHandler(ctx context.Context, conn MyClient,
diff --git a/src/go/plugins/mysql/handler_databases_discovery.go b/src/go/plugins/mysql/handler_databases_discovery.go
index 75feb5b2251..d3f3adb81d9 100644
--- a/src/go/plugins/mysql/handler_databases_discovery.go
+++ b/src/go/plugins/mysql/handler_databases_discovery.go
@@ -23,7 +23,7 @@ import (
"context"
"encoding/json"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func databasesDiscoveryHandler(ctx context.Context, conn MyClient, _ map[string]string,
diff --git a/src/go/plugins/mysql/handler_replication_discovery.go b/src/go/plugins/mysql/handler_replication_discovery.go
index 2722f17746b..ebfb628c2c9 100644
--- a/src/go/plugins/mysql/handler_replication_discovery.go
+++ b/src/go/plugins/mysql/handler_replication_discovery.go
@@ -23,7 +23,7 @@ import (
"context"
"encoding/json"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func replicationDiscoveryHandler(ctx context.Context, conn MyClient, _ map[string]string,
diff --git a/src/go/plugins/mysql/handler_replication_status.go b/src/go/plugins/mysql/handler_replication_status.go
index 594c2816104..ecbd69e1a79 100644
--- a/src/go/plugins/mysql/handler_replication_status.go
+++ b/src/go/plugins/mysql/handler_replication_status.go
@@ -24,7 +24,7 @@ import (
"encoding/json"
"errors"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func replicationSlaveStatusHandler(ctx context.Context, conn MyClient, _ map[string]string,
diff --git a/src/go/plugins/mysql/handler_status_variables.go b/src/go/plugins/mysql/handler_status_variables.go
index 878fed75103..f6b7df2756f 100644
--- a/src/go/plugins/mysql/handler_status_variables.go
+++ b/src/go/plugins/mysql/handler_status_variables.go
@@ -23,7 +23,7 @@ import (
"context"
"encoding/json"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func statusVarsHandler(ctx context.Context, conn MyClient, _ map[string]string,
diff --git a/src/go/plugins/mysql/handler_version.go b/src/go/plugins/mysql/handler_version.go
index 1823bb1107f..aaf76225c91 100644
--- a/src/go/plugins/mysql/handler_version.go
+++ b/src/go/plugins/mysql/handler_version.go
@@ -22,7 +22,7 @@ package mysql
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func versionHandler(ctx context.Context, conn MyClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/mysql/metrics.go b/src/go/plugins/mysql/metrics.go
index 466484b68be..444d5bfcc81 100644
--- a/src/go/plugins/mysql/metrics.go
+++ b/src/go/plugins/mysql/metrics.go
@@ -22,9 +22,9 @@ package mysql
import (
"context"
- "zabbix.com/pkg/metric"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/metric"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/uri"
)
const (
diff --git a/src/go/plugins/mysql/mysql.go b/src/go/plugins/mysql/mysql.go
index 8ce8c7fefac..6598059c7bf 100644
--- a/src/go/plugins/mysql/mysql.go
+++ b/src/go/plugins/mysql/mysql.go
@@ -23,10 +23,10 @@ import (
"context"
"time"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"zabbix.com/pkg/tlsconfig"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/zbxerr"
)
const (
diff --git a/src/go/plugins/net/dns/dns.go b/src/go/plugins/net/dns/dns.go
index 107ffdfabcf..60efc74b3dd 100644
--- a/src/go/plugins/net/dns/dns.go
+++ b/src/go/plugins/net/dns/dns.go
@@ -26,9 +26,9 @@ import (
"strings"
"time"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/miekg/dns"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/zbxerr"
)
const (
diff --git a/src/go/plugins/net/dns/dns_windows.go b/src/go/plugins/net/dns/dns_windows.go
index baf45c3d40d..a830f064ddb 100644
--- a/src/go/plugins/net/dns/dns_windows.go
+++ b/src/go/plugins/net/dns/dns_windows.go
@@ -23,8 +23,8 @@ import (
"strings"
"unsafe"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"golang.org/x/sys/windows"
- "zabbix.com/pkg/zbxerr"
)
func (o *options) setDefaultIP() error {
diff --git a/src/go/plugins/net/netif/netif.go b/src/go/plugins/net/netif/netif.go
index 728885d3d67..b58bc06253b 100644
--- a/src/go/plugins/net/netif/netif.go
+++ b/src/go/plugins/net/netif/netif.go
@@ -20,7 +20,7 @@
package netif
import (
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
const (
diff --git a/src/go/plugins/net/netif/netif_linux.go b/src/go/plugins/net/netif/netif_linux.go
index 3c3c19d9416..40710f728e1 100644
--- a/src/go/plugins/net/netif/netif_linux.go
+++ b/src/go/plugins/net/netif/netif_linux.go
@@ -27,8 +27,8 @@ import (
"strconv"
"strings"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/std"
)
const (
diff --git a/src/go/plugins/net/netif/netif_test.go b/src/go/plugins/net/netif/netif_test.go
index 9ad32680e5a..ecc3af1fc4c 100644
--- a/src/go/plugins/net/netif/netif_test.go
+++ b/src/go/plugins/net/netif/netif_test.go
@@ -27,7 +27,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
var testSets = []testSet{
diff --git a/src/go/plugins/net/netif/netif_unsupported.go b/src/go/plugins/net/netif/netif_unsupported.go
index 8b21fb58c0f..8eab532dc59 100644
--- a/src/go/plugins/net/netif/netif_unsupported.go
+++ b/src/go/plugins/net/netif/netif_unsupported.go
@@ -23,7 +23,7 @@
package netif
import (
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
func (p *Plugin) Export(key string, params []string, ctx plugin.ContextProvider) (result interface{}, err error) {
diff --git a/src/go/plugins/net/netif/netif_windows.go b/src/go/plugins/net/netif/netif_windows.go
index d7aefb7ff57..2d202121254 100644
--- a/src/go/plugins/net/netif/netif_windows.go
+++ b/src/go/plugins/net/netif/netif_windows.go
@@ -26,8 +26,8 @@ import (
"net"
"unsafe"
+ "git.zabbix.com/ap/plugin-support/plugin"
"golang.org/x/sys/windows"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/win32"
)
diff --git a/src/go/plugins/net/tcp/tcp.go b/src/go/plugins/net/tcp/tcp.go
index a1fedb31ac7..d09e1b09a04 100644
--- a/src/go/plugins/net/tcp/tcp.go
+++ b/src/go/plugins/net/tcp/tcp.go
@@ -31,10 +31,10 @@ import (
"strings"
"time"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"github.com/go-ldap/ldap"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/web"
)
diff --git a/src/go/plugins/net/tcp/tcp_nix.go b/src/go/plugins/net/tcp/tcp_nix.go
index 22d87c7d4ee..59ab5c9502b 100644
--- a/src/go/plugins/net/tcp/tcp_nix.go
+++ b/src/go/plugins/net/tcp/tcp_nix.go
@@ -25,7 +25,7 @@ package tcpudp
import (
"errors"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
func exportSystemTcpListen(port uint16) (result interface{}, err error) {
diff --git a/src/go/plugins/net/tcp/tcp_windows.go b/src/go/plugins/net/tcp/tcp_windows.go
index 356342ed7b4..f84e66e6420 100644
--- a/src/go/plugins/net/tcp/tcp_windows.go
+++ b/src/go/plugins/net/tcp/tcp_windows.go
@@ -23,7 +23,7 @@ import (
"encoding/binary"
"unsafe"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/win32"
)
diff --git a/src/go/plugins/net/udp/udp.go b/src/go/plugins/net/udp/udp.go
index f5a349d3b63..81781a82dbe 100644
--- a/src/go/plugins/net/udp/udp.go
+++ b/src/go/plugins/net/udp/udp.go
@@ -27,9 +27,9 @@ import (
"strconv"
"time"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
const (
diff --git a/src/go/plugins/oracle/config.go b/src/go/plugins/oracle/config.go
index 51fa8211d2e..72d4c7f4a2c 100644
--- a/src/go/plugins/oracle/config.go
+++ b/src/go/plugins/oracle/config.go
@@ -20,8 +20,8 @@
package oracle
import (
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type Session struct {
diff --git a/src/go/plugins/oracle/conn.go b/src/go/plugins/oracle/conn.go
index 24666044515..e3c5dea3428 100644
--- a/src/go/plugins/oracle/conn.go
+++ b/src/go/plugins/oracle/conn.go
@@ -28,12 +28,12 @@ import (
"sync"
"time"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/godror/godror"
"github.com/omeid/go-yarn"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/zbxerr"
)
type OraClient interface {
diff --git a/src/go/plugins/oracle/conn_test.go b/src/go/plugins/oracle/conn_test.go
index e02cd80bd75..f9df2f653e4 100644
--- a/src/go/plugins/oracle/conn_test.go
+++ b/src/go/plugins/oracle/conn_test.go
@@ -27,7 +27,7 @@ import (
"testing"
"time"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/uri"
"github.com/omeid/go-yarn"
)
diff --git a/src/go/plugins/oracle/handler_archive.go b/src/go/plugins/oracle/handler_archive.go
index 9c13b764342..ce2cbb5bfb7 100644
--- a/src/go/plugins/oracle/handler_archive.go
+++ b/src/go/plugins/oracle/handler_archive.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func archiveHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_archive_discovery.go b/src/go/plugins/oracle/handler_archive_discovery.go
index 9c5c93bd9fa..e8ded3044b1 100644
--- a/src/go/plugins/oracle/handler_archive_discovery.go
+++ b/src/go/plugins/oracle/handler_archive_discovery.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func archiveDiscoveryHandler(ctx context.Context, conn OraClient, params map[string]string,
diff --git a/src/go/plugins/oracle/handler_asm_diskgroups.go b/src/go/plugins/oracle/handler_asm_diskgroups.go
index a79345cb579..c5d638ee63a 100644
--- a/src/go/plugins/oracle/handler_asm_diskgroups.go
+++ b/src/go/plugins/oracle/handler_asm_diskgroups.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func asmDiskGroupsHandler(ctx context.Context, conn OraClient, params map[string]string,
diff --git a/src/go/plugins/oracle/handler_asm_diskgroups_discovery.go b/src/go/plugins/oracle/handler_asm_diskgroups_discovery.go
index 4b75059e53b..4e4c1a2fa7b 100644
--- a/src/go/plugins/oracle/handler_asm_diskgroups_discovery.go
+++ b/src/go/plugins/oracle/handler_asm_diskgroups_discovery.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func asmDiskGroupsDiscovery(ctx context.Context, conn OraClient, params map[string]string,
diff --git a/src/go/plugins/oracle/handler_cdb.go b/src/go/plugins/oracle/handler_cdb.go
index 7527546431b..9b071efa33d 100644
--- a/src/go/plugins/oracle/handler_cdb.go
+++ b/src/go/plugins/oracle/handler_cdb.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func cdbHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_custom_query.go b/src/go/plugins/oracle/handler_custom_query.go
index fea2af50c14..66c75817a69 100644
--- a/src/go/plugins/oracle/handler_custom_query.go
+++ b/src/go/plugins/oracle/handler_custom_query.go
@@ -25,7 +25,7 @@ import (
"encoding/json"
"strings"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
// customQueryHandler executes custom user queries
diff --git a/src/go/plugins/oracle/handler_databases_discovery.go b/src/go/plugins/oracle/handler_databases_discovery.go
index c2f5d0072b3..1797de5d896 100644
--- a/src/go/plugins/oracle/handler_databases_discovery.go
+++ b/src/go/plugins/oracle/handler_databases_discovery.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func databasesDiscoveryHandler(ctx context.Context, conn OraClient, params map[string]string,
diff --git a/src/go/plugins/oracle/handler_datafiles.go b/src/go/plugins/oracle/handler_datafiles.go
index 541b541f822..183b6576f0e 100644
--- a/src/go/plugins/oracle/handler_datafiles.go
+++ b/src/go/plugins/oracle/handler_datafiles.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func dataFileHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_fra.go b/src/go/plugins/oracle/handler_fra.go
index 65488ad666a..f896ae72c4d 100644
--- a/src/go/plugins/oracle/handler_fra.go
+++ b/src/go/plugins/oracle/handler_fra.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func fraHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_instance.go b/src/go/plugins/oracle/handler_instance.go
index e0977cd1134..6dfdbe5a6b2 100644
--- a/src/go/plugins/oracle/handler_instance.go
+++ b/src/go/plugins/oracle/handler_instance.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func instanceHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_pdb.go b/src/go/plugins/oracle/handler_pdb.go
index 9b3f9339183..24b9f67fe67 100644
--- a/src/go/plugins/oracle/handler_pdb.go
+++ b/src/go/plugins/oracle/handler_pdb.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func pdbHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_pdb_discovery.go b/src/go/plugins/oracle/handler_pdb_discovery.go
index 7d541100ec8..72cd5b0b0c2 100644
--- a/src/go/plugins/oracle/handler_pdb_discovery.go
+++ b/src/go/plugins/oracle/handler_pdb_discovery.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func pdbDiscoveryHandler(ctx context.Context, conn OraClient, params map[string]string,
diff --git a/src/go/plugins/oracle/handler_pga.go b/src/go/plugins/oracle/handler_pga.go
index d6e2d3b251d..a9fc35ed060 100644
--- a/src/go/plugins/oracle/handler_pga.go
+++ b/src/go/plugins/oracle/handler_pga.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func pgaHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_processes.go b/src/go/plugins/oracle/handler_processes.go
index c784710ef4e..ef8b1baabd6 100644
--- a/src/go/plugins/oracle/handler_processes.go
+++ b/src/go/plugins/oracle/handler_processes.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func procHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_redolog.go b/src/go/plugins/oracle/handler_redolog.go
index 9754d95f9fd..28acd23c5a1 100644
--- a/src/go/plugins/oracle/handler_redolog.go
+++ b/src/go/plugins/oracle/handler_redolog.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func redoLogHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_sessions.go b/src/go/plugins/oracle/handler_sessions.go
index 676b35ccf6c..8c0bffb211f 100644
--- a/src/go/plugins/oracle/handler_sessions.go
+++ b/src/go/plugins/oracle/handler_sessions.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func sessionsHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_sga.go b/src/go/plugins/oracle/handler_sga.go
index 4e348fafc4a..c2ac915e981 100644
--- a/src/go/plugins/oracle/handler_sga.go
+++ b/src/go/plugins/oracle/handler_sga.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func sgaHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_sysmetrics.go b/src/go/plugins/oracle/handler_sysmetrics.go
index a07ec3dcd84..43c1a5534f6 100644
--- a/src/go/plugins/oracle/handler_sysmetrics.go
+++ b/src/go/plugins/oracle/handler_sysmetrics.go
@@ -23,7 +23,7 @@ import (
"context"
"strings"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
const (
diff --git a/src/go/plugins/oracle/handler_sysparams.go b/src/go/plugins/oracle/handler_sysparams.go
index a8c5ea6552a..dff09d69d6a 100644
--- a/src/go/plugins/oracle/handler_sysparams.go
+++ b/src/go/plugins/oracle/handler_sysparams.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func sysParamsHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/handler_tablespaces.go b/src/go/plugins/oracle/handler_tablespaces.go
index 6f11b694215..9c1191e54b9 100644
--- a/src/go/plugins/oracle/handler_tablespaces.go
+++ b/src/go/plugins/oracle/handler_tablespaces.go
@@ -23,7 +23,7 @@ import (
"context"
"strings"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func tablespacesHandler(ctx context.Context, conn OraClient, params map[string]string,
diff --git a/src/go/plugins/oracle/handler_tablespaces_discovery.go b/src/go/plugins/oracle/handler_tablespaces_discovery.go
index cfef1ee923f..2a6baec6480 100644
--- a/src/go/plugins/oracle/handler_tablespaces_discovery.go
+++ b/src/go/plugins/oracle/handler_tablespaces_discovery.go
@@ -22,7 +22,7 @@ package oracle
import (
"context"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func tablespacesDiscoveryHandler(ctx context.Context, conn OraClient, params map[string]string,
diff --git a/src/go/plugins/oracle/handler_user.go b/src/go/plugins/oracle/handler_user.go
index da742c916f0..bc5d346a3bc 100644
--- a/src/go/plugins/oracle/handler_user.go
+++ b/src/go/plugins/oracle/handler_user.go
@@ -23,7 +23,7 @@ import (
"context"
"database/sql"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func userHandler(ctx context.Context, conn OraClient, params map[string]string, _ ...string) (interface{}, error) {
diff --git a/src/go/plugins/oracle/metrics.go b/src/go/plugins/oracle/metrics.go
index 9cce753fb37..d967bb953d5 100644
--- a/src/go/plugins/oracle/metrics.go
+++ b/src/go/plugins/oracle/metrics.go
@@ -22,9 +22,9 @@ package oracle
import (
"context"
- "zabbix.com/pkg/metric"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/metric"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/uri"
)
const (
diff --git a/src/go/plugins/oracle/oracle.go b/src/go/plugins/oracle/oracle.go
index e49e6bbb16c..da6be0fa3f8 100644
--- a/src/go/plugins/oracle/oracle.go
+++ b/src/go/plugins/oracle/oracle.go
@@ -25,12 +25,12 @@ import (
"net/url"
"time"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/omeid/go-yarn"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
const (
diff --git a/src/go/plugins/oracle/oracle_test.go b/src/go/plugins/oracle/oracle_test.go
index 98cb938e7f5..cfc9c3be78a 100644
--- a/src/go/plugins/oracle/oracle_test.go
+++ b/src/go/plugins/oracle/oracle_test.go
@@ -32,11 +32,11 @@ import (
"strings"
"testing"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/omeid/go-yarn"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type TestConfig struct {
diff --git a/src/go/plugins/postgres/config.go b/src/go/plugins/postgres/config.go
index 4191b27c7b5..4f37d9ae77f 100755
--- a/src/go/plugins/postgres/config.go
+++ b/src/go/plugins/postgres/config.go
@@ -20,8 +20,8 @@
package postgres
import (
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Session struct holds individual options for PostgreSQL connection for each session.
diff --git a/src/go/plugins/postgres/conn.go b/src/go/plugins/postgres/conn.go
index 9303393b997..fd697e49cf3 100755
--- a/src/go/plugins/postgres/conn.go
+++ b/src/go/plugins/postgres/conn.go
@@ -31,13 +31,13 @@ import (
"sync"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v4/stdlib"
"github.com/omeid/go-yarn"
- "zabbix.com/pkg/log"
"zabbix.com/pkg/tlsconfig"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/zbxerr"
)
const MinSupportedPGVersion = 100000
diff --git a/src/go/plugins/postgres/handler_archive.go b/src/go/plugins/postgres/handler_archive.go
index 72ded4f0e93..9a0641d0165 100644
--- a/src/go/plugins/postgres/handler_archive.go
+++ b/src/go/plugins/postgres/handler_archive.go
@@ -22,8 +22,9 @@ package postgres
import (
"context"
"errors"
+
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// archiveHandler gets info about count and size of archive files and returns JSON if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_autovacuum.go b/src/go/plugins/postgres/handler_autovacuum.go
index 8d69874c174..9274328ef1a 100644
--- a/src/go/plugins/postgres/handler_autovacuum.go
+++ b/src/go/plugins/postgres/handler_autovacuum.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// autovacuumHandler returns count of autovacuum workers if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_bgwriter.go b/src/go/plugins/postgres/handler_bgwriter.go
index 21ee46a5a33..f5a29fb3f74 100644
--- a/src/go/plugins/postgres/handler_bgwriter.go
+++ b/src/go/plugins/postgres/handler_bgwriter.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// bgwriterHandler executes select with statistics from pg_stat_bgwriter
diff --git a/src/go/plugins/postgres/handler_cache.go b/src/go/plugins/postgres/handler_cache.go
index eec459c2165..84ce45cf3ce 100644
--- a/src/go/plugins/postgres/handler_cache.go
+++ b/src/go/plugins/postgres/handler_cache.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// cacheHandler finds cache hit percent and returns int64 if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_connections.go b/src/go/plugins/postgres/handler_connections.go
index 7b0b725ce53..74e82a9705a 100644
--- a/src/go/plugins/postgres/handler_connections.go
+++ b/src/go/plugins/postgres/handler_connections.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// connectionsHandler executes select from pg_stat_activity command and returns JSON if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_custom_query.go b/src/go/plugins/postgres/handler_custom_query.go
index 200be03fb76..57c640b3b7f 100644
--- a/src/go/plugins/postgres/handler_custom_query.go
+++ b/src/go/plugins/postgres/handler_custom_query.go
@@ -25,8 +25,8 @@ import (
"errors"
"strings"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// customQueryHandler executes custom user queries from *.sql files.
diff --git a/src/go/plugins/postgres/handler_database_age.go b/src/go/plugins/postgres/handler_database_age.go
index 42c2a5af04f..384ace13541 100644
--- a/src/go/plugins/postgres/handler_database_age.go
+++ b/src/go/plugins/postgres/handler_database_age.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// databaseAgeHandler gets age of specific database respectively or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_database_size.go b/src/go/plugins/postgres/handler_database_size.go
index eeb6db4ee10..69f75fc818f 100644
--- a/src/go/plugins/postgres/handler_database_size.go
+++ b/src/go/plugins/postgres/handler_database_size.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// databaseSizeHandler gets info about count and size of archive files and returns JSON if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_databases_bloating.go b/src/go/plugins/postgres/handler_databases_bloating.go
index 6b01f2397f4..c865cf68ad0 100644
--- a/src/go/plugins/postgres/handler_databases_bloating.go
+++ b/src/go/plugins/postgres/handler_databases_bloating.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// databasesBloatingHandler gets info about count and size of archive files and returns JSON if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_databases_discovery.go b/src/go/plugins/postgres/handler_databases_discovery.go
index d0637c16d52..2010cd79377 100644
--- a/src/go/plugins/postgres/handler_databases_discovery.go
+++ b/src/go/plugins/postgres/handler_databases_discovery.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// databasesDiscoveryHandler gets names of all databases and returns JSON if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_dbstat.go b/src/go/plugins/postgres/handler_dbstat.go
index fe4e23eccff..0818ab83569 100644
--- a/src/go/plugins/postgres/handler_dbstat.go
+++ b/src/go/plugins/postgres/handler_dbstat.go
@@ -24,8 +24,8 @@ import (
"errors"
"fmt"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
const pgVersionWithChecksum = 120000
diff --git a/src/go/plugins/postgres/handler_locks.go b/src/go/plugins/postgres/handler_locks.go
index 89e75178c3b..1dfba036d9e 100644
--- a/src/go/plugins/postgres/handler_locks.go
+++ b/src/go/plugins/postgres/handler_locks.go
@@ -23,7 +23,7 @@ import (
"context"
"errors"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
// locksHandler executes select from pg_stat_database command and returns JSON if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_oldest_xid.go b/src/go/plugins/postgres/handler_oldest_xid.go
index e02aa0d05e2..4140fd6fde1 100644
--- a/src/go/plugins/postgres/handler_oldest_xid.go
+++ b/src/go/plugins/postgres/handler_oldest_xid.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// oldestXIDHandler gets age of the oldest xid if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_queries.go b/src/go/plugins/postgres/handler_queries.go
index 82524582125..6ce96cc1c63 100644
--- a/src/go/plugins/postgres/handler_queries.go
+++ b/src/go/plugins/postgres/handler_queries.go
@@ -24,7 +24,7 @@ import (
"fmt"
"strconv"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
// queriesHandler executes select from pg_database command and returns JSON if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_replication.go b/src/go/plugins/postgres/handler_replication.go
index 6dc8cce0931..8bd2aaebfe1 100644
--- a/src/go/plugins/postgres/handler_replication.go
+++ b/src/go/plugins/postgres/handler_replication.go
@@ -25,8 +25,8 @@ import (
"errors"
"strconv"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// replicationHandler gets info about recovery state if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/handler_replication_process_name_discovery.go b/src/go/plugins/postgres/handler_replication_process_name_discovery.go
index fbfec767991..8fe5d3302c3 100644
--- a/src/go/plugins/postgres/handler_replication_process_name_discovery.go
+++ b/src/go/plugins/postgres/handler_replication_process_name_discovery.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// processNameDiscoveryHandler gets names of all sender processes in pg_stat_replication
diff --git a/src/go/plugins/postgres/handler_uptime.go b/src/go/plugins/postgres/handler_uptime.go
index 25ac539aeef..23f6979be5d 100644
--- a/src/go/plugins/postgres/handler_uptime.go
+++ b/src/go/plugins/postgres/handler_uptime.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// uptimeHandler finds difference btw current time and
diff --git a/src/go/plugins/postgres/handler_wal.go b/src/go/plugins/postgres/handler_wal.go
index d086e5b479f..822234f4125 100644
--- a/src/go/plugins/postgres/handler_wal.go
+++ b/src/go/plugins/postgres/handler_wal.go
@@ -23,8 +23,8 @@ import (
"context"
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/jackc/pgx/v4"
- "zabbix.com/pkg/zbxerr"
)
// walHandler executes select from directory which contains wal files and returns JSON if all is OK or nil otherwise.
diff --git a/src/go/plugins/postgres/metrics.go b/src/go/plugins/postgres/metrics.go
index 245948d0695..3654ef90720 100644
--- a/src/go/plugins/postgres/metrics.go
+++ b/src/go/plugins/postgres/metrics.go
@@ -26,9 +26,9 @@ import (
"regexp"
"strings"
- "zabbix.com/pkg/metric"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/metric"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/uri"
)
const (
diff --git a/src/go/plugins/postgres/postgres.go b/src/go/plugins/postgres/postgres.go
index 3dc97fa9b69..c4031facccc 100755
--- a/src/go/plugins/postgres/postgres.go
+++ b/src/go/plugins/postgres/postgres.go
@@ -25,13 +25,13 @@ import (
"net/url"
"time"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"zabbix.com/pkg/tlsconfig"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/zbxerr"
"github.com/omeid/go-yarn"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
const (
diff --git a/src/go/plugins/postgres/postgres_test.go b/src/go/plugins/postgres/postgres_test.go
index 40d993b845c..4255bee0d2d 100755
--- a/src/go/plugins/postgres/postgres_test.go
+++ b/src/go/plugins/postgres/postgres_test.go
@@ -27,9 +27,9 @@ import (
"reflect"
"testing"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"github.com/omeid/go-yarn"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
)
var testParamDatabase = map[string]string{"Database": "postgres"}
diff --git a/src/go/plugins/postgres/testpool.go b/src/go/plugins/postgres/testpool.go
index c20a749e697..79a98afca8e 100644
--- a/src/go/plugins/postgres/testpool.go
+++ b/src/go/plugins/postgres/testpool.go
@@ -27,7 +27,8 @@ import (
"fmt"
"os"
"time"
- "zabbix.com/pkg/log"
+
+ "git.zabbix.com/ap/plugin-support/log"
)
var sharedConn *PGConn
diff --git a/src/go/plugins/proc/proc_linux.go b/src/go/plugins/proc/proc_linux.go
index e267786c374..b477e13cf57 100644
--- a/src/go/plugins/proc/proc_linux.go
+++ b/src/go/plugins/proc/proc_linux.go
@@ -37,8 +37,8 @@ import (
"sync"
"time"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/procfs"
)
diff --git a/src/go/plugins/proc/proc_windows.go b/src/go/plugins/proc/proc_windows.go
index 405f3e34a34..0cc3e86f94b 100644
--- a/src/go/plugins/proc/proc_windows.go
+++ b/src/go/plugins/proc/proc_windows.go
@@ -25,8 +25,8 @@ import (
"syscall"
"unsafe"
+ "git.zabbix.com/ap/plugin-support/plugin"
"golang.org/x/sys/windows"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/win32"
)
diff --git a/src/go/plugins/redis/config.go b/src/go/plugins/redis/config.go
index f8913012c76..6cafb0d3e6c 100644
--- a/src/go/plugins/redis/config.go
+++ b/src/go/plugins/redis/config.go
@@ -20,8 +20,8 @@
package redis
import (
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type Session struct {
diff --git a/src/go/plugins/redis/conn.go b/src/go/plugins/redis/conn.go
index bf47c01a383..e4da2e87e74 100644
--- a/src/go/plugins/redis/conn.go
+++ b/src/go/plugins/redis/conn.go
@@ -25,10 +25,10 @@ import (
"sync"
"time"
+ "git.zabbix.com/ap/plugin-support/log"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/mediocregopher/radix/v3"
- "zabbix.com/pkg/log"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/zbxerr"
)
const hkInterval = 10
diff --git a/src/go/plugins/redis/conn_test.go b/src/go/plugins/redis/conn_test.go
index 423039e5a69..76f8dd04351 100644
--- a/src/go/plugins/redis/conn_test.go
+++ b/src/go/plugins/redis/conn_test.go
@@ -24,8 +24,8 @@ import (
"testing"
"time"
+ "git.zabbix.com/ap/plugin-support/uri"
"github.com/mediocregopher/radix/v3"
- "zabbix.com/pkg/uri"
)
func TestConnManager_closeUnused(t *testing.T) {
diff --git a/src/go/plugins/redis/handler_config.go b/src/go/plugins/redis/handler_config.go
index d712cc0b094..17fed798ac4 100644
--- a/src/go/plugins/redis/handler_config.go
+++ b/src/go/plugins/redis/handler_config.go
@@ -24,8 +24,8 @@ import (
"fmt"
"strings"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/mediocregopher/radix/v3"
- "zabbix.com/pkg/zbxerr"
)
const globChars = "*?[]!"
diff --git a/src/go/plugins/redis/handler_info.go b/src/go/plugins/redis/handler_info.go
index 8fc3c04e5a5..95327841bf1 100644
--- a/src/go/plugins/redis/handler_info.go
+++ b/src/go/plugins/redis/handler_info.go
@@ -25,7 +25,7 @@ import (
"regexp"
"strings"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/mediocregopher/radix/v3"
)
diff --git a/src/go/plugins/redis/handler_slowlog.go b/src/go/plugins/redis/handler_slowlog.go
index c86adc410eb..26f88c0abaa 100644
--- a/src/go/plugins/redis/handler_slowlog.go
+++ b/src/go/plugins/redis/handler_slowlog.go
@@ -20,8 +20,8 @@
package redis
import (
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"github.com/mediocregopher/radix/v3"
- "zabbix.com/pkg/zbxerr"
)
type slowlog []interface{}
diff --git a/src/go/plugins/redis/metrics.go b/src/go/plugins/redis/metrics.go
index c8c54f37480..21fd08dcd51 100644
--- a/src/go/plugins/redis/metrics.go
+++ b/src/go/plugins/redis/metrics.go
@@ -20,9 +20,9 @@
package redis
import (
- "zabbix.com/pkg/metric"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/metric"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/uri"
)
// handlerFunc defines an interface must be implemented by handlers.
diff --git a/src/go/plugins/redis/redis.go b/src/go/plugins/redis/redis.go
index 4968e6de37b..a89e7526c42 100644
--- a/src/go/plugins/redis/redis.go
+++ b/src/go/plugins/redis/redis.go
@@ -22,9 +22,9 @@ package redis
import (
"time"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
const pluginName = "Redis"
diff --git a/src/go/plugins/redis/redis_test.go b/src/go/plugins/redis/redis_test.go
index e0f28fca000..ee8133e9cd7 100644
--- a/src/go/plugins/redis/redis_test.go
+++ b/src/go/plugins/redis/redis_test.go
@@ -23,7 +23,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
func TestPlugin_Start(t *testing.T) {
diff --git a/src/go/plugins/smart/smart.go b/src/go/plugins/smart/smart.go
index 36bb16d9b8a..32d0c87b52f 100644
--- a/src/go/plugins/smart/smart.go
+++ b/src/go/plugins/smart/smart.go
@@ -24,9 +24,9 @@ import (
"fmt"
"strings"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
const (
diff --git a/src/go/plugins/smart/smartfs.go b/src/go/plugins/smart/smartfs.go
index b695e853ba4..dc90ccd6d54 100644
--- a/src/go/plugins/smart/smartfs.go
+++ b/src/go/plugins/smart/smartfs.go
@@ -30,7 +30,7 @@ import (
"sync"
"time"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
const (
diff --git a/src/go/plugins/system/cpu/cpu.go b/src/go/plugins/system/cpu/cpu.go
index 5f22df69edf..d4783ee5349 100644
--- a/src/go/plugins/system/cpu/cpu.go
+++ b/src/go/plugins/system/cpu/cpu.go
@@ -24,7 +24,7 @@ import (
"errors"
"strconv"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
const pluginName = "Cpu"
diff --git a/src/go/plugins/system/cpu/cpu_linux.go b/src/go/plugins/system/cpu/cpu_linux.go
index d52fff06fd4..188db3ea6a7 100644
--- a/src/go/plugins/system/cpu/cpu_linux.go
+++ b/src/go/plugins/system/cpu/cpu_linux.go
@@ -31,7 +31,7 @@ import (
"strconv"
"strings"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Plugin -
diff --git a/src/go/plugins/system/cpu/cpu_windows.go b/src/go/plugins/system/cpu/cpu_windows.go
index eff02894286..8dd6817e9dc 100644
--- a/src/go/plugins/system/cpu/cpu_windows.go
+++ b/src/go/plugins/system/cpu/cpu_windows.go
@@ -23,9 +23,9 @@ import (
"errors"
"unsafe"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"zabbix.com/pkg/win32"
- "zabbix.com/pkg/zbxerr"
)
// Plugin -
diff --git a/src/go/plugins/system/cpu/pdhcollector_windows.go b/src/go/plugins/system/cpu/pdhcollector_windows.go
index 8ab789cba9b..2cb077e148f 100644
--- a/src/go/plugins/system/cpu/pdhcollector_windows.go
+++ b/src/go/plugins/system/cpu/pdhcollector_windows.go
@@ -23,7 +23,7 @@ import (
"fmt"
"unsafe"
- "zabbix.com/pkg/log"
+ "git.zabbix.com/ap/plugin-support/log"
"zabbix.com/pkg/pdh"
"zabbix.com/pkg/win32"
)
diff --git a/src/go/plugins/system/hw/hw_linux.go b/src/go/plugins/system/hw/hw_linux.go
index e2a7c17f151..7e8c5e23e5c 100644
--- a/src/go/plugins/system/hw/hw_linux.go
+++ b/src/go/plugins/system/hw/hw_linux.go
@@ -24,9 +24,9 @@ import (
"strings"
"time"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"zabbix.com/pkg/zbxcmd"
- "zabbix.com/pkg/zbxerr"
)
const (
diff --git a/src/go/plugins/system/sw/sw.go b/src/go/plugins/system/sw/sw.go
index 0abaf05fb3b..ebb63625d50 100644
--- a/src/go/plugins/system/sw/sw.go
+++ b/src/go/plugins/system/sw/sw.go
@@ -30,9 +30,9 @@ import (
"strings"
"time"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"zabbix.com/pkg/zbxcmd"
- "zabbix.com/pkg/zbxerr"
)
// Plugin -
diff --git a/src/go/plugins/system/swap/swap.go b/src/go/plugins/system/swap/swap.go
index efdef39a348..d5228c916f3 100644
--- a/src/go/plugins/system/swap/swap.go
+++ b/src/go/plugins/system/swap/swap.go
@@ -23,7 +23,7 @@ import (
"errors"
"fmt"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Plugin -
diff --git a/src/go/plugins/system/uname/uname.go b/src/go/plugins/system/uname/uname.go
index 2f00ced7764..6416fd3e628 100644
--- a/src/go/plugins/system/uname/uname.go
+++ b/src/go/plugins/system/uname/uname.go
@@ -20,7 +20,7 @@
package uname
import (
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Plugin -
diff --git a/src/go/plugins/system/uptime/uptime.go b/src/go/plugins/system/uptime/uptime.go
index 42244055154..5ba01afc30b 100644
--- a/src/go/plugins/system/uptime/uptime.go
+++ b/src/go/plugins/system/uptime/uptime.go
@@ -22,8 +22,8 @@ package uptime
import (
"errors"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/std"
)
// Plugin -
diff --git a/src/go/plugins/system/uptime/uptime_linux.go b/src/go/plugins/system/uptime/uptime_linux.go
index 1b73f0aae66..dd7dab4d930 100644
--- a/src/go/plugins/system/uptime/uptime_linux.go
+++ b/src/go/plugins/system/uptime/uptime_linux.go
@@ -27,7 +27,7 @@ import (
"strings"
"time"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
func getUptime() (uptime int, err error) {
diff --git a/src/go/plugins/system/uptime/uptime_test.go b/src/go/plugins/system/uptime/uptime_test.go
index 40c3ee7f001..8cc9c0b83d0 100644
--- a/src/go/plugins/system/uptime/uptime_test.go
+++ b/src/go/plugins/system/uptime/uptime_test.go
@@ -27,7 +27,7 @@ import (
"testing"
"time"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
var procStat = `
diff --git a/src/go/plugins/system/users/users.go b/src/go/plugins/system/users/users.go
index 9faebbdab8b..ebf486e1de6 100644
--- a/src/go/plugins/system/users/users.go
+++ b/src/go/plugins/system/users/users.go
@@ -23,7 +23,7 @@ import (
"errors"
"fmt"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
type Plugin struct {
diff --git a/src/go/plugins/systemd/systemd.go b/src/go/plugins/systemd/systemd.go
index 1c00aba813a..8e9c551370d 100644
--- a/src/go/plugins/systemd/systemd.go
+++ b/src/go/plugins/systemd/systemd.go
@@ -27,7 +27,7 @@ import (
"strings"
"sync"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
"github.com/godbus/dbus"
)
diff --git a/src/go/plugins/systemrun/systemrun.go b/src/go/plugins/systemrun/systemrun.go
index 8707ecb4bab..e1c9817706e 100644
--- a/src/go/plugins/systemrun/systemrun.go
+++ b/src/go/plugins/systemrun/systemrun.go
@@ -23,9 +23,9 @@ import (
"fmt"
"time"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/zbxcmd"
)
diff --git a/src/go/plugins/vfs/dev/dev.go b/src/go/plugins/vfs/dev/dev.go
index f99f22bdd1c..91668adebbd 100644
--- a/src/go/plugins/vfs/dev/dev.go
+++ b/src/go/plugins/vfs/dev/dev.go
@@ -24,7 +24,7 @@ import (
"sync"
"time"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// Plugin -
diff --git a/src/go/plugins/vfs/dir/count.go b/src/go/plugins/vfs/dir/count.go
index 45438c83c2d..76777492a22 100644
--- a/src/go/plugins/vfs/dir/count.go
+++ b/src/go/plugins/vfs/dir/count.go
@@ -27,9 +27,9 @@ import (
"strings"
"time"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
const (
diff --git a/src/go/plugins/vfs/dir/dir.go b/src/go/plugins/vfs/dir/dir.go
index 40901c01d3b..84be106b5a6 100644
--- a/src/go/plugins/vfs/dir/dir.go
+++ b/src/go/plugins/vfs/dir/dir.go
@@ -25,8 +25,8 @@ import (
"regexp"
"strings"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
var impl Plugin
diff --git a/src/go/plugins/vfs/dir/size.go b/src/go/plugins/vfs/dir/size.go
index 2e69615f062..c558b620dd5 100644
--- a/src/go/plugins/vfs/dir/size.go
+++ b/src/go/plugins/vfs/dir/size.go
@@ -26,7 +26,7 @@ import (
"strconv"
"strings"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
const (
diff --git a/src/go/plugins/vfs/file/cksum.go b/src/go/plugins/vfs/file/cksum.go
index 4e71fc986d7..b493f9b8c6f 100644
--- a/src/go/plugins/vfs/file/cksum.go
+++ b/src/go/plugins/vfs/file/cksum.go
@@ -24,8 +24,8 @@ import (
"fmt"
"time"
- "zabbix.com/pkg/std"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/std"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type checkSum func(file std.File, start time.Time, timeout int) (result interface{}, err error)
diff --git a/src/go/plugins/vfs/file/cksum_test.go b/src/go/plugins/vfs/file/cksum_test.go
index 05202c3ec8f..2e56bc01fc8 100644
--- a/src/go/plugins/vfs/file/cksum_test.go
+++ b/src/go/plugins/vfs/file/cksum_test.go
@@ -26,7 +26,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
var CrcFile = "1234"
diff --git a/src/go/plugins/vfs/file/contents_test.go b/src/go/plugins/vfs/file/contents_test.go
index 1980e02a91b..789abe3fab4 100644
--- a/src/go/plugins/vfs/file/contents_test.go
+++ b/src/go/plugins/vfs/file/contents_test.go
@@ -26,7 +26,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
func TestFileContentsEncoding(t *testing.T) {
diff --git a/src/go/plugins/vfs/file/exists_test.go b/src/go/plugins/vfs/file/exists_test.go
index 69fdce254c2..7b7ec73ab53 100644
--- a/src/go/plugins/vfs/file/exists_test.go
+++ b/src/go/plugins/vfs/file/exists_test.go
@@ -26,7 +26,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
func TestFileExists(t *testing.T) {
diff --git a/src/go/plugins/vfs/file/file.go b/src/go/plugins/vfs/file/file.go
index 8a581a47cb6..3fe6ef06c32 100644
--- a/src/go/plugins/vfs/file/file.go
+++ b/src/go/plugins/vfs/file/file.go
@@ -20,9 +20,9 @@
package file
import (
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/std"
)
type Options struct {
diff --git a/src/go/plugins/vfs/file/get.go b/src/go/plugins/vfs/file/get.go
index f9155838f7e..2759744aee9 100644
--- a/src/go/plugins/vfs/file/get.go
+++ b/src/go/plugins/vfs/file/get.go
@@ -25,7 +25,7 @@ import (
"os"
"time"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type jsTimeLoc time.Time
diff --git a/src/go/plugins/vfs/file/get_windows.go b/src/go/plugins/vfs/file/get_windows.go
index 078f291a5a9..b4dc0888b95 100644
--- a/src/go/plugins/vfs/file/get_windows.go
+++ b/src/go/plugins/vfs/file/get_windows.go
@@ -26,8 +26,8 @@ import (
"syscall"
"time"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"golang.org/x/sys/windows"
- "zabbix.com/pkg/zbxerr"
)
type userInfo struct {
diff --git a/src/go/plugins/vfs/file/md5sum.go b/src/go/plugins/vfs/file/md5sum.go
index 19a9580c03b..33c99c96d5c 100644
--- a/src/go/plugins/vfs/file/md5sum.go
+++ b/src/go/plugins/vfs/file/md5sum.go
@@ -26,8 +26,8 @@ import (
"io"
"time"
- "zabbix.com/pkg/std"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/std"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
func md5sum(file std.File, start time.Time, timeout int) (result interface{}, err error) {
diff --git a/src/go/plugins/vfs/file/md5sum_test.go b/src/go/plugins/vfs/file/md5sum_test.go
index cae28083644..461b2518c67 100644
--- a/src/go/plugins/vfs/file/md5sum_test.go
+++ b/src/go/plugins/vfs/file/md5sum_test.go
@@ -26,7 +26,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
var Md5File = "1234"
diff --git a/src/go/plugins/vfs/file/owner_nix.go b/src/go/plugins/vfs/file/owner_nix.go
index ac25587db15..621b2369a42 100644
--- a/src/go/plugins/vfs/file/owner_nix.go
+++ b/src/go/plugins/vfs/file/owner_nix.go
@@ -30,7 +30,7 @@ import (
"strconv"
"syscall"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
// Export -
diff --git a/src/go/plugins/vfs/file/owner_windows.go b/src/go/plugins/vfs/file/owner_windows.go
index f9868073fd0..b1d5c57d23a 100644
--- a/src/go/plugins/vfs/file/owner_windows.go
+++ b/src/go/plugins/vfs/file/owner_windows.go
@@ -25,8 +25,8 @@ package file
import (
"errors"
"fmt"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"golang.org/x/sys/windows"
- "zabbix.com/pkg/zbxerr"
)
// Export -
diff --git a/src/go/plugins/vfs/file/permissions_nix.go b/src/go/plugins/vfs/file/permissions_nix.go
index 76ab912072a..f9306ada382 100644
--- a/src/go/plugins/vfs/file/permissions_nix.go
+++ b/src/go/plugins/vfs/file/permissions_nix.go
@@ -27,7 +27,7 @@ import (
"fmt"
"syscall"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
// mode2str - permission printable format
diff --git a/src/go/plugins/vfs/file/permissions_windows.go b/src/go/plugins/vfs/file/permissions_windows.go
index 7a3cb922b02..9387c6ad1c3 100644
--- a/src/go/plugins/vfs/file/permissions_windows.go
+++ b/src/go/plugins/vfs/file/permissions_windows.go
@@ -23,7 +23,7 @@
package file
import (
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
// exportPermissions - returns 4-digit string containing octal number with Unix permissions
diff --git a/src/go/plugins/vfs/file/regexp_test.go b/src/go/plugins/vfs/file/regexp_test.go
index 9b401bd9e01..ac5b8cc55cc 100644
--- a/src/go/plugins/vfs/file/regexp_test.go
+++ b/src/go/plugins/vfs/file/regexp_test.go
@@ -27,7 +27,7 @@ import (
"regexp"
"testing"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
"zabbix.com/pkg/zbxregexp"
)
diff --git a/src/go/plugins/vfs/file/regmatch_test.go b/src/go/plugins/vfs/file/regmatch_test.go
index 8bd74fdd630..188412052fb 100644
--- a/src/go/plugins/vfs/file/regmatch_test.go
+++ b/src/go/plugins/vfs/file/regmatch_test.go
@@ -26,7 +26,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
func TestFileRegmatch(t *testing.T) {
diff --git a/src/go/plugins/vfs/file/sha256sum.go b/src/go/plugins/vfs/file/sha256sum.go
index 01b5af28e5f..e50e57be0c1 100644
--- a/src/go/plugins/vfs/file/sha256sum.go
+++ b/src/go/plugins/vfs/file/sha256sum.go
@@ -26,7 +26,7 @@ import (
"io"
"time"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
func sha256sum(file std.File, start time.Time, timeout int) (result interface{}, err error) {
diff --git a/src/go/plugins/vfs/file/size.go b/src/go/plugins/vfs/file/size.go
index 1daf8fc29a8..981a5da5425 100644
--- a/src/go/plugins/vfs/file/size.go
+++ b/src/go/plugins/vfs/file/size.go
@@ -26,7 +26,7 @@ import (
"io"
"os"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
// Export -
diff --git a/src/go/plugins/vfs/file/size_test.go b/src/go/plugins/vfs/file/size_test.go
index bcc9a1783c0..e6545367d3f 100644
--- a/src/go/plugins/vfs/file/size_test.go
+++ b/src/go/plugins/vfs/file/size_test.go
@@ -26,7 +26,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
func TestFileSize(t *testing.T) {
diff --git a/src/go/plugins/vfs/file/time_nix.go b/src/go/plugins/vfs/file/time_nix.go
index 33fa853c416..04862adeaa8 100644
--- a/src/go/plugins/vfs/file/time_nix.go
+++ b/src/go/plugins/vfs/file/time_nix.go
@@ -27,7 +27,7 @@ import (
"fmt"
"syscall"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
// Export -
diff --git a/src/go/plugins/vfs/file/time_test.go b/src/go/plugins/vfs/file/time_test.go
index 4ee6977b98d..00be01e2cb0 100644
--- a/src/go/plugins/vfs/file/time_test.go
+++ b/src/go/plugins/vfs/file/time_test.go
@@ -26,7 +26,7 @@ import (
"reflect"
"testing"
- "zabbix.com/pkg/std"
+ "git.zabbix.com/ap/plugin-support/std"
)
func TestFileModifyTime(t *testing.T) {
diff --git a/src/go/plugins/vfs/file/time_windows.go b/src/go/plugins/vfs/file/time_windows.go
index b03ab9fc387..3798aaf5d00 100644
--- a/src/go/plugins/vfs/file/time_windows.go
+++ b/src/go/plugins/vfs/file/time_windows.go
@@ -29,8 +29,8 @@ import (
"syscall"
"unsafe"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"golang.org/x/sys/windows"
- "zabbix.com/pkg/zbxerr"
)
const (
diff --git a/src/go/plugins/vfs/fs/fs.go b/src/go/plugins/vfs/fs/fs.go
index cdab0191efd..be9fd8f8fcf 100644
--- a/src/go/plugins/vfs/fs/fs.go
+++ b/src/go/plugins/vfs/fs/fs.go
@@ -23,7 +23,7 @@ import (
"encoding/json"
"errors"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
)
const (
diff --git a/src/go/plugins/vfs/fs/fs_nix.go b/src/go/plugins/vfs/fs/fs_nix.go
index dc335f60c9f..5f26e966dd2 100644
--- a/src/go/plugins/vfs/fs/fs_nix.go
+++ b/src/go/plugins/vfs/fs/fs_nix.go
@@ -28,8 +28,8 @@ import (
"os"
"strings"
+ "git.zabbix.com/ap/plugin-support/plugin"
"golang.org/x/sys/unix"
- "zabbix.com/pkg/plugin"
)
func (p *Plugin) getFsInfoStats() (data []*FsInfoNew, err error) {
diff --git a/src/go/plugins/vfs/fs/fs_windows.go b/src/go/plugins/vfs/fs/fs_windows.go
index 9d75285f84e..1d5233803fe 100644
--- a/src/go/plugins/vfs/fs/fs_windows.go
+++ b/src/go/plugins/vfs/fs/fs_windows.go
@@ -22,8 +22,8 @@ package vfsfs
import (
"syscall"
+ "git.zabbix.com/ap/plugin-support/plugin"
"golang.org/x/sys/windows"
- "zabbix.com/pkg/plugin"
)
func getMountPaths() (paths []string, err error) {
@@ -33,7 +33,7 @@ func getMountPaths() (paths []string, err error) {
if h, err = windows.FindFirstVolume(&volume[0], uint32(len(volume))); err != nil {
return
}
- defer windows.FindClose(h)
+ defer windows.FindVolumeClose(h)
var result []string
var size uint32
diff --git a/src/go/plugins/vm/memory/memory.go b/src/go/plugins/vm/memory/memory.go
index f7e7e067903..5aac6bac2d2 100644
--- a/src/go/plugins/vm/memory/memory.go
+++ b/src/go/plugins/vm/memory/memory.go
@@ -20,8 +20,8 @@
package memory
import (
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
// Plugin -
diff --git a/src/go/plugins/vm/memory/memory_linux.go b/src/go/plugins/vm/memory/memory_linux.go
index a52cf1b3d24..fd67456a869 100644
--- a/src/go/plugins/vm/memory/memory_linux.go
+++ b/src/go/plugins/vm/memory/memory_linux.go
@@ -22,8 +22,8 @@ package memory
import (
"errors"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"zabbix.com/pkg/procfs"
- "zabbix.com/pkg/zbxerr"
)
func (p *Plugin) exportVMMemorySize(mode string) (result interface{}, err error) {
diff --git a/src/go/plugins/vm/vmemory/vmemory_windows.go b/src/go/plugins/vm/vmemory/vmemory_windows.go
index 5ec0a269f19..0772d76e499 100644
--- a/src/go/plugins/vm/vmemory/vmemory_windows.go
+++ b/src/go/plugins/vm/vmemory/vmemory_windows.go
@@ -20,9 +20,9 @@
package vmemory
import (
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
"zabbix.com/pkg/win32"
- "zabbix.com/pkg/zbxerr"
)
// Plugin -
diff --git a/src/go/plugins/web/certificate/certificate.go b/src/go/plugins/web/certificate/certificate.go
index 94d017bcfd6..18ee2aa45ff 100644
--- a/src/go/plugins/web/certificate/certificate.go
+++ b/src/go/plugins/web/certificate/certificate.go
@@ -30,10 +30,10 @@ import (
"strings"
"time"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
- "zabbix.com/pkg/uri"
- "zabbix.com/pkg/zbxerr"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
+ "git.zabbix.com/ap/plugin-support/uri"
+ "git.zabbix.com/ap/plugin-support/zbxerr"
)
type Output struct {
diff --git a/src/go/plugins/web/certificate/certificate_test.go b/src/go/plugins/web/certificate/certificate_test.go
index 22a2c023a32..0cafb89fbca 100644
--- a/src/go/plugins/web/certificate/certificate_test.go
+++ b/src/go/plugins/web/certificate/certificate_test.go
@@ -21,7 +21,7 @@ package webcertificate
import (
"testing"
- "zabbix.com/pkg/uri"
+ "git.zabbix.com/ap/plugin-support/uri"
)
func Test_getParameters(t *testing.T) {
diff --git a/src/go/plugins/web/page/page.go b/src/go/plugins/web/page/page.go
index 383322db347..a1c493a754b 100644
--- a/src/go/plugins/web/page/page.go
+++ b/src/go/plugins/web/page/page.go
@@ -27,9 +27,9 @@ import (
"strings"
"time"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/web"
"zabbix.com/pkg/zbxregexp"
)
diff --git a/src/go/plugins/windows/eventlog/eventlog_windows.go b/src/go/plugins/windows/eventlog/eventlog_windows.go
index 9226936f3d8..cc410df78a3 100644
--- a/src/go/plugins/windows/eventlog/eventlog_windows.go
+++ b/src/go/plugins/windows/eventlog/eventlog_windows.go
@@ -25,11 +25,11 @@ import (
"time"
"unsafe"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/internal/agent"
- "zabbix.com/pkg/conf"
"zabbix.com/pkg/glexpr"
"zabbix.com/pkg/itemutil"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/zbxlib"
)
diff --git a/src/go/plugins/windows/perfinstance/perfinstance.go b/src/go/plugins/windows/perfinstance/perfinstance.go
index 73c4674bb7d..b7f085ad886 100644
--- a/src/go/plugins/windows/perfinstance/perfinstance.go
+++ b/src/go/plugins/windows/perfinstance/perfinstance.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package perfinstance
@@ -8,8 +9,8 @@ import (
"fmt"
"time"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/pdh"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/win32"
)
diff --git a/src/go/plugins/windows/perfmon/perfmon.go b/src/go/plugins/windows/perfmon/perfmon.go
index 5a8b8a0b4f0..8679d9869f8 100644
--- a/src/go/plugins/windows/perfmon/perfmon.go
+++ b/src/go/plugins/windows/perfmon/perfmon.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
/*
@@ -27,8 +28,8 @@ import (
"sync"
"time"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/pdh"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/win32"
)
@@ -261,6 +262,8 @@ func (p *Plugin) Start() {
}
func (p *Plugin) Stop() {
+ p.counters = make(map[perfCounterIndex]*perfCounter)
+
_ = win32.PdhCloseQuery(p.query)
p.query = 0
}
diff --git a/src/go/plugins/windows/services/services_windows.go b/src/go/plugins/windows/services/services_windows.go
index 5d1e04200f6..da24fc33c2f 100644
--- a/src/go/plugins/windows/services/services_windows.go
+++ b/src/go/plugins/windows/services/services_windows.go
@@ -26,10 +26,10 @@ import (
"syscall"
"unsafe"
+ "git.zabbix.com/ap/plugin-support/plugin"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/svc"
"golang.org/x/sys/windows/svc/mgr"
- "zabbix.com/pkg/plugin"
"zabbix.com/pkg/win32"
)
diff --git a/src/go/plugins/windows/wmi/wmi.go b/src/go/plugins/windows/wmi/wmi.go
index c0b0cf45b51..3ca05761849 100644
--- a/src/go/plugins/windows/wmi/wmi.go
+++ b/src/go/plugins/windows/wmi/wmi.go
@@ -23,7 +23,7 @@ import (
"encoding/json"
"errors"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/wmi"
)
diff --git a/src/go/plugins/zabbix/async/async.go b/src/go/plugins/zabbix/async/async.go
index 62f020a4663..a3b7de1ec61 100644
--- a/src/go/plugins/zabbix/async/async.go
+++ b/src/go/plugins/zabbix/async/async.go
@@ -20,7 +20,7 @@
package zabbixasync
import (
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/zbxlib"
)
diff --git a/src/go/plugins/zabbix/stats/stats.go b/src/go/plugins/zabbix/stats/stats.go
index 865e7234644..817e2ac14ac 100644
--- a/src/go/plugins/zabbix/stats/stats.go
+++ b/src/go/plugins/zabbix/stats/stats.go
@@ -7,8 +7,8 @@ import (
"strconv"
"time"
- "zabbix.com/pkg/conf"
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/conf"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/zbxcomms"
)
diff --git a/src/go/plugins/zabbix/sync/sync.go b/src/go/plugins/zabbix/sync/sync.go
index dde57d8d57b..e9da3520615 100644
--- a/src/go/plugins/zabbix/sync/sync.go
+++ b/src/go/plugins/zabbix/sync/sync.go
@@ -20,7 +20,7 @@
package zabbixsync
import (
- "zabbix.com/pkg/plugin"
+ "git.zabbix.com/ap/plugin-support/plugin"
"zabbix.com/pkg/zbxlib"
)
diff --git a/src/libs/zbxdbcache/dbconfig.c b/src/libs/zbxdbcache/dbconfig.c
index b0f952d8d55..94cc31c41eb 100644
--- a/src/libs/zbxdbcache/dbconfig.c
+++ b/src/libs/zbxdbcache/dbconfig.c
@@ -7354,7 +7354,7 @@ static void DCget_host(DC_HOST *dst_host, const ZBX_DC_HOST *src_host, unsigned
if (ZBX_ITEM_GET_INVENTORY & mode)
{
if (NULL != (host_inventory = (ZBX_DC_HOST_INVENTORY *)zbx_hashset_search(&config->host_inventories, &src_host->hostid)))
- dst_host->inventory_mode = (char)host_inventory->inventory_mode;
+ dst_host->inventory_mode = (signed char)host_inventory->inventory_mode;
else
dst_host->inventory_mode = HOST_INVENTORY_DISABLED;
}
diff --git a/src/libs/zbxdbhigh/host.c b/src/libs/zbxdbhigh/host.c
index 2f17bafaeaa..71eefab809d 100644
--- a/src/libs/zbxdbhigh/host.c
+++ b/src/libs/zbxdbhigh/host.c
@@ -2031,8 +2031,8 @@ typedef struct
unsigned char discover;
unsigned char custom_interfaces_orig;
unsigned char custom_interfaces;
- char inventory_mode_orig;
- char inventory_mode;
+ signed char inventory_mode_orig;
+ signed char inventory_mode;
zbx_uint64_t templateid_host;
}
zbx_host_prototype_t;
@@ -2207,7 +2207,7 @@ static void DBhost_prototypes_make(zbx_uint64_t hostid, zbx_vector_uint64_t *tem
if (SUCCEED == DBis_null(row[7]))
host_prototype->inventory_mode = HOST_INVENTORY_DISABLED;
else
- host_prototype->inventory_mode = (char)atoi(row[7]);
+ host_prototype->inventory_mode = (signed char)atoi(row[7]);
host_prototype->inventory_mode_orig = HOST_INVENTORY_DISABLED;
@@ -2252,7 +2252,7 @@ static void DBhost_prototypes_make(zbx_uint64_t hostid, zbx_vector_uint64_t *tem
if (host_prototype->itemid == itemid && 0 == strcmp(host_prototype->host, row[2]))
{
- char inventory_mode_null_processed;
+ signed char inventory_mode_null_processed;
ZBX_STR2UINT64(host_prototype->hostid, row[1]);
@@ -2283,7 +2283,7 @@ static void DBhost_prototypes_make(zbx_uint64_t hostid, zbx_vector_uint64_t *tem
if (SUCCEED == DBis_null(row[8]))
inventory_mode_null_processed = HOST_INVENTORY_DISABLED;
else
- inventory_mode_null_processed = (char)atoi(row[8]);
+ inventory_mode_null_processed = (signed char)atoi(row[8]);
if (host_prototype->inventory_mode != inventory_mode_null_processed)
{
@@ -3833,7 +3833,8 @@ static void DBhost_prototypes_save(const zbx_vector_ptr_t *host_prototypes,
}
zbx_audit_host_prototype_update_json_update_inventory_mode(host_prototype->hostid,
- host_prototype->inventory_mode_orig, host_prototype->inventory_mode);
+ (int)host_prototype->inventory_mode_orig,
+ (int)host_prototype->inventory_mode);
}
}
diff --git a/src/libs/zbxdbhigh/lld_override.c b/src/libs/zbxdbhigh/lld_override.c
index c3cc7cb98cf..0c4312689a3 100644
--- a/src/libs/zbxdbhigh/lld_override.c
+++ b/src/libs/zbxdbhigh/lld_override.c
@@ -240,8 +240,8 @@ void zbx_load_lld_override_operations(const zbx_vector_uint64_t *overrideids, ch
override_operation->severity = FAIL == DBis_null(row[10]) ? (unsigned char)atoi(row[10]) :
TRIGGER_SEVERITY_COUNT;
- override_operation->inventory_mode = FAIL == DBis_null(row[11]) ?
- (unsigned char)atoi(row[11]) : HOST_INVENTORY_COUNT;
+ override_operation->inventory_mode = FAIL == DBis_null(row[11]) ? (signed char)atoi(row[11]) :
+ HOST_INVENTORY_COUNT;
zbx_vector_ptr_append(ops, override_operation);
diff --git a/src/libs/zbxdbupgrade/dbupgrade_6000.c b/src/libs/zbxdbupgrade/dbupgrade_6000.c
index 02e39f9687b..8888decca6e 100644
--- a/src/libs/zbxdbupgrade/dbupgrade_6000.c
+++ b/src/libs/zbxdbupgrade/dbupgrade_6000.c
@@ -18,6 +18,7 @@
**/
#include "common.h"
+#include "db.h"
#include "dbupgrade.h"
extern unsigned char program_type;
@@ -33,6 +34,31 @@ static int DBpatch_6000000(void)
return SUCCEED;
}
+static int DBpatch_6000001(void)
+{
+ if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
+ return SUCCEED;
+
+ if (ZBX_DB_OK > DBexecute("delete from profiles where idx='web.auditlog.filter.action' and value_int=-1"))
+ return FAIL;
+
+ return SUCCEED;
+}
+
+static int DBpatch_6000002(void)
+{
+ if (0 == (program_type & ZBX_PROGRAM_TYPE_SERVER))
+ return SUCCEED;
+
+ if (ZBX_DB_OK > DBexecute("update profiles set idx='web.auditlog.filter.actions' where"
+ " idx='web.auditlog.filter.action'"))
+ {
+ return FAIL;
+ }
+
+ return SUCCEED;
+}
+
#endif
DBPATCH_START(6000)
@@ -40,5 +66,7 @@ DBPATCH_START(6000)
/* version, duplicates flag, mandatory flag */
DBPATCH_ADD(6000000, 0, 1)
+DBPATCH_ADD(6000001, 0, 0)
+DBPATCH_ADD(6000002, 0, 0)
DBPATCH_END()
diff --git a/src/libs/zbxeval/calc.c b/src/libs/zbxeval/calc.c
index 00b9dd18304..6cad55234a2 100644
--- a/src/libs/zbxeval/calc.c
+++ b/src/libs/zbxeval/calc.c
@@ -652,7 +652,7 @@ int zbx_eval_calc_avg(zbx_vector_dbl_t *values, double *result, char **error)
{
if (0 == values->values_num)
{
- *error = zbx_strdup(*error, "not enough data");
+ *error = zbx_strdup(*error, "no data (at least one value is required)");
return FAIL;
}
@@ -680,7 +680,7 @@ int zbx_eval_calc_min(zbx_vector_dbl_t *values, double *result, char **error)
if (0 == values->values_num)
{
- *error = zbx_strdup(*error, "not enough data");
+ *error = zbx_strdup(*error, "no data (at least one value is required)");
return FAIL;
}
@@ -716,7 +716,7 @@ int zbx_eval_calc_max(zbx_vector_dbl_t *values, double *result, char **error)
if (0 == values->values_num)
{
- *error = zbx_strdup(*error, "not enough data");
+ *error = zbx_strdup(*error, "no data (at least one value is required)");
return FAIL;
}
@@ -739,15 +739,29 @@ int zbx_eval_calc_max(zbx_vector_dbl_t *values, double *result, char **error)
* *
* Parameters: values - [IN] non-empty vector with input data *
* result - [OUT] calculated value *
+ * error - [OUT] dynamically allocated error message *
+ * *
+ * Return value: SUCCEED - evaluated successfully *
+ * FAIL - failed to evaluate function (see 'error') *
* *
******************************************************************************/
-void zbx_eval_calc_sum(zbx_vector_dbl_t *values, double *result)
+int zbx_eval_calc_sum(zbx_vector_dbl_t *values, double *result, char **error)
{
- double value = 0;
+ double value;
int i;
+ if (0 == values->values_num)
+ {
+ *error = zbx_strdup(*error, "no data (at least one value is required)");
+ return FAIL;
+ }
+
+ value = 0;
+
for (i = 0; i < values->values_num; i++)
value += values->values[i];
*result = value;
+
+ return SUCCEED;
}
diff --git a/src/libs/zbxeval/execute.c b/src/libs/zbxeval/execute.c
index 83f55c81832..515c62d5fa0 100644
--- a/src/libs/zbxeval/execute.c
+++ b/src/libs/zbxeval/execute.c
@@ -2073,7 +2073,7 @@ static int eval_execute_function_ascii(const zbx_eval_context_t *ctx, const zbx_
arg = &output->values[output->values_num - 1];
- if (SUCCEED != zbx_variant_convert(arg, ZBX_VARIANT_STR) || 0 > *arg->data.str)
+ if (SUCCEED != zbx_variant_convert(arg, ZBX_VARIANT_STR) || 1 != zbx_utf8_char_len(arg->data.str))
{
*error = zbx_dsprintf(*error, "invalid function argument at \"%s\"", ctx->expression + token->loc.l);
return FAIL;
diff --git a/src/libs/zbxnix/fatal.c b/src/libs/zbxnix/fatal.c
index 376703ede38..495fc5fa392 100644
--- a/src/libs/zbxnix/fatal.c
+++ b/src/libs/zbxnix/fatal.c
@@ -247,6 +247,8 @@ void zbx_log_fatal_info(void *context, unsigned int flags)
#if defined(REG_EIP) || defined(REG_RIP)
ucontext_t *uctx = (ucontext_t *)context;
+#else
+ ZBX_UNUSED(context);
#endif
/* look for GET_PC() macro in sigcontextinfo.h files */
@@ -265,8 +267,6 @@ void zbx_log_fatal_info(void *context, unsigned int flags)
# endif
#endif /* HAVE_SYS_UCONTEXT_H */
- int i;
- FILE *fd;
zabbix_log(LOG_LEVEL_CRIT, "====== Fatal information: ======");
@@ -275,6 +275,7 @@ void zbx_log_fatal_info(void *context, unsigned int flags)
#ifdef HAVE_SYS_UCONTEXT_H
#ifdef ZBX_GET_PC
+ int i;
/* On 64-bit GNU/Linux ZBX_GET_PC() returns 'greg_t' defined as 'long long int' (8 bytes). */
/* On 32-bit GNU/Linux it is defined as 'int' (4 bytes). To print registers in a common way we print */
/* them as 'long int' or 'unsigned long int' which is 8 bytes on 64-bit GNU/Linux and 4 bytes on */
@@ -335,6 +336,8 @@ void zbx_log_fatal_info(void *context, unsigned int flags)
if (0 != (flags & ZBX_FATAL_LOG_MEM_MAP))
{
+ FILE *fd;
+
zabbix_log(LOG_LEVEL_CRIT, "=== Memory map: ===");
if (NULL != (fd = fopen("/proc/self/maps", "r")))
diff --git a/src/libs/zbxprometheus/zbxprometheus.c b/src/libs/zbxprometheus/zbxprometheus.c
index d7d5231413a..14413121b97 100644
--- a/src/libs/zbxprometheus/zbxprometheus.c
+++ b/src/libs/zbxprometheus/zbxprometheus.c
@@ -1521,7 +1521,9 @@ static int prometheus_aggregate_values(const zbx_vector_ptr_t *rows, const char
row = (const zbx_prometheus_row_t *)rows->values[i];
value_dbl = atof(row->value);
- zbx_vector_dbl_append(&values, value_dbl);
+
+ if (0 == isnan(value_dbl))
+ zbx_vector_dbl_append(&values, value_dbl);
}
if (0 == strcmp(function, "avg"))
@@ -1538,8 +1540,7 @@ static int prometheus_aggregate_values(const zbx_vector_ptr_t *rows, const char
}
else if (0 == strcmp(function, "sum"))
{
- zbx_eval_calc_sum(&values, &value_dbl);
- ret = SUCCEED;
+ ret = zbx_eval_calc_sum(&values, &value_dbl, error);
}
else if (0 == strcmp(function, "count"))
{
diff --git a/src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java b/src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java
index 27278a7e5ac..9ef179f26be 100644
--- a/src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java
+++ b/src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java
@@ -22,9 +22,9 @@ package com.zabbix.gateway;
class GeneralInformation
{
static final String APPLICATION_NAME = "Zabbix Java Gateway";
- static final String REVISION_DATE = "4 April 2022";
+ static final String REVISION_DATE = "3 May 2022";
static final String REVISION = "{ZABBIX_REVISION}";
- static final String VERSION = "6.0.4rc1";
+ static final String VERSION = "6.0.5rc1";
static void printVersion()
{
diff --git a/src/zabbix_server/lld/lld.c b/src/zabbix_server/lld/lld.c
index 6bf5120538e..70c73a14cb8 100644
--- a/src/zabbix_server/lld/lld.c
+++ b/src/zabbix_server/lld/lld.c
@@ -593,7 +593,7 @@ static void lld_dump_overrides(const zbx_vector_ptr_t *overrides)
zabbix_log(LOG_LEVEL_TRACE, " delay '%s'", ZBX_NULL2STR(override_operation->delay));
zabbix_log(LOG_LEVEL_TRACE, " history '%s'", ZBX_NULL2STR(override_operation->history));
zabbix_log(LOG_LEVEL_TRACE, " trends '%s'", ZBX_NULL2STR(override_operation->trends));
- zabbix_log(LOG_LEVEL_TRACE, " inventory_mode: %d", override_operation->inventory_mode);
+ zabbix_log(LOG_LEVEL_TRACE, " inventory_mode: %d", (int)override_operation->inventory_mode);
for (k = 0; k < override_operation->tags.values_num; k++)
{
zabbix_log(LOG_LEVEL_TRACE, " tag:'%s' value:'%s'",
@@ -841,7 +841,7 @@ void lld_override_trigger(const zbx_vector_ptr_t *overrides, const char *name, u
}
void lld_override_host(const zbx_vector_ptr_t *overrides, const char *name, zbx_vector_uint64_t *lnk_templateids,
- char *inventory_mode, zbx_vector_db_tag_ptr_t *override_tags, unsigned char *status,
+ signed char *inventory_mode, zbx_vector_db_tag_ptr_t *override_tags, unsigned char *status,
unsigned char *discover)
{
int i, j, k;
diff --git a/src/zabbix_server/lld/lld.h b/src/zabbix_server/lld/lld.h
index 9362e99ddb8..c86f096c949 100644
--- a/src/zabbix_server/lld/lld.h
+++ b/src/zabbix_server/lld/lld.h
@@ -231,7 +231,7 @@ void lld_override_item(const zbx_vector_ptr_t *overrides, const char *name, cons
void lld_override_trigger(const zbx_vector_ptr_t *overrides, const char *name, unsigned char *severity,
zbx_vector_db_tag_ptr_t *override_tags, unsigned char *status, unsigned char *discover);
void lld_override_host(const zbx_vector_ptr_t *overrides, const char *name, zbx_vector_uint64_t *lnk_templateids,
- char *inventory_mode, zbx_vector_db_tag_ptr_t *override_tags, unsigned char *status,
+ signed char *inventory_mode, zbx_vector_db_tag_ptr_t *override_tags, unsigned char *status,
unsigned char *discover);
void lld_override_graph(const zbx_vector_ptr_t *overrides, const char *name, unsigned char *discover);
diff --git a/src/zabbix_server/lld/lld_host.c b/src/zabbix_server/lld/lld_host.c
index deaf3fda3c3..f87b9e92c93 100644
--- a/src/zabbix_server/lld/lld_host.c
+++ b/src/zabbix_server/lld/lld_host.c
@@ -207,13 +207,13 @@ typedef struct
ZBX_FLAG_LLD_HOST_UPDATE_TLS_PSK | ZBX_FLAG_LLD_HOST_UPDATE_CUSTOM_INTERFACES)
zbx_uint64_t flags;
const struct zbx_json_parse *jp_row;
- char inventory_mode;
- char inventory_mode_orig;
+ signed char inventory_mode;
+ signed char inventory_mode_orig;
unsigned char status;
unsigned char custom_interfaces;
unsigned char custom_interfaces_orig;
zbx_uint64_t proxy_hostid_orig;
- char ipmi_authtype_orig;
+ signed char ipmi_authtype_orig;
unsigned char ipmi_privilege_orig;
char *ipmi_username_orig;
char *ipmi_password_orig;
@@ -405,7 +405,7 @@ out:
* *
******************************************************************************/
static void lld_hosts_get(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, zbx_uint64_t proxy_hostid,
- char ipmi_authtype, unsigned char ipmi_privilege, const char *ipmi_username, const char *ipmi_password,
+ signed char ipmi_authtype, unsigned char ipmi_privilege, const char *ipmi_username, const char *ipmi_password,
unsigned char tls_connect, unsigned char tls_accept, const char *tls_issuer,
const char *tls_subject, const char *tls_psk_identity, const char *tls_psk)
{
@@ -466,9 +466,9 @@ static void lld_hosts_get(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, z
host->flags |= ZBX_FLAG_LLD_HOST_UPDATE_PROXY;
}
- if ((char)atoi(row[7]) != ipmi_authtype)
+ if ((signed char)atoi(row[7]) != ipmi_authtype)
{
- host->ipmi_authtype_orig = (char)atoi(row[7]);
+ host->ipmi_authtype_orig = (signed char)atoi(row[7]);
host->flags |= ZBX_FLAG_LLD_HOST_UPDATE_IPMI_AUTH;
}
@@ -529,7 +529,7 @@ static void lld_hosts_get(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, z
if (SUCCEED == DBis_null(row[11]))
host->inventory_mode_orig = HOST_INVENTORY_DISABLED;
else
- host->inventory_mode_orig = (char)atoi(row[11]);
+ host->inventory_mode_orig = (signed char)atoi(row[11]);
zbx_vector_uint64_create(&host->new_groupids);
zbx_vector_uint64_create(&host->lnk_templateids);
@@ -818,7 +818,7 @@ static void lld_hosts_validate(zbx_vector_ptr_t *hosts, char **error)
}
static zbx_lld_host_t *lld_host_make(zbx_vector_ptr_t *hosts, const char *host_proto, const char *name_proto,
- char inventory_mode_proto, unsigned char status_proto, unsigned char discover_proto,
+ signed char inventory_mode_proto, unsigned char status_proto, unsigned char discover_proto,
zbx_vector_db_tag_ptr_t *tags, const zbx_lld_row_t *lld_row, const zbx_vector_ptr_t *lld_macros,
char **info, unsigned char custom_iface)
{
@@ -2648,8 +2648,8 @@ static void lld_interface_snmp_prepare_sql(zbx_uint64_t hostid, const zbx_uint64
* *
******************************************************************************/
static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, const char *host_proto,
- zbx_uint64_t proxy_hostid, char ipmi_authtype, unsigned char ipmi_privilege, const char *ipmi_username,
- const char *ipmi_password, unsigned char tls_connect,
+ zbx_uint64_t proxy_hostid, signed char ipmi_authtype, unsigned char ipmi_privilege,
+ const char *ipmi_username, const char *ipmi_password, unsigned char tls_connect,
unsigned char tls_accept, const char *tls_issuer, const char *tls_subject, const char *tls_psk_identity,
const char *tls_psk, const zbx_vector_uint64_t *del_hostgroupids)
{
@@ -2935,7 +2935,7 @@ static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts,
(int)ipmi_authtype, (int)ipmi_privilege, ipmi_username, ipmi_password,
(int)host->status, (int)ZBX_FLAG_DISCOVERY_CREATED, (int)tls_connect,
(int)tls_accept, tls_issuer, tls_subject, tls_psk_identity, tls_psk,
- host->custom_interfaces, host->inventory_mode);
+ host->custom_interfaces, (int)host->inventory_mode);
}
else
{
@@ -2986,7 +2986,7 @@ static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts,
d = ",";
zbx_audit_host_update_json_update_ipmi_authtype(host->hostid,
- host->ipmi_authtype_orig, (int)ipmi_authtype);
+ (int)host->ipmi_authtype_orig, (int)ipmi_authtype);
}
if (0 != (host->flags & ZBX_FLAG_LLD_HOST_UPDATE_IPMI_PRIV))
{
@@ -4443,7 +4443,7 @@ void lld_update_hosts(zbx_uint64_t lld_ruleid, const zbx_vector_ptr_t *lld_rows,
zbx_uint64_t proxy_hostid;
char *ipmi_username = NULL, *ipmi_password, *tls_issuer, *tls_subject, *tls_psk_identity,
*tls_psk;
- char ipmi_authtype, inventory_mode_proto;
+ signed char ipmi_authtype, inventory_mode_proto;
unsigned char ipmi_privilege, tls_connect, tls_accept;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
@@ -4459,7 +4459,7 @@ void lld_update_hosts(zbx_uint64_t lld_ruleid, const zbx_vector_ptr_t *lld_rows,
if (NULL != (row = DBfetch(result)))
{
ZBX_DBROW2UINT64(proxy_hostid, row[0]);
- ipmi_authtype = (char)atoi(row[1]);
+ ipmi_authtype = (signed char)atoi(row[1]);
ZBX_STR2UCHAR(ipmi_privilege, row[2]);
ipmi_username = zbx_strdup(NULL, row[3]);
ipmi_password = zbx_strdup(NULL, row[4]);
@@ -4520,7 +4520,7 @@ void lld_update_hosts(zbx_uint64_t lld_ruleid, const zbx_vector_ptr_t *lld_rows,
if (SUCCEED == DBis_null(row[5]))
inventory_mode_proto = HOST_INVENTORY_DISABLED;
else
- inventory_mode_proto = (char)atoi(row[5]);
+ inventory_mode_proto = (signed char)atoi(row[5]);
lld_hosts_get(parent_hostid, &hosts, proxy_hostid, ipmi_authtype, ipmi_privilege, ipmi_username,
ipmi_password, tls_connect, tls_accept, tls_issuer, tls_subject,
diff --git a/src/zabbix_server/poller/checks_simple_vmware.c b/src/zabbix_server/poller/checks_simple_vmware.c
index bec507ec843..90ab321c00b 100644
--- a/src/zabbix_server/poller/checks_simple_vmware.c
+++ b/src/zabbix_server/poller/checks_simple_vmware.c
@@ -86,22 +86,22 @@ static zbx_vmware_hv_t *hv_get(zbx_hashset_t *hvs, const char *uuid)
* *
* Purpose: return pointer to Datastore data from vector with id *
* *
- * Parameters: dss - [IN] the vector with all Datastores *
- * id - [IN] the id of Datastore *
+ * Parameters: dss - [IN] the vector with all Datastores *
+ * ds_uuid - [IN] the id of Datastore *
* *
* Return value: *
* zbx_vmware_datastore_t* - the operation has completed successfully *
* NULL - the operation has failed *
* *
******************************************************************************/
-static zbx_vmware_datastore_t *ds_get(const zbx_vector_vmware_datastore_t *dss, const char *name)
+static zbx_vmware_datastore_t *ds_get(const zbx_vector_vmware_datastore_t *dss, const char *ds_uuid)
{
int i;
zbx_vmware_datastore_t ds_cmp;
- ds_cmp.name = (char *)name;
+ ds_cmp.uuid = (char *)ds_uuid;
- if (FAIL == (i = zbx_vector_vmware_datastore_bsearch(dss, &ds_cmp, vmware_ds_name_compare)))
+ if (FAIL == (i = zbx_vector_vmware_datastore_bsearch(dss, &ds_cmp, vmware_ds_uuid_compare)))
return NULL;
return dss->values[i];
@@ -1679,7 +1679,6 @@ int check_vcenter_hv_datastore_discovery(AGENT_REQUEST *request, const char *use
zbx_json_adduint64(&json_data, "{#MULTIPATH.COUNT}", (unsigned int)total);
zbx_json_adduint64(&json_data, "{#MULTIPATH.PARTITION.COUNT}",
(unsigned int)dsname->hvdisks.values_num);
-
zbx_json_close(&json_data);
}
@@ -1705,7 +1704,7 @@ static int check_vcenter_hv_datastore_latency(AGENT_REQUEST *request, const char
zbx_vmware_service_t *service;
zbx_vmware_hv_t *hv;
zbx_vmware_datastore_t *datastore;
- zbx_vmware_dsname_t dsnames_cmp;
+ zbx_vmware_dsname_t dsname_cmp;
int i, ret = SYSINFO_RET_FAIL;
zbx_str_uint64_pair_t uuid_cmp = {.value = 0};
@@ -1739,24 +1738,15 @@ static int check_vcenter_hv_datastore_latency(AGENT_REQUEST *request, const char
goto unlock;
}
- datastore = ds_get(&service->data->datastores, name);
+ dsname_cmp.name = (char *)name;
- if (NULL == datastore)
+ if (FAIL == (i = zbx_vector_vmware_dsname_bsearch(&hv->dsnames, &dsname_cmp, vmware_dsname_compare)))
{
- SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore name."));
+ SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Datastore \"%s\" not found on this hypervisor.", name));
goto unlock;
}
- dsnames_cmp.name = datastore->name;
-
- if (FAIL == zbx_vector_vmware_dsname_bsearch(&hv->dsnames, &dsnames_cmp, vmware_dsname_compare))
- {
- SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Datastore \"%s\" not found on this hypervisor.",
- datastore->name));
- goto unlock;
- }
-
- if (NULL == datastore->uuid)
+ if (NULL == (datastore = ds_get(&service->data->datastores, hv->dsnames.values[i]->uuid)))
{
SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore uuid."));
goto unlock;
@@ -1889,8 +1879,9 @@ static int check_vcenter_ds_size(const char *url, const char *hv_uuid, const cha
const char *username, const char *password, AGENT_RESULT *result)
{
zbx_vmware_service_t *service;
- int ret = SYSINFO_RET_FAIL;
- zbx_vmware_datastore_t *datastore = NULL;
+ int i, ret = SYSINFO_RET_FAIL;
+ zbx_vmware_datastore_t *datastore;
+ zbx_vmware_hv_t *hv;
zbx_uint64_t disk_used, disk_provisioned, disk_capacity;
unsigned int flags;
zbx_str_uint64_pair_t uuid_cmp = {.name = (char *)hv_uuid, .value = 0};
@@ -1902,12 +1893,41 @@ static int check_vcenter_ds_size(const char *url, const char *hv_uuid, const cha
if (NULL == (service = get_vmware_service(url, username, password, result, &ret)))
goto unlock;
- datastore = ds_get(&service->data->datastores, name);
+ if (NULL != hv_uuid)
+ {
+ zbx_vmware_dsname_t dsname_cmp = {.name = (char *)name};
+
+ if (NULL == (hv = hv_get(&service->data->hvs, hv_uuid)))
+ {
+ SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown hypervisor uuid."));
+ goto unlock;
+ }
+
+ if (FAIL == (i = zbx_vector_vmware_dsname_bsearch(&hv->dsnames, &dsname_cmp, vmware_dsname_compare)))
+ {
+ SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Datastore \"%s\" not found on this hypervisor.",
+ name));
+ goto unlock;
+ }
- if (NULL == datastore)
+ if (NULL == (datastore = ds_get(&service->data->datastores, hv->dsnames.values[i]->uuid)))
+ {
+ SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore uuid."));
+ goto unlock;
+ }
+ }
+ else if (NULL == (datastore = ds_get(&service->data->datastores, name)))
{
- SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore name."));
- goto unlock;
+ zbx_vmware_datastore_t ds_cmp = {.name = (char *)name};
+
+ if (FAIL == (i = zbx_vector_vmware_datastore_search(&service->data->datastores, &ds_cmp,
+ vmware_ds_name_compare)))
+ {
+ SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore name."));
+ goto unlock;
+ }
+
+ datastore = service->data->datastores.values[i];
}
if (NULL != hv_uuid &&
@@ -2259,30 +2279,15 @@ int check_vcenter_hv_datastore_multipath(AGENT_REQUEST *request, const char *use
if (NULL != ds_name && '\0' != *ds_name)
{
- zbx_vmware_datastore_t *datastore;
- zbx_vmware_dsname_t dsnames_cmp;
+ zbx_vmware_dsname_t dsname_cmp;
zbx_vmware_hvdisk_t hvdisk_cmp;
- datastore = ds_get(&service->data->datastores, ds_name);
+ dsname_cmp.name = (char *)ds_name;
- if (NULL == datastore)
- {
- SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore name."));
- goto unlock;
- }
-
- dsnames_cmp.name = datastore->name;
-
- if (FAIL == (i = zbx_vector_vmware_dsname_bsearch(&hv->dsnames, &dsnames_cmp, vmware_dsname_compare)))
+ if (FAIL == (i = zbx_vector_vmware_dsname_bsearch(&hv->dsnames, &dsname_cmp, vmware_dsname_compare)))
{
SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Datastore \"%s\" not found on this hypervisor.",
- datastore->name));
- goto unlock;
- }
-
- if (NULL == datastore->uuid)
- {
- SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore uuid."));
+ ds_name));
goto unlock;
}
@@ -2354,19 +2359,19 @@ int check_vcenter_datastore_hv_list(AGENT_REQUEST *request, const char *username
if (NULL == (service = get_vmware_service(url, username, password, result, &ret)))
goto unlock;
- for (i = 0; i < service->data->datastores.values_num; i++)
+
+ if (NULL == (datastore = ds_get(&service->data->datastores, ds_name)))
{
- if (0 != strcmp(ds_name, service->data->datastores.values[i]->name))
- continue;
+ zbx_vmware_datastore_t ds_cmp = {.name = (char *)ds_name};
- datastore = service->data->datastores.values[i];
- break;
- }
+ if (FAIL == (i = zbx_vector_vmware_datastore_search(&service->data->datastores, &ds_cmp,
+ vmware_ds_name_compare)))
+ {
+ SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore name."));
+ goto unlock;
+ }
- if (NULL == datastore)
- {
- SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore name."));
- goto unlock;
+ datastore = service->data->datastores.values[i];
}
for (i=0; i < datastore->hv_uuids_access.values_num; i++)
@@ -2525,12 +2530,19 @@ static int check_vcenter_datastore_latency(AGENT_REQUEST *request, const char *u
if (NULL == (service = get_vmware_service(url, username, password, result, &ret)))
goto unlock;
- datastore = ds_get(&service->data->datastores, name);
-
- if (NULL == datastore)
+ /* allow passing ds uuid or name for backwards compatibility */
+ if (NULL == (datastore = ds_get(&service->data->datastores, name)))
{
- SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore name."));
- goto unlock;
+ zbx_vmware_datastore_t ds_cmp = {.name = (char *)name};
+
+ if (FAIL == (i = zbx_vector_vmware_datastore_search(&service->data->datastores, &ds_cmp,
+ vmware_ds_name_compare)))
+ {
+ SET_MSG_RESULT(result, zbx_strdup(NULL, "Unknown datastore name."));
+ goto unlock;
+ }
+
+ datastore = service->data->datastores.values[i];
}
if (NULL == datastore->uuid)
diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c
index b09765a596c..85eea5ce8ae 100644
--- a/src/zabbix_server/server.c
+++ b/src/zabbix_server/server.c
@@ -1893,6 +1893,13 @@ void zbx_on_exit(int ret)
zbx_locks_disable();
#endif
+ if (ZBX_NODE_STATUS_ACTIVE == ha_status)
+ {
+ DBconnect(ZBX_DB_CONNECT_EXIT);
+ free_database_cache(ZBX_SYNC_ALL);
+ DBclose();
+ }
+
if (SUCCEED != zbx_ha_stop(&error))
{
zabbix_log(LOG_LEVEL_CRIT, "cannot stop HA manager: %s", error);
@@ -1904,13 +1911,6 @@ void zbx_on_exit(int ret)
{
free_metrics();
zbx_ipc_service_free_env();
-
- DBconnect(ZBX_DB_CONNECT_EXIT);
-
- free_database_cache(ZBX_SYNC_ALL);
-
- DBclose();
-
free_configuration_cache();
/* free history value cache */
diff --git a/src/zabbix_server/vmware/vmware.c b/src/zabbix_server/vmware/vmware.c
index 8dcc9d5a18f..042132c527b 100644
--- a/src/zabbix_server/vmware/vmware.c
+++ b/src/zabbix_server/vmware/vmware.c
@@ -1092,6 +1092,7 @@ static void vmware_vm_shared_free(zbx_vmware_vm_t *vm)
static void vmware_dsname_shared_free(zbx_vmware_dsname_t *dsname)
{
vmware_shared_strfree(dsname->name);
+ vmware_shared_strfree(dsname->uuid);
zbx_vector_vmware_hvdisk_destroy(&dsname->hvdisks);
__vm_mem_free_func(dsname);
@@ -1531,6 +1532,7 @@ static zbx_vmware_dsname_t *vmware_dsname_shared_dup(const zbx_vmware_dsname_t *
dsname = (zbx_vmware_dsname_t *)__vm_mem_malloc_func(NULL, sizeof(zbx_vmware_dsname_t));
dsname->name = vmware_shared_strdup(src->name);
+ dsname->uuid = vmware_shared_strdup(src->uuid);
VMWARE_VECTOR_CREATE(&dsname->hvdisks, vmware_hvdisk);
zbx_vector_vmware_hvdisk_reserve(&dsname->hvdisks, src->hvdisks.values_num);
@@ -1779,6 +1781,7 @@ static void vmware_dsname_free(zbx_vmware_dsname_t *dsname)
{
zbx_vector_vmware_hvdisk_destroy(&dsname->hvdisks);
zbx_free(dsname->name);
+ zbx_free(dsname->uuid);
zbx_free(dsname);
}
@@ -3398,6 +3401,23 @@ static int vmware_service_hv_get_multipath_data(const zbx_vmware_service_t *serv
/******************************************************************************
* *
+ * Function: vmware_ds_uuid_compare *
+ * *
+ * Purpose: sorting function to sort Datastore vector by uuid *
+ * *
+ ******************************************************************************/
+int vmware_ds_uuid_compare(const void *d1, const void *d2)
+{
+ const zbx_vmware_datastore_t *ds1 = *(const zbx_vmware_datastore_t * const *)d1;
+ const zbx_vmware_datastore_t *ds2 = *(const zbx_vmware_datastore_t * const *)d2;
+
+ return strcmp(ds1->uuid, ds2->uuid);
+}
+
+/******************************************************************************
+ * *
+ * Function: vmware_ds_name_compare *
+ * *
* Purpose: sorting function to sort Datastore vector by name *
* *
******************************************************************************/
@@ -3814,8 +3834,17 @@ static int vmware_service_init_hv(zbx_vmware_service_t *service, CURL *easyhandl
hv_ds_access.name = zbx_strdup(NULL, hv->uuid);
hv_ds_access.value = vmware_hv_get_ds_access(details, ds->id);
zbx_vector_str_uint64_pair_append_ptr(&ds->hv_uuids_access, &hv_ds_access);
+
+ if (NULL == ds->uuid)
+ {
+ zabbix_log(LOG_LEVEL_WARNING, "%s(): Datastore \"%s\" does not have uuid.", __func__,
+ datastores.values[i]);
+ continue;
+ }
+
dsname = (zbx_vmware_dsname_t *)zbx_malloc(NULL, sizeof(zbx_vmware_dsname_t));
dsname->name = zbx_strdup(NULL, ds->name);
+ dsname->uuid = zbx_strdup(NULL, ds->uuid);
zbx_vector_vmware_hvdisk_create(&dsname->hvdisks);
zabbix_log(LOG_LEVEL_DEBUG, "%s(): for %d diskextents check multipath at ds:\"%s\"", __func__,
ds->diskextents.values_num, ds->name);
@@ -5635,7 +5664,7 @@ static void vmware_service_update(zbx_vmware_service_t *service)
zbx_str_uint64_pair_name_compare);
}
- zbx_vector_vmware_datastore_sort(&data->datastores, vmware_ds_name_compare);
+ zbx_vector_vmware_datastore_sort(&data->datastores, vmware_ds_uuid_compare);
if (0 == service->eventlog.req_sz && 0 == evt_pause)
{
diff --git a/src/zabbix_server/vmware/vmware.h b/src/zabbix_server/vmware/vmware.h
index 26d43a3e265..f0e04533b07 100644
--- a/src/zabbix_server/vmware/vmware.h
+++ b/src/zabbix_server/vmware/vmware.h
@@ -116,8 +116,8 @@ ZBX_PTR_VECTOR_DECL(vmware_diskextent, zbx_vmware_diskextent_t *)
typedef struct
{
- char *name;
char *uuid;
+ char *name;
char *id;
zbx_uint64_t capacity;
zbx_uint64_t free_space;
@@ -127,6 +127,7 @@ typedef struct
}
zbx_vmware_datastore_t;
+int vmware_ds_uuid_compare(const void *d1, const void *d2);
int vmware_ds_name_compare(const void *d1, const void *d2);
ZBX_PTR_VECTOR_DECL(vmware_datastore, zbx_vmware_datastore_t *)
@@ -143,6 +144,7 @@ ZBX_VECTOR_DECL(vmware_hvdisk, zbx_vmware_hvdisk_t)
typedef struct
{
char *name;
+ char *uuid;
zbx_vector_vmware_hvdisk_t hvdisks;
}
zbx_vmware_dsname_t;