How do I Display Nagios Host Custom Variables or Macros in the Web Interface?

How can I display custom host variables in the Nagios web interface such as _mac_address?


Solution 1:

You can do this using the notes directive inside of the host definition even if the variables are also defined their and they will show up in the host detail page (extinfo.cgi). For example:

define host {
        host_name web01
        display_name web01
        address 8.8.4.4
        _mac_address  00:21:9B:00:21:9B
        _sw_port_1    sw01_g3
        notes $_HOSTMAC_ADDRESS$ $_HOSTSW_PORT_1$
        hostgroups +webservers
        use web_servers
}