I would like to website to show information about host

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

I would like to website to show information about host

Post 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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

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

Post 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.
Attachments
2017_06_06_10_58_57_Nagios_Core_on_10.35.6.51.png
Former Nagios employee
https://www.mcapra.com/
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

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

Post by avandemore »

@mcapra, cool solution! @rumarcin11 does that answer your question?
Previous Nagios employee
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

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

Post 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
}
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

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

Post 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
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

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

Post by rumarcin11 »

In place of service ping, to still show ip and not just status "OK"
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
rumarcin11
Posts: 36
Joined: Thu Feb 25, 2016 7:42 am

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

Post by rumarcin11 »

Thank you very much. I would like to know how it looks with mac, i mean i need a notes?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked