Nagios for using SNMP agent

Hi,

I have installed Nagios for using an SNMP agent. I read the posts or threads at the following URL http://www.xfiles.dk/guide-on-how-to-install-nagios-on-freebsd/.

Code:
/usr/bin/install -c -o root -g wheel -m 644  sample-config/template-object/switch.cfg /usr/ports/net-mgmt/nagios/work/stage/usr/local/etc/nagios/objects/switch.cfg-sample

*** Config files installed ***

Remember, these are *SAMPLE* config files.  You'll need to read
the documentation for more information on how to actually define
services, hosts, etc. to fit your particular needs.

====> Compressing man pages (compress-man)
===> Staging rc.d startup script(s)
===>  Installing for nagios-3.5.1_5
===>  Checking if net-mgmt/nagios already installed
===>   Registering installation for nagios-3.5.1_5
===> Creating users and/or groups.
Creating group 'nagios' with gid '181'.
Creating user 'nagios' with uid '181'.
Installing nagios-3.5.1_5... done
**********************************************************************

 Enable Nagios in /etc/rc.conf with the following line:

   nagios_enable="YES"

 Configuration templates are available in /usr/local/etc/nagios as
 *.cfg-sample files.  Copy them to *.cfg files where required and
 edit to suit your needs.  Documentation is available in HTML form
 in /usr/local/www/nagios/docs.

 If you don't already have a web server running, you will need to
 install and configure one to finish off your Nagios installation.
 When used with Apache, the following should be sufficient to publish
 the web component of Nagios (modify the allow list to suit):

   <Directory /usr/local/www/nagios>
     Order deny,allow
     Deny from all
     Allow from 127.0.0.1
     php_flag engine on
     php_admin_value open_basedir /usr/local/www/nagios/:/var/spool/nagios/
   </Directory>

   <Directory /usr/local/www/nagios/cgi-bin>
     Options ExecCGI
   </Directory>

   ScriptAlias /nagios/cgi-bin/ /usr/local/www/nagios/cgi-bin/
   Alias /nagios/ /usr/local/www/nagios/

**********************************************************************

===>  Cleaning for nagios-plugins-2.0.1,1
===>  Cleaning for php5-5.4.27_1
===>  Cleaning for libtool-2.4.2_2
===>  Cleaning for libdbi-0.9.0_1
===>  Cleaning for mysql56-client-5.6.17_1
===>  Cleaning for nagios-3.5.1_5
root@dct-raptor:/usr/ports/net-mgmt/nagios # nagios

Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL

Website: http://www.nagios.org
Usage: nagios [options] <main_config_file>

Options:

  -v, --verify-config          Verify all configuration data
  -s, --test-scheduling        Shows projected/recommended check scheduling and other
                               diagnostic info based on the current configuration files.
  -x, --dont-verify-paths      Don't check for circular object paths - USE WITH CAUTION!
  -p, --precache-objects       Precache object configuration - use with -v or -s options
  -u, --use-precached-objects  Use precached object config file
  -d, --daemon                 Starts Nagios in daemon mode, instead of as a foreground process

Visit the Nagios website at http://www.nagios.org/ for bug fixes, new
releases, online documentation, FAQs, information on subscribing to
the mailing lists, and commercial support options for Nagios.

root@dct-raptor:/usr/ports/net-mgmt/nagios # nano /etc/rc.conf

  GNU nano 2.2.6             File: /etc/rc.conf                                 

hostname="dct-raptor"
keymap="fr.iso.acc.kbd"
ifconfig_bge1="DHCP"
ifconfig_bge1_ipv6="inet6 accept_rtadv"
sshd_enable="YES"
moused_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
gdm_enable="YES"
gnome_enable="YES"
halt_enable="YES"
dbus_enable="YES"
vboxnet_enable="YES"
devfs_system_ruleset="system"
apache22_enable="YES"
nagios_enable="YES"
nrpe2_enable="YES"

                               [ Wrote 18 lines ]

