Source
*error = zbx_dsprintf(NULL, "Cannot obtain system information: %s", zbx_strerror(errno));
/*
** 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.
**/
typedef struct
{
zbx_uint64_t nread;
zbx_uint64_t nwritten;
zbx_uint64_t reads;
zbx_uint64_t writes;
}
zbx_perfstat_t;
int get_diskstat(const char *devname, zbx_uint64_t *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;
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
{