mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Apply fixes from StyleCI (#12117)
* Apply fixes from StyleCI * Disable style check
This commit is contained in:
@@ -33,7 +33,7 @@ use Log;
|
||||
|
||||
class OpenTSDB extends BaseDatastore
|
||||
{
|
||||
/** @var \Socket\Raw\Socket $connection */
|
||||
/** @var \Socket\Raw\Socket */
|
||||
protected $connection;
|
||||
|
||||
public function __construct(\Socket\Raw\Factory $socketFactory)
|
||||
@@ -76,19 +76,20 @@ class OpenTSDB extends BaseDatastore
|
||||
*/
|
||||
public function put($device, $measurement, $tags, $fields)
|
||||
{
|
||||
if (!$this->connection) {
|
||||
if (! $this->connection) {
|
||||
Log::error("OpenTSDB Error: not connected\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$flag = Config::get('opentsdb.co');
|
||||
$timestamp = Carbon::now()->timestamp;
|
||||
$tmp_tags = "hostname=".$device['hostname'];
|
||||
$tmp_tags = "hostname=" . $device['hostname'];
|
||||
|
||||
foreach ($tags as $k => $v) {
|
||||
$v = str_replace(array(' ',',','='), '_', $v);
|
||||
if (!empty($v)) {
|
||||
$tmp_tags = $tmp_tags ." ". $k ."=".$v;
|
||||
$v = str_replace([' ', ',', '='], '_', $v);
|
||||
if (! empty($v)) {
|
||||
$tmp_tags = $tmp_tags . " " . $k . "=" . $v;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,10 +97,10 @@ class OpenTSDB extends BaseDatastore
|
||||
foreach ($fields as $k => $v) {
|
||||
$measurement = $k;
|
||||
if ($flag == true) {
|
||||
$measurement = $measurement.".".$device['co'];
|
||||
$measurement = $measurement . "." . $device['co'];
|
||||
}
|
||||
|
||||
$this->putData('port.'.$measurement, $timestamp, $v, $tmp_tags);
|
||||
$this->putData('port.' . $measurement, $timestamp, $v, $tmp_tags);
|
||||
}
|
||||
} else {
|
||||
if ($flag == true) {
|
||||
@@ -136,7 +137,7 @@ class OpenTSDB extends BaseDatastore
|
||||
/**
|
||||
* Checks if the datastore wants rrdtags to be sent when issuing put()
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function wantsRrdTags()
|
||||
{
|
||||
|
Reference in New Issue
Block a user