Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Have just installed nagios3 onto Ubuntu Server 10.04. A clean install. All plugins installed.

The nagios status map only has localhost and gateway discovered. Is there a way for it to scan our network, along with all Windows servers, routers, etc?

I can't find any automated way to do this.

Our network is a large school network so manual configuration is difficult.

share|improve this question
    
Have you followed the Ubuntu documentation article help.ubuntu.com/10.04/serverguide/C/nagios.html ? –  Allan Mar 2 '12 at 19:53
    
What kind of map are you trying to do ? For what objective ? Why nagios ? You'll just have an incomplete strategic map that will show you a lot of errors because this computer lab is down or not because the teacher uses it or not .... Giving Nagios this knowledge is also administering the alerts made by all those machines that you are monitoring (for what nagios is made). –  Antoine Rodriguez Mar 5 '12 at 20:39

3 Answers 3

Have you tried check_find_new_hosts plugin ? You can find how it works in the attached readme here.

usage:
check_find_new_hosts [-v+] [-x] [-s] /dir ip netmask contact

where:
dir is the directory containing the .cfg files (and .skip files if you want to skip certain hosts)
ip is an ip in the range you want to scan
netmask is an integer standing for the netmask eg:24 = 255.255.255.0
contact is the contact group you want new hosts found to answer to.

example:
./check_find_new_hosts -v /etc/nagios/network 192.168.10.129 25 domain-admins


when troubleshooting how this is working use -vv or -vvv from a command line
for more information consult the very very verbose help (may want to | less on a small screen):
./check_find_new_hosts -vvvh

----------------------------------------------------------------------------------------------------------------------------------------
check_find_new_hosts requires the following (that I know of):

1)  fping is installed at /usr/sbin/fping
2)  traceroute is installed at /usr/sbin/traceroute
3)  Nagios must parse a directory of cfg files, rather than implicitly listing the files eg:

    cfg_dir=/etc/nagios/hosts_hostgroups_and_services
    rather than:
    #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
    ...
4)  the service generic_service must be defined (the following is what I use):

define service{
    name                generic-service ; The 'name' of this service template, referenced in other service definitions
    active_checks_enabled       1   ; Active service checks are enabled
    passive_checks_enabled      1   ; Passive service checks are enabled/accepted
    parallelize_check       1   ; Active service checks should be parallelized (disabling this can lead to major performance problems)
    obsess_over_service     1   ; We should obsess over this service (if necessary)
    check_freshness         0   ; Default is to NOT check service 'freshness'
    notifications_enabled       1   ; Service notifications are enabled
    event_handler_enabled       1   ; Service event handler is enabled
    flap_detection_enabled      1   ; Flap detection is enabled
    process_perf_data       1   ; Process performance data
    retain_status_information   1   ; Retain status information across program restarts
    retain_nonstatus_information    1   ; Retain non-status information across program restarts

    register            0   ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
    }

5)  the 24x7 time period should be defined

define timeperiod{
    timeperiod_name 24x7
    alias       24 Hours A Day, 7 Days A Week
    sunday      00:00-24:00
    monday      00:00-24:00
    tuesday     00:00-24:00
    wednesday   00:00-24:00
    thursday    00:00-24:00
    friday      00:00-24:00
    saturday    00:00-24:00
    }

6) a contact group is defined
7) the network that is being looked at can be pinged

----------------------------------------------------------------------------------------------------------------------------------------

This check would be installed as multiple commands(one for every subnet) and can then be added as a check to whatever host makes the most sense to have it on(I have it as a check on the Nagios host machine)

For example, if you wanted to check the network 192.168.0.x (let's say your servers) and all you host and service definitions (at least all of them for this subnet) are in the directory /etc/nagios/network and the contact group you are using is "admins" you would need the following:

define command{
    command_name    check_find_new_hosts_servers
    command_line    /usr/lib/nagios/plugins/contrib/check_find_new_hosts -v /etc/nagios/network 192.168.0.0 24 admins
    }

if you also wanted to check 192.168.10.[129-255] (how about these are your domain controllers) with the contact group "domain-admins":

define command{
    command_name    check_find_new_hosts_domain
    command_line    /usr/lib/nagios/plugins/contrib/check_find_new_hosts -v /etc/nagios/network 192.168.10.129 25 domain-admins
    }


You would also need services defined to check these:

define service{
    use         generic-service
    host_name       main-server-router
    service_description FIND_NEW_HOSTS
    is_volatile     0
    check_period        24x7
    max_check_attempts  3
    normal_check_interval   5
    retry_check_interval    1
    contact_groups      admins
    notification_interval   120
    notification_period 24x7
    notification_options    c,r
    check_command       check_find_new_hosts_servers
    }

define service{
    use         generic-service
    host_name       main-domain-controller
    service_description FIND_NEW_HOSTS
    is_volatile     0
    check_period        24x7
    max_check_attempts  3
    normal_check_interval   5
    retry_check_interval    1
    contact_groups      domain-admins
    notification_interval   120
    notification_period 24x7
    notification_options    c,r
    check_command       check_find_new_hosts_domain
    }

----------------------------------------------------------------------------------------------------------------------------------------
once run it may generate the following files (so either run it and generate these files or steer away from them):
x.y.cfg where x.y is from the ip address of the host found: 192.168.15.32 would be put in 15.32.cfg
name.cfg where name is from the fdqn: freddy.mybuddy.com would be put in freddy.cfg
nagios_hostgroup_unknown.cfg (expects this file either to not exist or to contain 1 hostgroup):

define hostgroup {
    hostgroup_name      undefined
    alias           Non-Configured
    members         freddy,betsy,bob,...
    }


use "--nowrite --stdout" ( -xs ) as a command line option to write these to stdout instead of to files if you just want to test it or
use -vvx to show what it is doing but don't write any files and don't show the files on stdout
share|improve this answer
    
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  jrg Mar 7 '12 at 18:46
    
added the readme. –  Lucas Kauffman Mar 7 '12 at 18:51

No, if you need auto-discovery you should try Zenoss.

source: http://community.zenoss.org/docs/DOC-5858

Nagios does not have auto-discovery.

share|improve this answer
    
Interesting, I keep seeing various Nagios plugins that claim to do it, but nothing on how to use them. –  jrg Mar 2 '12 at 19:44

It's a little out of subject ..... if it's auto discovery and/or creating an action after discovering it this will be more suited than nagios :

http://www.zabbix.com/features.php

Instead of filling nagios with plugins that will or will not work : why not use something that has it in it's core ?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.