mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: Oxidized basic config search (#5333)
This commit is contained in:
committed by
Neil Lathwood
parent
b3f6218359
commit
92aab1608d
31
html/includes/forms/search-oxidized-config.inc.php
Normal file
31
html/includes/forms/search-oxidized-config.inc.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2017 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
header('Content-type: application/json');
|
||||
|
||||
$status = 'error';
|
||||
$message = 'unknown error';
|
||||
$parameters = clean($_POST['search_in_conf_textbox']);
|
||||
if (isset($parameters)) {
|
||||
$status = 'ok';
|
||||
$message = 'Queried';
|
||||
$output = clean(search_oxidized_config($parameters));
|
||||
} else {
|
||||
$status = 'error';
|
||||
$message = 'ERROR: Could not query';
|
||||
}
|
||||
|
||||
echo _json_encode(array(
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'search_in_conf_textbox' => $parameters,
|
||||
'output' => $output
|
||||
));
|
@@ -1362,3 +1362,23 @@ function get_rules_from_json()
|
||||
global $config;
|
||||
return json_decode(file_get_contents($config['install_dir'] . '/misc/alert_rules.json'), true);
|
||||
}
|
||||
|
||||
function search_oxidized_config($search_in_conf_textbox)
|
||||
{
|
||||
global $config;
|
||||
$oxidized_search_url = $config['oxidized']['url'] . '/nodes/conf_search?format=json';
|
||||
$postdata = http_build_query(
|
||||
array(
|
||||
'search_in_conf_textbox' => $search_in_conf_textbox,
|
||||
)
|
||||
);
|
||||
$opts = array('http' =>
|
||||
array(
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-type: application/x-www-form-urlencoded',
|
||||
'content' => $postdata
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($opts);
|
||||
return json_decode(file_get_contents($oxidized_search_url, false, $context), true);
|
||||
}
|
||||
|
@@ -89,6 +89,12 @@ if ($config['title_image']) {
|
||||
<a href="<?php echo(generate_url(array('page'=>'overview'))); ?>"><i class="fa fa-wrench fa-fw fa-lg" aria-hidden="true"></i> Tools</a>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<li><a href="<?php echo(generate_url(array('page'=>'ripenccapi'))); ?>"><i class="fa fa-arrow-circle-up fa-fw fa-lg" aria-hidden="true"></i> RIPE NCC API</a></li>
|
||||
<?php
|
||||
if ($config['oxidized']['enabled'] === true && isset($config['oxidized']['url'])) {
|
||||
echo '<li><a href="'.generate_url(array('page'=>'oxidized')).'"><i class="fa fa-arrow-circle-up fa-fw fa-lg" aria-hidden="true"></i> Oxidized</a></li>';
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</li>
|
||||
<li role="presentation" class="divider"></li>
|
||||
|
Reference in New Issue
Block a user