In the tree view on the left multiple levels can be defined to classify information. In the end the final branch the tree shows hosts. Now the hostname here can be free defined by the user and is then used on top of the graphs as a label. Is it possible to add the real device name (queryable via SNMP) of a device to the graph? If yes, can you please share how?
Thank you.
How to get the host name of a device into the graph
Moderators: Developers, Moderators
How to get the host name of a device into the graph
- Attachments
-
- cacti_hostname.png (67.82 KiB) Viewed 1892 times
Re: How to get the host name of a device into the graph
This is a dirty hack. At your own risk :Pwhatz wrote:Is it possible to add the real device name (queryable via SNMP) of a device to the graph?
In function form_save() of host.php, change from
Code: Select all
if ((isset($_POST["save_component_host"])) && (empty($_POST["add_dq_x"]))) {
if (...) {
raise_message(4);
}else{
$host_id = api_device_save($_POST["id"], $_POST["host_template_id"], $_POST["description"],
...
Code: Select all
if ((isset($_POST["save_component_host"])) && (empty($_POST["add_dq_x"]))) {
if (...) {
raise_message(4);
}else{
$snmp_hostname = cacti_snmp_get(
$_POST["hostname"],
$_POST["snmp_community"],
".1.3.6.1.2.1.1.5.0",
$_POST["snmp_version"],
$_POST["snmp_username"],
$_POST["snmp_password"],
$_POST["snmp_auth_protocol"],
$_POST["snmp_priv_passphrase"],
$_POST["snmp_priv_protocol"],
$_POST["snmp_context"],
$_POST["snmp_port"],
$_POST["snmp_timeout"],
read_config_option("snmp_retries"),
SNMP_WEBUI);
if (!empty($snmp_hostname)) {
$_POST["description"] = $snmp_hostname;
}
$host_id = api_device_save($_POST["id"], $_POST["host_template_id"], $_POST["description"],
...
(But nothing changed if there is any misconfiguration at SNMP options)
// tested (not fully) on Cacti 0.8.7i
Who is online
Users browsing this forum: No registered users and 1 guest