** Copyright (C) 2001-2025 Zabbix SIA
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
"golang.zabbix.com/sdk/errs"
"golang.zabbix.com/sdk/plugin"
"golang.zabbix.com/sdk/std"
err := plugin.RegisterMetrics(
"vfs.file.cksum", "Returns File checksum, calculated by the UNIX cksum algorithm.",
"vfs.file.contents", "Retrieves contents of the file.",
"vfs.file.exists", "Returns if file exists or not.",
"vfs.file.time", "Returns file time information.",
"vfs.file.size", "Returns file size.",
"vfs.file.regexp", "Find string in a file.",
"vfs.file.regmatch", "Find string in a file.",
"vfs.file.md5sum", "Returns MD5 checksum of file.",
"vfs.file.owner", "Returns the ownership of a file.",
"vfs.file.permissions", "Returns 4-digit string containing octal number with Unix permissions.",
"vfs.file.get", "Return json object with information about a file.",
panic(errs.Wrap(err, "failed to register metrics"))
func (p *Plugin) Export(key string, params []string, ctx plugin.ContextProvider) (result interface{}, err error) {
return p.exportCksum(params, ctx.Timeout())
case "vfs.file.contents":
return p.exportContents(params)
return p.exportExists(params)