Page 1 of 2

I would like to website to show information about host

Posted: Tue Jun 06, 2017 10:12 am
by rumarcin11
I would like to website to show information about host computer ie ip and mac address, of course I have the address of computer name

Re: I would like to website to show information about host

Posted: Tue Jun 06, 2017 11:07 am
by mcapra
If you can post a screenshot of where you want the information displayed, that might be helpful.

Notes are a pretty easy way to store such references:

Code: Select all

define host{
...
		notes					hello world
...
        }

The end result:
2017_06_06_11_04_23_Nagios_Core_on_10.35.6.51.png
If you wanted it somewhere else, you'd likely need to modify the CGIs or submit a feature request via the github. Here's some C I hacked together to get some Kibana/Marvel graphs to show for hosts in multiple spots:
https://pastebin.com/HERbhf6X

Which uses the following custom attributes for a given host:

Code: Select all

define host{
...
		_marvel_node_ip			10.26.100.21
		_marvel_node_name		esdev01
...
        }
It exists in multiple places in status.c; I just highlighted once instance. Incredibly inelegant, but worked as a proof of concept for my use case.

Re: I would like to website to show information about host

Posted: Tue Jun 06, 2017 2:13 pm
by avandemore
@mcapra, cool solution! @rumarcin11 does that answer your question?

Re: I would like to website to show information about host

Posted: Wed Jun 07, 2017 1:24 am
by rumarcin11
No. I mean I would like the www to show ip info and physical mac address

define host{
use host-pc
host_name eendlo
alias 2.05
address 13835_CEZ
hostgroups pc
parents BA-PD2
notes (PD2-2/16)
# contact_gruops admins
}

Re: I would like to website to show information about host

Posted: Wed Jun 07, 2017 10:36 am
by lmiltchev
No. I mean I would like the www to show ip info and physical mac address
Nagios does show you this info... Am I missing something? See below:

Code: Select all

define host{
use linux-server
host_name test
alias My test host
address 192.168.4.41
hostgroups linux-servers
parents localhost
notes (Test Linux VM - MAC Address: 00:0c:29:6d:bf:b0)
}
example01.PNG

Re: I would like to website to show information about host

Posted: Thu Jun 08, 2017 1:45 am
by rumarcin11
I have several computers and ips are automatically, so it needs to www to show me the ip of the computer because I set in the "address" configuration as the computer name, not ip after. Because it will not be this computer all the time he had the same ip

Re: I would like to website to show information about host

Posted: Thu Jun 08, 2017 1:47 am
by rumarcin11
In place of service ping, to still show ip and not just status "OK"

Re: I would like to website to show information about host

Posted: Thu Jun 08, 2017 11:00 am
by lmiltchev
Maybe instead of ping, you could use check_dns. You should be able to see the ip in the output.

Example:

command definition

Code: Select all

define command {
       command_name                             check_dns
       command_line                             $USER1$/check_dns -H $HOSTADDRESS$ $ARG1$
}
host definition (google public dns)

Code: Select all

define host{
use linux-server
host_name test
alias My test host
address google-public-dns-a.google.com
hostgroups linux-servers
parents localhost
notes (Test Linux VM - MAC Address: xx:xx:xx:xx:xx:xx)
}
service definition

Code: Select all

define service {
host_name test
use generic-service
service_description Check DNS
check_command check_dns
}
in the GUI
example01.PNG
The ip address (8.8.8.8) is shown in the GUI. When I change the address of my test host from "google-public-dns-a.google.com" to "mpr.org", I see the updated ip address.

host definition (Minnesota Public Radio)

Code: Select all

define host{
use linux-server
host_name test
alias My test host
address mpr.org
hostgroups linux-servers
parents localhost
notes (Test Linux VM - MAC Address: xx:xx:xx:xx:xx:xx)
}
in the GUI
example02.PNG

Re: I would like to website to show information about host

Posted: Fri Jun 09, 2017 6:01 am
by rumarcin11
Thank you very much. I would like to know how it looks with mac, i mean i need a notes?

Re: I would like to website to show information about host

Posted: Fri Jun 09, 2017 11:36 am
by lmiltchev
I already showed you how the MAC will be displayed on the host.
example01.PNG
You could add the "notes" directive to the service too (if you wish).

Example:

Code: Select all

define service {
host_name test
use generic-service
service_description Check DNS
check_command check_dns
notes (Test Linux VM - MAC Address: xx:xx:xx:xx:xx:xx)
}
Then, you will be able to see the MAC on the service as well.
example02.PNG