I need to set up a user that can see all the graphs in the graph trees, that part I have figured out.
The other piece that is giving me trouble is I would like to give them read only access to the device list. that way they can look up device IP addresses by the host name and see any notes in the notes field.
I don't see any options that would allow a user to have read access to the hosts. I am running 0.8.7g
Thanks
User permissions question
Moderators: Developers, Moderators
Re: User permissions question
My suggestion...
(A) Use Thold plugin
Users can see devices 'thold' -> 'Host Status' tab.
(But notes are not displayed) (B) Use SuperLinks plugin and create custom page you like Sample code: ('devices.php' used at the above)
This code is totally borrowed from 'host.php'. :)
Note:
Custom page is loaded as inline-frame within 'superlinks.php'.
It is difficult (for me) to pass parameters dynamically to custom page, so I can't implement sorting/filtering list..
(A) Use Thold plugin
Users can see devices 'thold' -> 'Host Status' tab.
(But notes are not displayed) (B) Use SuperLinks plugin and create custom page you like Sample code: ('devices.php' used at the above)
This code is totally borrowed from 'host.php'. :)
Code: Select all
<?php
host();
function host() {
global $colors;
$sql_where = "";
html_start_box("", "100%", $colors["header"], "3", "center", "");
$sortby = "description";
if ($sortby=="hostname") {
$sortby = "INET_ATON(hostname)";
}
$host_graphs = array_rekey(db_fetch_assoc("SELECT host_id, count(*) as graphs FROM graph_local GROUP BY host_id"), "host_id", "graphs");
$host_data_sources = array_rekey(db_fetch_assoc("SELECT host_id, count(*) as data_sources FROM data_local GROUP BY host_id"), "host_id", "data_sources");
$sql_query = "SELECT *
FROM host
$sql_where
ORDER BY " . $sortby;
$hosts = db_fetch_assoc($sql_query);
$display_text = array(
"Description",
"Notes",
"ID",
"Graphs",
"Data Sources",
"Status",
"Event Count",
"Hostname",
"Current (ms)",
"Average (ms)",
"Availability");
html_header($display_text);
$i = 0;
if (sizeof($hosts) > 0) {
foreach ($hosts as $host) {
$items = array();
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $host["id"]); $i++;
array_push($items, htmlspecialchars($host["description"]));
array_push($items, htmlspecialchars($host["notes"]));
array_push($items, round(($host["id"]), 2));
array_push($items, (isset($host_graphs[$host["id"]]) ? $host_graphs[$host["id"]] : 0));
array_push($items, (isset($host_data_sources[$host["id"]]) ? $host_data_sources[$host["id"]] : 0));
array_push($items, get_colored_device_status(($host["disabled"] == "on" ? true : false), $host["status"]));
array_push($items, round(($host["status_event_count"]), 2));
array_push($items, htmlspecialchars($host["hostname"]));
array_push($items, round(($host["cur_time"]), 2));
array_push($items, round(($host["avg_time"]), 2));
array_push($items, round($host["availability"], 2));
print "<td>" . implode($items, "</td>\n<td>") . "</td>";
form_end_row();
}
}else{
print "<tr><td><em>No Hosts</em></td></tr>";
}
html_end_box(false);
}
?>
Custom page is loaded as inline-frame within 'superlinks.php'.
It is difficult (for me) to pass parameters dynamically to custom page, so I can't implement sorting/filtering list..
Who is online
Users browsing this forum: No registered users and 3 guests