diff --git a/ui/tests/integration/testAgentItems.php b/ui/tests/integration/testAgentItems.php index e1c0813c8ca1..af4aad830637 100644 --- a/ui/tests/integration/testAgentItems.php +++ b/ui/tests/integration/testAgentItems.php @@ -36,6 +36,7 @@ class testAgentItems extends CIntegrationTest { const TEST_FILE_BASE_NAME = 'test_file'; const TEST_LINK_BASE_NAME = 'test_link'; const TEST_FILE_NAME = '/tmp/'.self::TEST_FILE_BASE_NAME; + const TEST_FILE_NAME_ACCESS = '/tmp/'.self::TEST_FILE_BASE_NAME.'_access_test'; const TEST_LINK_NAME = '/tmp/'.self::TEST_LINK_BASE_NAME; const TEST_LINK_NAME2 = '/tmp/'.self::TEST_LINK_BASE_NAME.'2'; const TEST_DIR_NAME = '/tmp/dir'; @@ -196,7 +197,7 @@ class testAgentItems extends CIntegrationTest { 'result' => 'b73a96d498012c84fc2ffa1df3c4461689cb90456ee300654723205c26ec4988' ], [ - 'key' => 'vfs.file.get['.self::TEST_FILE_NAME.']', + 'key' => 'vfs.file.get['.self::TEST_FILE_NAME_ACCESS.']', 'type' => ITEM_TYPE_ZABBIX, 'component' => self::COMPONENT_AGENT, 'valueType' => ITEM_VALUE_TYPE_TEXT, @@ -204,24 +205,24 @@ class testAgentItems extends CIntegrationTest { 'fields_exec' => ['permissions', 'user', 'group', 'uid', 'gid', 'access', 'change'], 'result' => [ 'type' => 'file', - 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME, - 'user' => 'stat -c %U '.self::TEST_FILE_NAME, - 'group' => 'stat -c %G '.self::TEST_FILE_NAME, - 'uid' => 'stat -c %u '.self::TEST_FILE_NAME, - 'gid' => 'stat -c %g '.self::TEST_FILE_NAME, + 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME_ACCESS, + 'user' => 'stat -c %U '.self::TEST_FILE_NAME_ACCESS, + 'group' => 'stat -c %G '.self::TEST_FILE_NAME_ACCESS, + 'uid' => 'stat -c %u '.self::TEST_FILE_NAME_ACCESS, + 'gid' => 'stat -c %g '.self::TEST_FILE_NAME_ACCESS, 'size' => 27, 'time' => [ 'modify' => '2021-03-29T14:59:09+0300' ], 'timestamp' => [ - 'access' => 'stat -c %X '.self::TEST_FILE_NAME, + 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS, 'modify' => self::TEST_MOD_TIMESTAMP, - 'change' => 'stat -c %Z '.self::TEST_FILE_NAME + 'change' => 'stat -c %Z '.self::TEST_FILE_NAME_ACCESS ] ] ], [ - 'key' => 'vfs.file.get['.self::TEST_FILE_NAME.']', + 'key' => 'vfs.file.get['.self::TEST_FILE_NAME_ACCESS.']', 'type' => ITEM_TYPE_ZABBIX, 'component' => self::COMPONENT_AGENT2, 'valueType' => ITEM_VALUE_TYPE_TEXT, @@ -229,19 +230,19 @@ class testAgentItems extends CIntegrationTest { 'fields_exec' => ['permissions', 'user', 'group', 'uid', 'gid', 'access', 'change'], 'result' => [ 'type' => 'file', - 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME, - 'user' => 'stat -c %U '.self::TEST_FILE_NAME, - 'group' => 'stat -c %G '.self::TEST_FILE_NAME, - 'uid' => 'stat -c %u '.self::TEST_FILE_NAME, - 'gid' => 'stat -c %g '.self::TEST_FILE_NAME, + 'permissions' => 'stat -c %04a '.self::TEST_FILE_NAME_ACCESS, + 'user' => 'stat -c %U '.self::TEST_FILE_NAME_ACCESS, + 'group' => 'stat -c %G '.self::TEST_FILE_NAME_ACCESS, + 'uid' => 'stat -c %u '.self::TEST_FILE_NAME_ACCESS, + 'gid' => 'stat -c %g '.self::TEST_FILE_NAME_ACCESS, 'size' => 27, 'time' => [ 'modify' => '2021-03-29T14:59:09+03:00' ], 'timestamp' => [ - 'access' => 'stat -c %X '.self::TEST_FILE_NAME, + 'access' => 'stat -c %X '.self::TEST_FILE_NAME_ACCESS, 'modify' => self::TEST_MOD_TIMESTAMP, - 'change' => 'stat -c %Z '.self::TEST_FILE_NAME + 'change' => 'stat -c %Z '.self::TEST_FILE_NAME_ACCESS ] ] ], @@ -708,6 +709,8 @@ public function prepareData() { // Write test file $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME, "1st line\n2nd line\n3rd line\n") !== false); $this->assertTrue(@touch(self::TEST_FILE_NAME, self::TEST_MOD_TIMESTAMP)); + $this->assertTrue(@file_put_contents(self::TEST_FILE_NAME_ACCESS, "1st line\n2nd line\n3rd line\n") !== false); + $this->assertTrue(@touch(self::TEST_FILE_NAME_ACCESS, self::TEST_MOD_TIMESTAMP)); $this->assertTrue(@file_put_contents(self::TEST_DIR_FILE_NAME, "1st line\n2nd line\n3rd line\n") !== false); $this->assertTrue(@touch(self::TEST_DIR_FILE_NAME, self::TEST_MOD_TIMESTAMP)); @@ -727,6 +730,8 @@ public function prepareData() { $this->assertTrue(@touch(self::TEST_DIR_DIR1_NAME, self::TEST_MOD_TIMESTAMP)); + $this->assertTrue(@exec('touch -h -a -m -t 202103291459.09 '.self::TEST_FILE_NAME_ACCESS) !== false); + return true; } diff --git a/ui/tests/integration/testGoAgentDataCollection.php b/ui/tests/integration/testGoAgentDataCollection.php index 907ecb321e39..9ea43a5062a9 100644 --- a/ui/tests/integration/testGoAgentDataCollection.php +++ b/ui/tests/integration/testGoAgentDataCollection.php @@ -220,31 +220,31 @@ class testGoAgentDataCollection extends CIntegrationTest { 'key' => 'system.cpu.util[,,avg1]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 0.5 + 'threshold' => 0.9 ], [ 'key' => 'system.cpu.load[,avg1]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 0.5 + 'threshold' => 0.9 ], [ 'key' => 'vfs.dev.read[,operations]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 10 + 'threshold' => 1000 ], [ 'key' => 'vfs.dev.write[,operations]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 100 + 'threshold' => 10000 ], [ 'key' => 'proc.cpu.util[,,,,avg1]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 10.0, + 'threshold' => 90.0, 'compareType' => self::COMPARE_AVERAGE ], [ @@ -258,60 +258,60 @@ class testGoAgentDataCollection extends CIntegrationTest { 'key' => 'system.swap.out[,pages]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 100, + 'threshold' => 10000, 'compareType' => self::COMPARE_AVERAGE ], [ 'key' => 'proc.mem[zabbix_server,zabbix,avg]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 100.0 + 'threshold' => 10000.0 ], [ 'key' => 'web.page.perf[http://localhost]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 1.0, + 'threshold' => 100.0, 'compareType' => self::COMPARE_AVERAGE ], [ 'key' => 'net.tcp.service.perf[ssh]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 0.05 + 'threshold' => 5.00 ], [ 'key' => 'net.udp.service.perf[ntp]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 0.05 + 'threshold' => 5.00 ], [ 'key' => 'system.swap.size[,total]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 100, + 'threshold' => 10000, 'compareType' => self::COMPARE_AVERAGE ], [ 'key' => 'vfs.fs.inode[/,pfree]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_FLOAT, - 'threshold' => 0.1, + 'threshold' => 0.9, 'compareType' => self::COMPARE_AVERAGE ], [ 'key' => 'vfs.fs.size[/tmp,free]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 10000000, + 'threshold' => 100000000, 'compareType' => self::COMPARE_AVERAGE ], [ 'key' => 'vm.memory.size[free]', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_UINT64, - 'threshold' => 10000000, + 'threshold' => 100000000, 'compareType' => self::COMPARE_AVERAGE ], [// Should be treated as a special case, since this metric returns JSON object. @@ -319,7 +319,7 @@ class testGoAgentDataCollection extends CIntegrationTest { 'key' => 'zabbix.stats[127.0.0.1,'.PHPUNIT_PORT_PREFIX.self::SERVER_PORT_SUFFIX.']', 'type' => ITEM_TYPE_ZABBIX, 'valueType' => ITEM_VALUE_TYPE_TEXT, - 'threshold' => 50 + 'threshold' => 500 ] ];