summaryrefslogtreecommitdiffstats
path: root/src
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 /src
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
Diffstat (limited to 'src')
-rw-r--r--src/libs/zbxsysinfo/file.c36
-rw-r--r--src/libs/zbxsysinfo/sysinfo.c4
2 files changed, 40 insertions, 0 deletions
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"},