How to monitor system with VPN connect to another network?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Martco
Posts: 17
Joined: Fri Apr 25, 2014 1:55 pm

How to monitor system with VPN connect to another network?

Post by Martco »

We have a Windows 7 system that monitors a security system at a customer site. It need to stay connected to that site at all times via VPN, we want to know when the VPN connection goes down. So I figured since I cannot ping it while it's connected via VPN, I could try to setup Nagios to notify me when we ARE able to ping it, since that would mean the VPN. I put the following in my windows.cfg file, but either that's not where it goes or my syntax is all wrong.

define servicedependency{
host_name WindowsTest
service_description WinBackOnlineTest
dependent_host_name WindoowsTest
dependent_service_description WinBackOnlineTest2
execution_failure_criteria n
notification_failure_criteria o
}

I am new to Nagios Core (v4) and it's been a while since I've been in linux command line, so please bear with me. Any help would be greatly appreciated. Also, is there documentation that explains where certain settings , like "define service{" go in to which *.cfg file? Thanks in advance.

-Adam
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: How to monitor system with VPN connect to another networ

Post by sreinhardt »

Well the service dependency is not what you are looking for if you need a new ping service for that host. Do you already have a host configuration and if so what check command are you using there? It really sounds like you can do a host with no services since you just want to ping it.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Martco
Posts: 17
Joined: Fri Apr 25, 2014 1:55 pm

Re: How to monitor system with VPN connect to another networ

Post by Martco »

OK, I just put the define host{ for the test machine in the windows.cfg file, there is also another define host{ entry for a web server. It still shows all the services for the test machine on the webpage eventhough I only have define service{ entries for the web server.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: How to monitor system with VPN connect to another networ

Post by sreinhardt »

Could you provide the definitions we are talking about. It's nearly impossible to diagnose this without such information.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Martco
Posts: 17
Joined: Fri Apr 25, 2014 1:55 pm

Re: How to monitor system with VPN connect to another networ

Post by Martco »

Code: Select all

###############################################################################
# WINDOWS.CFG - CONFIG FILE FOR MONITORING A WINDOWS MACHINE
###############################################################################

###############################################################################
# HOST DEFINITIONS
###############################################################################

# Define a host for the Windows machine we'll be monitoring
# Change the host_name, alias, and address to fit your situation

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       web        ; The name we're giving to this host
        alias           web        ; A longer name associated with the host
        address         192.168.1.26    ; IP address of the host
        }

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       WindowsTest     ; The name we're giving to this host
        alias           WindowsTest     ; A longer name associated with the host
        address         192.168.1.19    ; IP address of the host
        }

###############################################################################
# HOST GROUP DEFINITIONS
###############################################################################

# Define a hostgroup for Windows machines
# All hosts that use the windows-server template will automatically be a member
of this group

define hostgroup{
        hostgroup_name  windows-workstations    ; The name of the hostgroup
        alias           Windows Workstations    ; Long name of the group
        members         web
        }

###############################################################################
# SERVICE DEFINITIONS
###############################################################################

# Create a service for monitoring the version of NSCLient++ that is installed
# Change the host_name to match the name of the host you defined above
define service{
        use                     generic-service
        hostgroup_name          windows-workstations
        service_description     NSClient++ v0.4.1.90
        check_command           check_nt!CLIENTVERSION
        }

# PING host
define service{
        use                     generic-service
        hostgroup_name          windows-workstations
        service_description     PING
        check_command           check_ping!200.0,20%!600.0,60%
        normal_check_interval   5
        retry_check_interval    1
        }

# Create a service for monitoring the uptime of the server
# Change the host_name to match the name of the host you defined above
define service{
        use                     generic-service
        hostgroup_name          windows-workstations
        service_description     Uptime
        check_command           check_nt!UPTIME
        }

# Create a service for monitoring CPU load
# Change the host_name to match the name of the host you defined above
define service{
        use                     generic-service
        hostgroup_name          windows-workstations
        service_description     CPU Load
        check_command           check_nt!CPULOAD!-l 5,80,90
        }

# Create a service for monitoring memory usage
# Change the host_name to match the name of the host you defined above
define service{
        use                     generic-service
        hostgroup_name          windows-workstations
        service_description     Memory Usage
        check_command           check_nt!MEMUSE!-w 80 -c 90
        }

# Create a service for monitoring C:\ disk usage
# Change the host_name to match the name of the host you defined above
define service{
        use                     generic-service
        hostgroup_name          windows-workstations
        service_description     C:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        }

# Create a service for monitoring the W3SVC service
# Change the host_name to match the name of the host you defined above
#define service{
#       use                     generic-service
#       hostgroup_name          windows-workstations
#       service_description     W3SVC
#       check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
#       }

# Create a service for monitoring the Explorer.exe process
# Change the host_name to match the name of the host you defined above
define service{
        use                     generic-service
        hostgroup_name          windows-workstations
        service_description     Explorer
        check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
        }
Martco
Posts: 17
Joined: Fri Apr 25, 2014 1:55 pm

Re: How to monitor system with VPN connect to another networ

Post by Martco »

So now, instead of just wondering how to monitor WindowsTest for only successful pings, not failed, and notify me, I'm now wondering why I'm still getting the services list for it when I dont have any service for it in the .cfg file?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: How to monitor system with VPN connect to another networ

Post by slansing »

What services specifically? It looks like it's probably pulling them in via the hostgroup.
Martco
Posts: 17
Joined: Fri Apr 25, 2014 1:55 pm

Re: How to monitor system with VPN connect to another networ

Post by Martco »

C: space
CPU load
Mem usage
PING
Uptime
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: How to monitor system with VPN connect to another networ

Post by slansing »

By the config files above, "192.168.1.26" is currently being checked for what looks like all of those noted services. So it sounds like what you are experiencing is expected because of how you have the hostgroup tied to those services.
Martco
Posts: 17
Joined: Fri Apr 25, 2014 1:55 pm

Re: How to monitor system with VPN connect to another networ

Post by Martco »

But I'm getting the services listed for 192.168.1.19 also and it's not in the hostgroup definition.
Locked