diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/zbxsysinfo/file.c | 36 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/sysinfo.c | 4 |
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"}, |