Source
$req = DBselect('SELECT number_compressed_chunks FROM hypertable_compression_stats(\''.self::TABLENAME.'\')');
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/../include/CIntegrationTest.php';
/**
* Test Timescale DB extension.
*
* @required-components server
* @hosts test_timescale
* @backup history
*/
class testTimescaleDb extends CIntegrationTest {
const HOSTNAME = 'test_timescale';
const TRAPNAME = 'trap_timescale';
const TABLENAME = 'history_uint';
const HIST_COUNT = 3000;
/*
storing old data deep in the past - 20 days, which is way longer that the minimum 7days,
and must be guaranteed to be compressed
*/
const COMPRESSION_OLDER_THAN = 20 * 24 * 3600;
static $db_extension = '';
private static $itemid;
/**
* Component configuration provider.
*
* @return array
*/
public function serverConfigurationProvider() {
return [
self::COMPONENT_SERVER => [
'DebugLevel' => 5,
'LogFileSize' => 0
]
];
}
private function retrieveExtention() {
self::$db_extension = '';
$sql = 'SELECT db_extension'.
' FROM config';
$res = DBfetch(DBselect($sql));
if ($res) {
self::$db_extension = $res['db_extension'];