Freyr - Resource monitor, dynamic DNS Updater

Freyr is a simple Perl program that is able to run external Nagios-compatible monitors and then can update DNS records for a given resource based on a state of monitors. For example let say that you have two data centers: one in New York and another one in London. Each of those two data centers provide HTTP service for www.example.com. You also have a DNS server, or servers, that are authorized for example.com zone. Then you can configure Freyr to monitor those HTTP resources and update an A record for www.example.com depending on the state of your resources. Two different policies are supported: Round-Robin and Disaster Recovery. In first case A record includes all active resources, in a second case A record includes on IP address of a first active service from a given list of monitored resources.

Monitor plugins

Freyr doesn't provide any monitoring plugins. Instead you can use any external program to use as a monitor for your resources. For example you can use Nagios plugins. The difference between Nagios and Freyr is that any non-zero exit code is considered as critical by Freyr and resource get disabled.

Prerequisites

Freyr required following additional Perl modules to be installed: Daemon::Generic, Net::DNS, Net::DNS::Update, Sys::Syslog. You can get all of them from CPAN.

Installation

Untar freyr.tar file into directory from which you want to run it. Create your freyr.conf file and copy it into /etc directory or any other directory if you don't want to use default location. If you want to run Freyr by non-root user you have to make sure that it's able to write into a pid file which is /var/run/freyr.pl

Configuration

Freyr provides an example freyr.conf file that you have to modify per your needs. The general syntax for freyr.conf is compatible with syntax for Nagios object config files. Following object and object attributes are supported:
    DNSServer - Controlled DNS server
        name - Name of controlled DNS server
        address - IP address for that DNS server
        key_name - name of a TSIG key that is used for authentication
        key - TSIG key
        timeout - Timeout during which DNS server has to respond to a 
                  requested operation. Default is 3s.
        
    Command - External command that is used for monitoring.
        command_name - Name of an external command.
        command_line - Command line. Following special variables are 
                       supported: $SERVICEADDRESS$, $ARGn.
    
    Service - Monitored service
        name
        address - IP address
        in_dns_address - IP address that this service provides to DNS. By 
                         default it's the same as 'address' but it can be 
                         different if you monitored a backend server that
                         uses internal IP but provides some external service 
                         through NATting or other technique.
        check_timeout
        check_attempts - How many time Freyr has to try this service before 
                         declaring it as dead.
        check_command - Name of a 'Command' objecty that is used for monitoring
                        this service. Syntax of this attribute is compatible 
                        with Nagios so you can use ! for passing additional 
                        arguments to monitoring plugin.
                        
    WideIP - Main object that combines services and DNS servers. Name is 
             borrowed from F5's GTM product.
        name
        dns_servers - List of DNS servers (comma separated names of 'DNSServe' 
                      objects) that are responsible for this WideIP
        services - List of service (comma separated names of 'Service' objects) 
                   that have to be monitored for this WideIP
        failover_policy - Round-Robin (rr) or Disaster Recovery (dr). Default 
                          is rr
        last_hope - Optional IP address that should be put into DNS if all of 
                    the resources are down.
Also you have to configure your DNS Servers to accept Dynamic updates from a host where you run Freyr. See documentation for your DNS server.

Project home

Freyr
Serge Dubrouski