Source
SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot obtain system information: %s", zbx_strerror(errno)));
/*
** 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/>.
**/
static zbx_mntopt_t mntopts[] = {
{MNT_ASYNC, "async"},
{MNT_DEFEXPORTED, "exported to the world"},
{MNT_EXPORTED, "NFS exported"},
{MNT_EXPORTANON, "anon uid mapping"},
{MNT_EXRDONLY, "exported read-only"},
{MNT_LOCAL, "local"},
{MNT_NOATIME, "noatime"},
{MNT_NODEV, "nodev"},
{MNT_NOEXEC, "noexec" },
{MNT_NOSUID, "nosuid" },
{MNT_NOPERM, "noperm" },
{MNT_WXALLOWED, "wxallowed" },
{MNT_QUOTA, "with quotas"},
{MNT_RDONLY, "ro"},
{MNT_ROOTFS, "root file system"},
{MNT_SYNCHRONOUS, "sync"},
{MNT_SOFTDEP, "softdep"},
{0, NULL}
};
static int get_fs_size_stat(const char *fs, zbx_uint64_t *total, zbx_uint64_t *free,
zbx_uint64_t *used, double *pfree, double *pused, char **error)
{
struct ZBX_STATFS s;
if (0 != ZBX_STATFS(fs, &s))
{
*error = zbx_dsprintf(NULL, "Cannot obtain filesystem information: %s", zbx_strerror(errno));
zabbix_log(LOG_LEVEL_DEBUG,"%s failed with error: %s",__func__, *error);
return SYSINFO_RET_FAIL;
}
/* Available space could be negative (top bit set) if we hit disk space */