summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-08-26 10:32:20 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-08-26 10:32:20 +0000
commit99083c2bc04469022b92e9ba5ecef62c6c7f9d05 (patch)
tree3f491c3627d25446451b9b8717d143b38ae62087
parentf5c8a71145751aef4bf6b2e379d73592108d9b3c (diff)
downloadzabbix-99083c2bc04469022b92e9ba5ecef62c6c7f9d05.tar.gz
zabbix-99083c2bc04469022b92e9ba5ecef62c6c7f9d05.tar.xz
zabbix-99083c2bc04469022b92e9ba5ecef62c6c7f9d05.zip
- added parameter fs.file.atime[] (Alexei)
- added parameter fs.file.ctime[] (Alexei) - added parameter fs.file.mtime[] (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@1994 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog3
-rw-r--r--include/sysinfo.h3
-rw-r--r--src/libs/zbxsysinfo/file.c36
-rw-r--r--src/libs/zbxsysinfo/sysinfo.c4
4 files changed, 46 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ce65b85a..887658e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
Changes for 1.1beta1:
+ - added parameter fs.file.atime[] (Alexei)
+ - added parameter fs.file.ctime[] (Alexei)
+ - added parameter fs.file.mtime[] (Alexei)
- parameter isfile[] renamed to fs.file.exists[] (Alexei)
- parameter filesize[] renamed to fs.file.size[] (Alexei)
- added parameter system.localtime (Alexei)
diff --git a/include/sysinfo.h b/include/sysinfo.h
index 69ff6676..6cabcbf2 100644
--- a/include/sysinfo.h
+++ b/include/sysinfo.h
@@ -73,6 +73,9 @@ int DISK_RBLK(const char *cmd, const char *parameter,double *value);
int DISK_WBLK(const char *cmd, const char *parameter,double *value);
int FREEMEM(const char *cmd, const char *parameter,double *value);
+int FS_FILE_ATIME(const char *cmd, const char *filename,double *value);
+int FS_FILE_CTIME(const char *cmd, const char *filename,double *value);
+int FS_FILE_MTIME(const char *cmd, const char *filename,double *value);
int FS_FILE_SIZE(const char *cmd, const char *filename,double *value);
int FS_FILE_EXISTS(const char *cmd, const char *filename,double *value);
diff --git a/src/libs/zbxsysinfo/file.c b/src/libs/zbxsysinfo/file.c
index b2dfaf41..8c05ae6b 100644
--- a/src/libs/zbxsysinfo/file.c
+++ b/src/libs/zbxsysinfo/file.c
@@ -94,6 +94,42 @@ int FS_FILE_SIZE(const char *cmd, const char *filename,double *value)
return SYSINFO_RET_FAIL;
}
+int FS_FILE_ATIME(const char *cmd, const char *filename,double *value)
+{
+ struct stat buf;
+
+ if(stat(filename,&buf) == 0)
+ {
+ *value=(double)buf.st_atime;
+ return SYSINFO_RET_OK;
+ }
+ return SYSINFO_RET_FAIL;
+}
+
+int FS_FILE_CTIME(const char *cmd, const char *filename,double *value)
+{
+ struct stat buf;
+
+ if(stat(filename,&buf) == 0)
+ {
+ *value=(double)buf.st_ctime;
+ return SYSINFO_RET_OK;
+ }
+ return SYSINFO_RET_FAIL;
+}
+
+int FS_FILE_MTIME(const char *cmd, const char *filename,double *value)
+{
+ struct stat buf;
+
+ if(stat(filename,&buf) == 0)
+ {
+ *value=(double)buf.st_ctime;
+ return SYSINFO_RET_OK;
+ }
+ return SYSINFO_RET_FAIL;
+}
+
int FS_FILE_EXISTS(const char *cmd, const char *filename,double *value)
{
struct stat buf;
diff --git a/src/libs/zbxsysinfo/sysinfo.c b/src/libs/zbxsysinfo/sysinfo.c
index f4bc11bb..9b2dec1c 100644
--- a/src/libs/zbxsysinfo/sysinfo.c
+++ b/src/libs/zbxsysinfo/sysinfo.c
@@ -175,6 +175,10 @@ COMMAND agent_commands[]=
{"md5sum[*]" ,0, MD5SUM, "/etc/services"},
+ {"fs.file.atime[*]" ,FS_FILE_ATIME, 0, "/etc/passwd"},
+ {"fs.file.ctime[*]" ,FS_FILE_CTIME, 0, "/etc/passwd"},
+ {"fs.file.mtime[*]" ,FS_FILE_MTIME, 0, "/etc/passwd"},
+
{"filesize[*]" ,FS_FILE_SIZE, 0, "/etc/passwd"},
{"fs.file.size[*]" ,FS_FILE_SIZE, 0, "/etc/passwd"},