root@dct-raptor:/usr/ports/net-mgmt/nagios # cd /usr/local/etc/nagios/
root@dct-raptor:/usr/local/etc/nagios # cd /usr/local/etc/nagios/
root@dct-raptor:/usr/local/etc/nagios # cp nagios.cfg-sample nagios.cfg
root@dct-raptor:/usr/local/etc/nagios # cp resource.cfg-sample resource.cfg
root@dct-raptor:/usr/local/etc/nagios # mkdir -p /usr/local/etc/nagios/sample
root@dct-raptor:/usr/local/etc/nagios # mv /usr/local/etc/nagios/*-sample /usr/local/etc/nagios/sample
root@dct-raptor:/usr/local/etc/nagios # cd /usr/local/etc/nagios/objects
root@dct-raptor:/usr/local/etc/nagios/objects # cp commands.cfg-sample commands.cfg
root@dct-raptor:/usr/local/etc/nagios/objects # cp contacts.cfg-sample contacts.cfg
root@dct-raptor:/usr/local/etc/nagios/objects # touch localhost.cfg
root@dct-raptor:/usr/local/etc/nagios/objects # cp printer.cfg-sample printer.cfg
root@dct-raptor:/usr/local/etc/nagios/objects # cp switch.cfg-sample switch.cfg
root@dct-raptor:/usr/local/etc/nagios/objects # cp templates.cfg-sample templates.cfg
root@dct-raptor:/usr/local/etc/nagios/objects # cp timeperiods.cfg-sample timeperiods.cfg
root@dct-raptor:/usr/local/etc/nagios/objects # 
root@dct-raptor:/usr/local/etc/nagios/objects # mkdir -p /usr/local/etc/nagios/objects/sample
root@dct-raptor:/usr/local/etc/nagios/objects # mv /usr/local/etc/nagios/objects/*-sample /usr/local/etc/nagios/objects/sample
root@dct-raptor:/usr/local/etc/nagios/objects # 
root@dct-raptor:/usr/local/etc/nagios/objects # cp /usr/local/etc/nrpe.cfg-sample /usr/local/etc/nrpe.cfg
cp: /usr/local/etc/nrpe.cfg-sample: No such file or directory
root@dct-raptor:/usr/local/etc/nagios/objects # chmod 440 /usr/local/etc/nrpe.cfg 
chmod: /usr/local/etc/nrpe.cfg: No such file or directory
root@dct-raptor:/usr/local/etc/nagios/objects # nagios -v /usr/local/etc/nagios/nagios.cfg 

Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config file '/usr/local/etc/nagios/objects/commands.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/contacts.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/templates.cfg'...
Processing object config file '/usr/local/etc/nagios/objects/localhost.cfg'...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Error: There are no services defined!
	Checked 0 services.
Checking hosts...
Error: There are no hosts defined!
	Checked 0 hosts.
Checking host groups...
	Checked 0 host groups.
Checking service groups...
	Checked 0 service groups.
Checking contacts...
	Checked 1 contacts.
Checking contact groups...
	Checked 1 contact groups.
Checking service escalations...
	Checked 0 service escalations.
Checking service dependencies...
	Checked 0 service dependencies.
Checking host escalations...
	Checked 0 host escalations.
Checking host dependencies...
	Checked 0 host dependencies.
Checking commands...
	Checked 24 commands.
Checking time periods...
	Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   2

***> One or more problems was encountered while running the pre-flight check...

     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.

root@dct-raptor:/usr/local/etc/nagios/objects #

Nagios didn't start. It is the first time I use Nagios on freeBSD ! FreeBSD.

Regards,

Philippe
 
philo_neo said:
Code:
Running pre-flight check on configuration data...

Checking services...
Error: There are no services defined!
	Checked 0 services.
Checking hosts...
Error: There are no hosts defined!
	Checked 0 hosts.
If there are no services and no hosts defined Nagios has nothing to do and won't start.
 
Back
Top