mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 08:02:51 +02:00
Added retention policy as option
This commit is contained in:
@@ -27,6 +27,7 @@ abstract class AdapterAbstract implements AdapterInterface
|
||||
{
|
||||
return [
|
||||
"database" => $this->getOptions()->getDatabase(),
|
||||
"retentionPolicy" => $this->getOptions()->getRetentionPolicy(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+19
-48
@@ -37,16 +37,31 @@ class Options
|
||||
*/
|
||||
private $database;
|
||||
|
||||
private $retentionPolicy;
|
||||
|
||||
/**
|
||||
* Set default options
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->host = "localhost";
|
||||
$this->port = 8086;
|
||||
$this->username = "root";
|
||||
$this->password = "root";
|
||||
$this->setHost("localhost");
|
||||
$this->setPort(8086);
|
||||
$this->setUsername("root");
|
||||
$this->setPassword("root");
|
||||
$this->setProtocol("http");
|
||||
|
||||
$this->setRetentionPolicy("default");
|
||||
}
|
||||
|
||||
public function getRetentionPolicy()
|
||||
{
|
||||
return $this->retentionPolicy;
|
||||
}
|
||||
|
||||
public function setRetentionPolicy($retentionPolicy)
|
||||
{
|
||||
$this->retentionPolicy = $retentionPolicy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,19 +72,12 @@ class Options
|
||||
return $this->protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $protocol
|
||||
* @return Options
|
||||
*/
|
||||
public function setProtocol($protocol)
|
||||
{
|
||||
$this->protocol = $protocol;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHost()
|
||||
{
|
||||
return $this->host;
|
||||
@@ -81,82 +89,50 @@ class Options
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|int
|
||||
*/
|
||||
public function getPort()
|
||||
{
|
||||
return $this->port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|int $port
|
||||
* @return Options
|
||||
*/
|
||||
public function setPort($port)
|
||||
{
|
||||
$this->port = $port;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $usarname
|
||||
* @return Options
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->username = $username;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $password
|
||||
* @return Options
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDatabase()
|
||||
{
|
||||
return $this->database;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $database
|
||||
* @return Options
|
||||
*/
|
||||
public function setDatabase($database)
|
||||
{
|
||||
$this->database = $database;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build http series edpoint
|
||||
* @return string
|
||||
*/
|
||||
public function getHttpSeriesEndpoint()
|
||||
{
|
||||
return sprintf(
|
||||
@@ -167,11 +143,6 @@ class Options
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build http database endpoint by name
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
public function getHttpQueryEndpoint($name = false)
|
||||
{
|
||||
$url = sprintf(
|
||||
|
||||
Reference in New Issue
Block a user