Source
/*
** 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/>.
**/
typedef struct
{
zbx_uint64_t nread;
zbx_uint64_t nwritten;
zbx_uint64_t reads;
zbx_uint64_t writes;
}
zbx_perfstat_t;
int zbx_get_diskstat(const char *devname, zbx_uint64_t *dstat)
{
ZBX_UNUSED(devname);
ZBX_UNUSED(dstat);
return FAIL;
}
static int get_perfstat_io(const char *devname, zbx_perfstat_t *zp, char **error)
{
int err;
if ('\0' != *devname)
{
perfstat_id_t name;
perfstat_disk_t data;
zbx_strscpy(name.name, devname);
if (0 < (err = perfstat_disk(&name, &data, sizeof(data), 1)))
{
zp->nread = data.rblks * data.bsize;
zp->nwritten = data.wblks * data.bsize;
zp->reads = data.xrate;
zp->writes = data.xfers - data.xrate;
return SYSINFO_RET_OK;
}
}
else
{
perfstat_disk_total_t data;
if (0 < (err = perfstat_disk_total(NULL, &data, sizeof(data), 1)))