installing nagios from debian's package on debian 3.1(sarge) stable

John Stile john at stilen.com
Mon Oct 3 23:50:21 CEST 2005


On Mon, 2005-10-03 at 20:20 +0000, enediel gonzalez wrote:
> Hello
> 
> I've a box with nagios up and running installed on /usr/local/nagios
> 
> I'm preparing a second box, with debian sarge stable version, I installed 
> nagios from the packages included on debian, but now nagios was installed on 
> /etc/nagios.
> 
> The documentation references to /usr/local/nagios, and mention a set of 
> subdirectories that should exist, nothing except the stylesheets 
> subdirectory appear on /etc/nagios after this new installation
> 
> Looks like I need a little more informacion to pass transparently the 
> configuration I've on the first box to the new box
> 
> Thanks in advance for any help
> Enediel
> Linux user 398956
> 

What is your question?
I have setup nagios 1.3 on Debian 3.1 with deb packages, and while I
haven't figured out nagiosgraphs, Nagios with mysql works.
Hopefully these notes will be helpful to you: 

# Install packages
  aptitude install nagios-mysql \
                  nagios-common \
                  nagios-plugins \
                  nagios-statd-client \
                  nagios-statd-server \
                  nagios-stat-client \
                  iputils-ping \
                  nsca \
                  nagios-nrpe-plugin \
                  nagios-nrpe-server \
                  nagios-nrpe-doc  \
                  qstat fping libnet-snmp-perl libradius1 

# Location of some files:
Apache conf:    /etc/apache2/conf.d/nagios
Apache pass:    /etc/nagios/htpasswd.users 
Nagios cgi-bin: /usr/lib/cgi-bin/nagios
Nagios htdocs:  /usr/share/nagios/htdocs
Nagios logs:    /var/log/nagios/nagios.log
NSCA:           /etc/send_nsca.cfg
                /etc/nsca.cfg
NRPE Server:    /etc/nagios/nrpe.cfg
                /etc/nagios/nrpe_local.cfg

# Setup passwords
sudo htpasswd -c /etc/nagios/htpasswd.users nagiosadmin

# Fix perms on nagios-plugins
chown -R nagios:www-data /etc/nagios-plugins

# Databases setup
mysqladmin -u root -p create nagios
zcat /usr/share/doc/nagios-mysql/create_mysql.gz | mysql -u root -p
nagios
echo > mysql nagios -uroot -p <EOF
  GRANT LOCK TABLES ON nagios.* TO nagios at localhost IDENTIFIED BY
'nagios' ;
  GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON nagios.* TO
nagios at localhost; 
  flush privileges;
  quit;
EOF

vi  /etc/nagios/resource.cfg
      xsddb_host=localhost
      #xsddb_port=someport
      xsddb_database=nagios
      xsddb_username=nagios
      xsddb_password=nagios

      xcddb_host=localhost
      #xcddb_port=someport
      xcddb_database=nagios
      xcddb_username=nagios
      xcddb_password=nagios

      xdddb_host=localhost
      #xdddb_port=someport
      xdddb_database=nagios
      xdddb_username=nagios
      xdddb_password=nagios
      #xdddb_optimize_data=1

      xrddb_host=localhost
      #xrddb_port=someport
      xrddb_database=nagios
      xrddb_username=nagios
      xrddb_password=nagios
      #xrddb_optimize_data=1

vi  /etc/nagios/cgi.cfg

      xeddb_host=localhost
      #xeddb_port=someport
      xeddb_database=nagios
      xeddb_username=nagios
      xeddb_password=nagios

      xsddb_host=localhost
      #xsddb_port=someport
      xsddb_database=nagios
      xsddb_username=nagios
      xsddb_password=nagios

      xcddb_host=localhost
      #xcddb_port=someport
      xcddb_database=nagios
      xcddb_username=nagios
      xcddb_password=nagios

      xdddb_host=localhost
      #xdddb_port=someport
      xdddb_database=nagios
      xdddb_username=nagios
      xdddb_password=nagios

      authorized_for_system_information=nagiosadmin
      authorized_for_configuration_information=nagiosadmin
      authorized_for_system_commands=nagiosadmin
      authorized_for_all_services=nagiosadmin
      authorized_for_all_hosts=nagiosadmin
      authorized_for_all_service_commands=nagiosadmin
      authorized_for_all_host_commands=nagiosadmin
      
