4 ** NetXMS subagent for IPSO
5 ** Copyright (C) 2004 Alex Kirhenshtein
6 ** Copyright (C) 2006 Victor Kirhenshtein
8 ** This program is free software; you can redistribute it and/or modify
9 ** it under the terms of the GNU General Public License as published by
10 ** the Free Software Foundation; either version 2 of the License, or
11 ** (at your option) any later version.
13 ** This program is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ** GNU General Public License for more details.
18 ** You should have received a copy of the GNU General Public License
19 ** along with this program; if not, write to the Free Software
20 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <sys/param.h>
26 #include <sys/mount.h>
28 LONG
H_DiskInfo(char *pszParam
, char *pArg
, char *pValue
)
30 int nRet
= SYSINFO_RC_ERROR
;
31 char szArg
[512] = {0};
34 AgentGetParameterArg(pszParam
, 1, szArg
, sizeof(szArg
));
36 if (szArg
[0] != 0 && statfs(szArg
, &s
) == 0)
38 nRet
= SYSINFO_RC_SUCCESS
;
40 QWORD usedBlocks
= (QWORD
)(s
.f_blocks
- s
.f_bfree
);
41 QWORD totalBlocks
= (QWORD
)s
.f_blocks
;
42 QWORD blockSize
= (QWORD
)s
.f_bsize
;
43 QWORD freeBlocks
= (QWORD
)s
.f_bfree
;
44 QWORD availableBlocks
= (QWORD
)s
.f_bavail
;
49 ret_uint64(pValue
, totalBlocks
* blockSize
);
52 ret_uint64(pValue
, usedBlocks
* blockSize
);
55 ret_uint64(pValue
, freeBlocks
* blockSize
);
58 ret_uint64(pValue
, availableBlocks
* blockSize
);
61 ret_double(pValue
, (usedBlocks
* 100) / totalBlocks
);
64 ret_double(pValue
, (availableBlocks
* 100) / totalBlocks
);
67 ret_double(pValue
, (freeBlocks
* 100) / totalBlocks
);
70 nRet
= SYSINFO_RC_ERROR
;
78 ///////////////////////////////////////////////////////////////////////////////
81 $Log: not supported by cvs2svn $
82 Revision 1.4 2007/09/27 09:20:41 alk
83 DISK_* params fixed in all subagents
85 Revision 1.3 2006/08/16 22:26:09 victor
86 - Most of Net.Interface.XXX functions implemented on IPSO
87 - Added function MACToStr
89 Revision 1.2 2006/07/24 06:49:47 victor
90 - Process and physical memory parameters are working
91 - Various other changes
93 Revision 1.1 2006/07/21 11:48:35 victor
96 Revision 1.1 2005/01/17 17:14:32 alk
97 freebsd agent, incomplete (but working)
99 Revision 1.1 2004/10/22 22:08:34 alk
106 Net.InterfaceList (if-type not implemented yet)