summaryrefslogtreecommitdiffstats
path: root/src/zabbix_agent
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-08-04 16:53:24 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-08-04 16:53:24 +0000
commit2f691b3628c4589fe258def9564d78cd134d3ebb (patch)
tree278a676e3e5540977348c86b9d7a96ccc105902d /src/zabbix_agent
parent89d810024288866e72586c1774dec254db9aa884 (diff)
downloadzabbix-2f691b3628c4589fe258def9564d78cd134d3ebb.tar.gz
zabbix-2f691b3628c4589fe258def9564d78cd134d3ebb.tar.xz
zabbix-2f691b3628c4589fe258def9564d78cd134d3ebb.zip
- added upgrades/dbpatches/1.0beta4_to_1.0beta5/ with patches (Alexei)
- added support for disktotal[*] (Alexei) - added support for inodetotal[*] (Alexei) - added support for *,/,+, and - in trigger expressions (Alexei) - removed frontends/php/chart4.php (Alexei) - update item status to UNSUPPORTED in case if SNMP support was not included into zabbix_suckerd (Alexei) - added mysql_init() to DBconnect() (Alexei) - fixed Next100 and Prev100 for case if some hosts are hidden (Alexei) - added select for latest values (Alexei) - delete related services if trigger is deleted (Alexei) - fixed problem with substitution of macros for messages (Alexei) - eliminated DBis_empty() by replacing to DBnum_rows() (Alexei) - MAX_STRING_LEN increased to 4096 (Alexei) - fixed zabbix_log(). Possible coredump if data contains %s, etc (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@445 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_agent')
-rw-r--r--src/zabbix_agent/sysinfo.c89
-rw-r--r--src/zabbix_agent/sysinfo.h4
2 files changed, 90 insertions, 3 deletions
diff --git a/src/zabbix_agent/sysinfo.c b/src/zabbix_agent/sysinfo.c
index a361481d..ec5d0a40 100644
--- a/src/zabbix_agent/sysinfo.c
+++ b/src/zabbix_agent/sysinfo.c
@@ -100,10 +100,13 @@ COMMAND commands[AGENT_MAX_USER_COMMANDS]=
{"version[zabbix_agent]",0, VERSION, 0},
- {"diskfree[*]" ,DF, 0, "/"},
+ {"diskfree[*]" ,DISKFREE, 0, "/"},
+ {"disktotal[*]" ,DISKTOTAL, 0, "/"},
{"inodefree[*]" ,INODE, 0, "/"},
+ {"inodetotal[*]" ,INODETOTAL, 0, "/"},
+
{"cksum[*]" ,CKSUM, 0, "/etc/services"},
{"filesize[*]" ,FILESIZE, 0, "/etc/passwd"},
@@ -622,12 +625,52 @@ float INODE(const char * mountPoint)
return s.f_ffree;
}
+ return FAIL;
+#endif
+}
+
+float INODETOTAL(const char * mountPoint)
+{
+#ifdef HAVE_SYS_STATVFS_H
+ struct statvfs s;
+
+ if ( statvfs( (char *)mountPoint, &s) != 0 )
+ {
+ return FAIL;
+ }
+
+ return s.f_files;
+#else
+ struct statfs s;
+ long blocks_used;
+ long blocks_percent_used;
+ if ( statfs( (char *)mountPoint, &s) != 0 )
+ {
+ return FAIL;
+ }
+
+ if ( s.f_blocks > 0 ) {
+ blocks_used = s.f_blocks - s.f_bfree;
+ blocks_percent_used = (long)
+ (blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5);
+
+/* printf(
+ "%7.0f %7.0f %7.0f %5ld%% %s\n"
+ ,s.f_blocks * (s.f_bsize / 1024.0)
+ ,(s.f_blocks - s.f_bfree) * (s.f_bsize / 1024.0)
+ ,s.f_bavail * (s.f_bsize / 1024.0)
+ ,blocks_percent_used
+ ,mountPoint);
+*/
+ return s.f_files;
+
+ }
return FAIL;
#endif
}
-float DF(const char * mountPoint)
+float DISKFREE(const char * mountPoint)
{
#ifdef HAVE_SYS_STATVFS_H
struct statvfs s;
@@ -669,6 +712,48 @@ float DF(const char * mountPoint)
#endif
}
+float DISKTOTAL(const char * mountPoint)
+{
+#ifdef HAVE_SYS_STATVFS_H
+ struct statvfs s;
+
+ if ( statvfs( (char *)mountPoint, &s) != 0 )
+ {
+ return FAIL;
+ }
+
+ return s.f_blocks * (s.f_bsize / 1024.0);
+#else
+ struct statfs s;
+ long blocks_used;
+ long blocks_percent_used;
+
+ if ( statfs( (char *)mountPoint, &s) != 0 )
+ {
+ return FAIL;
+ }
+
+ if ( s.f_blocks > 0 ) {
+ blocks_used = s.f_blocks - s.f_bfree;
+ blocks_percent_used = (long)
+ (blocks_used * 100.0 / (blocks_used + s.f_bavail) + 0.5);
+
+/* printf(
+ "%7.0f %7.0f %7.0f %5ld%% %s\n"
+ ,s.f_blocks * (s.f_bsize / 1024.0)
+ ,(s.f_blocks - s.f_bfree) * (s.f_bsize / 1024.0)
+ ,s.f_bavail * (s.f_bsize / 1024.0)
+ ,blocks_percent_used
+ ,mountPoint);
+*/
+ return s.f_blocks * (s.f_bsize / 1024.0);
+
+ }
+
+ return FAIL;
+#endif
+}
+
float TCP_LISTEN(const char *porthex)
{
#ifdef HAVE_PROC
diff --git a/src/zabbix_agent/sysinfo.h b/src/zabbix_agent/sysinfo.h
index 9b079d03..94a0f550 100644
--- a/src/zabbix_agent/sysinfo.h
+++ b/src/zabbix_agent/sysinfo.h
@@ -13,7 +13,8 @@ float BUFFERSMEM(void);
float CACHEDMEM(void);
float CKSUM(const char * filename);
float FILESIZE(const char * filename);
-float DF(const char * mountPoint);
+float DISKFREE(const char * mountPoint);
+float DISKTOTAL(const char * mountPoint);
float DISK_IO(void);
float DISK_RIO(void);
float DISK_WIO(void);
@@ -21,6 +22,7 @@ float DISK_RBLK(void);
float DISK_WBLK(void);
float FREEMEM(void);
float INODE(const char * mountPoint);
+float INODETOTAL(const char * mountPoint);
float KERNEL_MAXPROC(void);
float KERNEL_MAXFILES(void);
float PING(void);