Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #674] IPv6 and Multiple adresses for one host #338

Closed
icinga-migration opened this issue Aug 4, 2010 · 13 comments
Closed

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/674

Created by mfriedrich on 2010-08-04 07:10:28 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2011-02-09 17:06:27 +00:00)
Target Version: 1.3
Last Update: 2012-08-28 16:15:43 +00:00 (in Redmine)


http://feedback.icinga.org/forums/50329-general/suggestions/890667-multiple-adresses-for-one-host?ref=comments

Some hosts today have more then one interface, and the common way to monitor these would be to create a host object for EACH interface based on the fact that each interface has it's own address.

What about making it possible to give several adresses to each host, so it all appears in the same ... more

Some hosts today have more then one interface, and the common way to monitor these would be to create a host object for EACH interface based on the fact that each interface has it's own address.

What about making it possible to give several adresses to each host, so it all appears in the same host object?
It would require some logic regarding what check to run on what interface, but it can be solved!

Attachments

Changesets

2011-02-08 17:01:06 +00:00 by mfriedrich de9bc5a

core: add basic dualstacked IPv6 support (core/cgi patch by Julius Kriukas, slight changes on Icinga, own IDOUtils backend code) #674

see the issue/changelog for more information.

refs #674

Relations:

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2010-09-02 10:38:09 +00:00

  • Subject changed from Multiple adresses for one host to IPv6 and Multiple adresses for one host
  • Priority changed from Low to Normal

this matches IPv6 too.

http://feedback.icinga.org/forums/50329-general/suggestions/890661-ipv6?ref=title

Suppport for IPv6 would be a step in the proper direction for Icinga!

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-01-17 09:05:27 +00:00

  • File added nagios-HEAD-ipv6.patch
  • Status changed from New to Feedback

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-01-17 14:49:51 +00:00

http://www.thibault.info/aggregator/categories/2?page=2
http://exchange.nagios.org/directory/Patches/Nagios/Add-IPv6-address-to-host-definition/details

This patch allows you to add 'address6' directive to host definition. And use this value in command definitions via %HOSTADDRESS6% macro.

That way you can define special commands to check IPv6 services.
For example:
define command{
command_name check_ssh6
command_line $USER1$/check_ssh -6 $ARG1$ $HOSTADDRESS6$
}
This patch is useful if you are monitoring servers and services in dual-stack environment.

Essentially it allows you to add IPv6 address to your host definition via 'address6' directive.

Example:
define host{
use linux-server
host_name serv_name
alias serv_name.example.net
address 198.51.100.123
address6 2001:DB8:2::123
}

Host IPv6 address can be used to define IPv6 service checks. It is accessible via %ADDRESS6% macro.

Example:
define service{
use generic-service
host_name serv_name
service_description SSH6
check_command check_ssh6
}
define command{
command_name check_ssh6
command_line $USER1$/check_ssh -6 $ARG1$ $HOSTADDRESS6$
}

Having this configuration allows you to easily check service availability over IPv4 and IPv6 and associate results with one host.


This patch is almost identical to 'second IP-address' patch. However it works with newer nagios versions. It duplicates all nagios code related to 'address' directive, but replacing it with 'address6'.

The value of booth 'address' and 'address6' directives is never validated to be IP addresses. Therefore you can use FQDN or any other value that you might need associate with host. 

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-01-24 21:33:01 +00:00

  • Status changed from Feedback to Assigned
  • Assigned to set to mfriedrich
  • Target Version set to 1.5