cd /etc/nagios/
vi nagios.cfg
     log_file=/var/log/nagios/nagios.log
     cfg_file=/etc/nagios/checkcommands.cfg
     cfg_dir=/etc/nagios-plugins/config/
     cfg_file=/etc/nagios/misccommands.cfg
     cfg_file=/etc/nagios/contactgroups.cfg
     cfg_file=/etc/nagios/contacts.cfg
     cfg_file=/etc/nagios/dependencies.cfg
     cfg_file=/etc/nagios/escalations.cfg
     cfg_file=/etc/nagios/hostgroups.cfg
     cfg_file=/etc/nagios/hosts.cfg
     cfg_file=/etc/nagios/services.cfg
     cfg_file=/etc/nagios/timeperiods.cfg
     resource_file=/etc/nagios/resource.cfg
     status_file=/var/log/nagios/status.log
     nagios_user=nagios
     nagios_group=nagios
     check_external_commands=1
     command_check_interval=-1
     command_file=/var/run/nagios/nagios.cmd
     comment_file=/var/log/nagios/comment.log
     downtime_file=/var/log/nagios/downtime.log
     lock_file=/var/log/nagios/nagios.lock
     temp_file=/var/cache/nagios/nagios.tmp
     log_rotation_method=d
     log_archive_path=/var/log/nagios/archives
     use_syslog=1
     log_notifications=1
     log_service_retries=1
     log_host_retries=1
     log_event_handlers=1
     log_initial_states=0
     log_external_commands=1
     log_passive_service_checks=1
     inter_check_delay_method=s
     service_interleave_factor=s
     max_concurrent_checks=0
     service_reaper_frequency=10
     sleep_time=1
     service_check_timeout=60
     host_check_timeout=30
     event_handler_timeout=30
     notification_timeout=30
     ocsp_timeout=5
     perfdata_timeout=5
     retain_state_information=1
     state_retention_file=/var/cache/nagios/status.sav
     retention_update_interval=60
     use_retained_program_state=0
     interval_length=60
     use_agressive_host_checking=0
     execute_service_checks=1
     accept_passive_service_checks=1
     enable_notifications=1
     enable_event_handlers=1
     process_performance_data=0
     obsess_over_services=0
     check_for_orphaned_services=0
     check_service_freshness=1
     freshness_check_interval=60
     aggregate_status_updates=1
     status_update_interval=15
     enable_flap_detection=0
     low_service_flap_threshold=5.0
     high_service_flap_threshold=20.0
     low_host_flap_threshold=5.0
     high_host_flap_threshold=20.0
     date_format=us
     illegal_object_name_chars=`~!$%^&*|'"<>?,()=
     illegal_macro_output_chars=`~$&|'"<>
     admin_email=nagios
     admin_pager=pagenagios

# Add your hosts
cp hosts.cfg hosts.cfg.orig
vi hosts.cfg 
     # 'one_host.stilen.com' host definition
     define host{
             use                     generic-host
             host_name               one_host.stilen.com
             alias                   one_host
             address                 192.169.50.195
             check_command           check-host-alive
             max_check_attempts      10
             notification_interval   480
             notification_period     24x7
             notification_options    d,u,r
             }

# Add host to hostgroup.
vi hostgroups.cfg
      # Default gateway host group definition
      define hostgroup{
              hostgroup_name  gateways
              alias           Routers and Gateways
              contact_groups  linux-admins
              members         gw
              }
      # 'linux-boxes' host group definition
      define hostgroup{
              hostgroup_name  linux-boxes
              alias           Linux Servers
              contact_groups  linux-admins
              members         one_host.stilen.com
              }

# Crate a service to monitor for the host
cp services.cfg services.cfg.orig
vi services.cfg
     Change all contact_groups to linux-admins
     Basically one definition section per service per host.
     i.e.
   # Service definition
   define service{
      use                            generic-service
      host_name                      one_host.stilen.com
      service_description            PING
      is_volatile                    0
      check_period                   24x7
      max_check_attempts             3
      normal_check_interval          5
      retry_check_interval           1
      contact_groups                 linux-admins
      notification_interval          240
      notification_period            24x7
      notification_options           c,r
      check_command                  check_ping!100.0,20%!500.0,60%
    }

Create an escalation
cp escalations.cfg escalations.cfg.orig
vi escalations.cfg 
        # Serviceescalation definition
        define serviceescalation{
                host_name                       one_host.stilen.com
                service_description             PING
                first_notification              2
                last_notification               6
                contact_groups                  linux-admins
                notification_interval           0
                }

# Add a user to contact group
cp contactgroups.cfg contactgroups.cfg.orig          
vi contactgroups.cfg
       # 'linux-admins' contact group definition
       define contactgroup{
               contactgroup_name       linux-admins
               alias                   Linux Administrators
               members                 johns
               }
cp  contacts.cfg contacts.cfg.orig
vi contacts.cfg
    # 'johns' contact definition
    define contact{
        contact_name                   johns
        alias                          Nagios Admin
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,u,r
        service_notification_commands   notify-by-email
        host_notification_commands           
host-notify-by-email,host-notify-by-epager
        email          joe at shmo.com
        pager          pagenagios-admin at localhost
               }

# Allow Nagios to see it's onw process info
cp /usr/share/doc/nagios-common/check_nagios_db /etc/nagios/check_nagios_db
chmod +x /etc/nagios/check_nagios_db

# Configure nagios to use mysql for status info
vi cgi.cfg
  Comment out:
  #nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/log/nagios/status.log 5 'nagios'

  Uncomment:
  nagios_check_command=/etc/nagios/check_nagios_db

# Restart the daemon
/etc/init.d/nagios restart



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list