
# Nagios Backup

The backup script dump the content and the logs of Nagios

    module.exports = header: 'Nagios Backup', handler: ->
      {nagios} = @config.ryba

## Database

    # module.exports.push header: 'Database', handler: ->
    #   {nagios} = @config.ryba
    #   username = hive.site['javax.jdo.option.ConnectionUserName']
    #   password = hive.site['javax.jdo.option.ConnectionPassword']
    #   {engine, db, hostname, port} = db.jdbc hive.site['javax.jdo.option.ConnectionURL']
    #   engines =
    #     mysql: ->
    #       escape = (text) -> text.replace(/[\\"]/g, "\\$&")
    #       @tools.backup
    #         cmd: """
    #         mysqldump -u{username} -p#{password} -h#{hostname} -P#{port} #{db}
    #         """
    #         target: '/var/backup/@rybajs/metal/nagios/'
    #       , next
    #   return next new Error 'Database engine not supported' unless engines[engine]
    #   engines[engine]()

## Logs

Archive the logs generated by Nagios.

      @tools.backup
        header: 'Logs'
        name: 'logs'
        source: nagios.log_dir
        filter: "nagios.log*"
        target: nagios.backup_dir
        interval: month: 1
        retention: count: 2

## Configuration

Backup the active Nagios configuration.

      @system.backup
        header: 'Configuration'
        name: 'conf'
        source: '/etc/nagios'
        target: nagios.backup_dir
        interval: month: 1
        retention: count: 2