would be interesting for the next unstable branch. if changing the objects.h it is necessary to put the newly added object at the end of the struct (typecasting and adress mapping, otherwise things may segfault the way they are being used (mklivestatus!)).

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-02-07 17:28:17 +00:00

  • Target Version changed from 1.5 to 1.4

    vim tests/674.cfg

    define command {
    command_name check-host-alive-v6
    command_line $USER1$/check_ping -H $HOSTADDRESS6$ -w 3000.0,80% -c 5000.0,100% -p 5
    }

    define host{
    name linux-server-v6 ; The name of this host template
    use generic-host ; This template inherits other values from the generic-host template
    check_period 24x7 ; By default, Linux hosts are checked round the clock
    check_interval 5 ; Actively check the host every 5 minutes
    retry_interval 1 ; Schedule host check retries at 1 minute intervals
    max_check_attempts 10 ; Check each Linux host 10 times (max)
    check_command check-host-alive-v6 ; Default command to check Linux hosts
    notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day
    ; Note that the notification_period variable is being overridden from
    ; the value that is inherited from the generic-host template!
    notification_interval 120 ; Resend notifications every 2 hours
    notification_options d,u,r ; Only send notifications for specific host states
    contact_groups friedrm8 ; Notifications get sent to the admins by default
    register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
    }

    define host{
    use linux-server-v6 ; Name of host template to use
    ; This host definition will inherit all variables that are defined
    ; in (or inherited by) the linux-server host template definition.
    host_name localhostv6
    alias localhostv6
    address 127.0.0.1
    address6 ::1
    }

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-02-07 17:33:13 +00:00

  • File added icinga_ipv6_patch_extinfocgi_01.png

with applied patch using the above config, it looks like this from the logs (having a wrong path for check_ping too)

Feb  7 18:27:07 xxx icinga: HOST ALERT: localhostv6;DOWN;SOFT;3;(null)

Feb  7 18:29:08 xxx icinga: HOST ALERT: localhostv6;UP;SOFT;2;PING OK - Packet loss = 0%, RTA = 0.08 ms

and on the extinfo.cgi it looks like this - ipv6 is only shown if defined (that's a minor change i did on the original patch, the comma would look strange in case)

icinga_ipv6_patch_extinfocgi_01.png

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-02-07 17:47:54 +00:00

if used with icinga-web, it needs aptched idomod/ido2db too and updated database schema.

idomod.c:
/**** dump host config ****/

this requires a change in the way data is being sent on the socket, and then being put into the database (config queries).

but as a matter of fact, i think this is mandatory to complete this feature ;D

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-02-08 11:38:11 +00:00

had some issues bringing ido2db into shape (IDO_MAX_DATATYPES is an array size identifier, if not incrementing when adding a new data_type, accessing a wrong index in the array (size-1+1) will segfault then.

but right on, address6 column on icinga_hosts is being populated too. so icinga-web could select that too in further implementations.

will push to my branch after some more testing.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-02-08 14:59:16 +00:00

  • Target Version changed from 1.4 to 1.3
  • Done % changed from 0 to 90

from objects.cache - everything works as expected.
databases are bing populated correctly. and hostaddress6 does not survive a restart.

define command {
        command_name    check-host-alive-v6
        command_line    /opt/nagios/libexec/check_ping -6 -H $HOSTADDRESS6$ -w 3000.0,80% -c 5000.0,100% -p 5
        }

define host {
        host_name       localhostv6
        alias   localhostv6
        address 127.0.0.1
        address6        ::1
        check_period    24x7
        check_command   check-host-alive-v6
        contact_groups  xxx
        notification_period     workhours
        initial_state   o
        check_interval  5.000000
        retry_interval  1.000000
        max_check_attempts      10
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess_over_host        1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  o,d,u
        freshness_threshold     0
        check_freshness 0
        notification_options    d,u,r
        notifications_enabled   1
        notification_interval   120.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        failure_prediction_enabled      1
        retain_status_information       1
        retain_nonstatus_information    1
        }

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-02-08 18:17:47 +00:00

if address6 is not set, the host name is taken instead (for dns resolution purposes).

the classic ui negotiates this by comparing if name==address6 and in that case not showing address6 as 'real' ipv6 address. neither should do icinga-web then - the database holds the default hostname for the address6 if nothing set. this is on purpose for other readings too (like the core behaves in objects.cache).

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2011-02-09 17:06:27 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 90 to 100

check icinga-web issue #1206

ready for release. maybe add some docs hints somewhere.

@icinga-migration
Copy link
Author

Updated by calestyo on 2012-08-28 15:44:52 +00:00

Stupid question: Wasn't all that already possible via custom object variables?

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2012-08-28 16:15:43 +00:00

sure, but which gui did have native support for custom variables? likewise, a native macro, other than a custom var macro, is even better. it might be a small change, but for productive usage, i prefer something not "volatile" in many cases.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant