parent
760d4648de
commit
878b8b6584
@ -0,0 +1,3 @@
|
|||||||
|
import os, sys
|
||||||
|
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
from nagparse import NagParse
|
Binary file not shown.
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import sys
|
||||||
|
from nagparse import NagParse
|
||||||
|
parser = NagParse(sys.argv[1:])
|
||||||
|
print(parser)
|
@ -0,0 +1,119 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import re
|
||||||
|
from enum import Enum, auto
|
||||||
|
from object import Object, ObjectType
|
||||||
|
class ParserState(Enum):
|
||||||
|
DEFINE = auto()
|
||||||
|
DIRECTIVE = auto()
|
||||||
|
MULTILINE = auto()
|
||||||
|
|
||||||
|
|
||||||
|
class NagParse:
|
||||||
|
def __init__(self, config_files: list[str]):
|
||||||
|
self.m_config_files: list[str] = config_files
|
||||||
|
self.m_commands: list[Object] = list()
|
||||||
|
self.m_contacts: list[Object] = list()
|
||||||
|
self.m_contactgroups: list[Object] = list()
|
||||||
|
self.m_hosts: list[Object] = list()
|
||||||
|
self.m_hostdependencies: list[Object] = list()
|
||||||
|
self.m_hostescalations: list[Object] = list()
|
||||||
|
self.m_hostgroups: list[Object] = list()
|
||||||
|
self.m_services: list[Object] = list()
|
||||||
|
self.m_servicedependencies: list[Object] = list()
|
||||||
|
self.m_serviceescalations: list[Object] = list()
|
||||||
|
self.m_servicegroups: list[Object] = list()
|
||||||
|
self.m_timeperiods: list[Object] = list()
|
||||||
|
for config_file in self.m_config_files:
|
||||||
|
for object in self.parse_config(config_file):
|
||||||
|
match object.m_type:
|
||||||
|
case ObjectType.Command:
|
||||||
|
self.m_commands.append(object)
|
||||||
|
case ObjectType.Contact:
|
||||||
|
self.m_contacts.append(object)
|
||||||
|
case ObjectType.ContactGroup:
|
||||||
|
self.m_contactgroups.append(object)
|
||||||
|
case ObjectType.Host:
|
||||||
|
self.m_hosts.append(object)
|
||||||
|
case ObjectType.HostDependency:
|
||||||
|
self.m_hostdependencies.append(object)
|
||||||
|
case ObjectType.HostEscalation:
|
||||||
|
self.m_hostescalations.append(object)
|
||||||
|
case ObjectType.HostGroup:
|
||||||
|
self.m_hostgroups.append(object)
|
||||||
|
case ObjectType.Service:
|
||||||
|
self.m_services.append(object)
|
||||||
|
case ObjectType.ServiceDependency:
|
||||||
|
self.m_servicedependencies.append(object)
|
||||||
|
case ObjectType.ServiceEscalation:
|
||||||
|
self.m_serviceescalations.append(object)
|
||||||
|
case ObjectType.ServiceGroup:
|
||||||
|
self.m_servicegroups.append(object)
|
||||||
|
case ObjectType.TimePeriod:
|
||||||
|
self.m_timeperiods.append(object)
|
||||||
|
def __str__(self):
|
||||||
|
string = str()
|
||||||
|
for fragment in self.m_commands:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_contacts:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_contactgroups:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_hosts:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_hostdependencies:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_hostescalations:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_hostgroups:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_services:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_servicedependencies:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_serviceescalations:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_servicegroups:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
for fragment in self.m_timeperiods:
|
||||||
|
string += str(fragment) + "\n"
|
||||||
|
return string
|
||||||
|
|
||||||
|
def parse_config(self,config_file: str) -> list[Object]:
|
||||||
|
state = ParserState.DEFINE
|
||||||
|
objects: list[Object] = list()
|
||||||
|
with open(config_file, 'r') as file_handle:
|
||||||
|
line_no = 0
|
||||||
|
cur_object = Object(config_file=config_file)
|
||||||
|
for rawline in file_handle.readlines():
|
||||||
|
|
||||||
|
line = re.sub(r'([a-z]){', r'\1 {',rawline.strip())
|
||||||
|
line_no += 1
|
||||||
|
if len(line) == 0 or re.match('^#', line):
|
||||||
|
continue
|
||||||
|
if re.match(r'}', line):
|
||||||
|
objects.append(cur_object)
|
||||||
|
cur_object = Object()
|
||||||
|
state = ParserState.DEFINE
|
||||||
|
continue
|
||||||
|
|
||||||
|
fragments: list[str] = re.sub(' +', ' ', line.strip()).split()
|
||||||
|
if state == ParserState.DEFINE:
|
||||||
|
if fragments[0] == 'define':
|
||||||
|
cur_object.m_line_no = line_no
|
||||||
|
cur_object.m_type = ObjectType(fragments[1])
|
||||||
|
state = ParserState.DIRECTIVE
|
||||||
|
elif state == ParserState.MULTILINE:
|
||||||
|
cur_object.m_directive[-1:][1] = cur_object.m_directives[-1:][1] + ' ' + " ".join(fragments)
|
||||||
|
if fragments[-1:][-1:] != '\\':
|
||||||
|
state = ParserState.DIRECTIVE
|
||||||
|
else:
|
||||||
|
fragments[-1:][-1:] = ''
|
||||||
|
# This is ParserState.DIRECTIVE
|
||||||
|
else:
|
||||||
|
if fragments[-1:][-1:] == '\\':
|
||||||
|
fragments[-1:][-1:] = ''
|
||||||
|
state = ParserState.MULTILINE
|
||||||
|
if re.match('^[a-z]+', fragments[0]):
|
||||||
|
cur_object.m_directives.append(
|
||||||
|
(fragments[0], " ".join(fragments[1:])))
|
||||||
|
return objects
|
@ -1,29 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import command
|
|
||||||
import contact
|
|
||||||
import contactgroup
|
|
||||||
import host
|
|
||||||
import hostdependency
|
|
||||||
import hostescalation
|
|
||||||
import hostgroup
|
|
||||||
import service
|
|
||||||
import servicedependency
|
|
||||||
import serviceescalation
|
|
||||||
import servicegroup
|
|
||||||
import timeperiod
|
|
||||||
|
|
||||||
|
|
||||||
class NagParse():
|
|
||||||
def __init__(self):
|
|
||||||
self.m_commands: list[Command] = list()
|
|
||||||
self.m_contacts: list[Contact] = list()
|
|
||||||
self.m_contactgroups: list[ContactGroup] = list()
|
|
||||||
self.m_hosts: list[Host] = list()
|
|
||||||
self.m_hostdependencies[HostDependency]: list = list()
|
|
||||||
self.m_hostescalations[HostEscalation]: list = list()
|
|
||||||
self.m_hostgroups[HostGroup]: list = list()
|
|
||||||
self.m_services[Service]: list = list()
|
|
||||||
self.m_servicedependencies[ServiceDependency]: list = list()
|
|
||||||
self.m_serviceescalations[ServiceEscalation]: list = list()
|
|
||||||
self.m_servicegroups[ServiceGroup]: list = list()
|
|
||||||
self.m_timeperiods[Timeperiod]: list = list()
|
|
@ -1,3 +0,0 @@
|
|||||||
class Command:
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,3 +0,0 @@
|
|||||||
class Contact():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
class ContactGroup():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,3 +0,0 @@
|
|||||||
class Host():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,3 +0,0 @@
|
|||||||
class HostDependency():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,3 +0,0 @@
|
|||||||
class HostEscalation():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,3 +0,0 @@
|
|||||||
class HostGroup():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,3 +0,0 @@
|
|||||||
class Service():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,3 +0,0 @@
|
|||||||
class ServiceDependency():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,3 +0,0 @@
|
|||||||
class ServiceEscalation():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,3 +0,0 @@
|
|||||||
class ServiceGroup():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -1,3 +0,0 @@
|
|||||||
class Timeperiod():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
@ -0,0 +1 @@
|
|||||||
|
from .object import Object, ObjectType
|
@ -0,0 +1,42 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class ObjectType(Enum):
|
||||||
|
Command = "command"
|
||||||
|
ContactGroup = "contactgroup"
|
||||||
|
Contact = "contact"
|
||||||
|
HostDependency = "hostdependency"
|
||||||
|
HostEscalation = "hostescalation"
|
||||||
|
HostGroup = "hostgroup"
|
||||||
|
Host = "host"
|
||||||
|
ServiceDependency = "servicedependency"
|
||||||
|
ServiceEscalation = "serviceescalation"
|
||||||
|
ServiceGroup = "servicegroup"
|
||||||
|
Service = "service"
|
||||||
|
TimePeriod = "timeperiod"
|
||||||
|
Nil = "nil"
|
||||||
|
|
||||||
|
|
||||||
|
class Object:
|
||||||
|
def __init__(self,
|
||||||
|
config_file: str = str(),
|
||||||
|
directives: list[tuple[str, str]] = list(),
|
||||||
|
line_no: int = 0,
|
||||||
|
type: ObjectType = ObjectType.Nil):
|
||||||
|
self.m_config_file: str = config_file
|
||||||
|
self.m_directives: list[tuple[str, str]] = directives
|
||||||
|
self.m_line_no: int = line_no
|
||||||
|
self.m_type: ObjectType = type
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
string = "{}:\n\t{}: {}\n".format(self.m_config_file, self.m_line_no,
|
||||||
|
self.m_type)
|
||||||
|
for dir in self.m_directives:
|
||||||
|
string += "\t\t{}: {}\n".format(dir[0], dir[1])
|
||||||
|
return string
|
||||||
|
|
||||||
|
def get_type(self) -> ObjectType:
|
||||||
|
return self.m_type
|
||||||
|
|
||||||
|
def get_directives(self) -> list[tuple[str, str]]:
|
||||||
|
return self.m_directives
|
@ -0,0 +1,204 @@
|
|||||||
|
###############################################################################
|
||||||
|
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAEMON 1.3.0
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# NOTES: This config file provides you with some example command definitions
|
||||||
|
# that you can reference in host, service, and contact definitions.
|
||||||
|
#
|
||||||
|
# You don't need to keep commands in a separate file from your other
|
||||||
|
# object definitions. This has been done just to make things easier to
|
||||||
|
# understand.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# SAMPLE NOTIFICATION COMMANDS
|
||||||
|
#
|
||||||
|
# These are some example notification commands. They may or may not work on
|
||||||
|
# your system without modification. As an example, some systems will require
|
||||||
|
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
# 'notify-host-by-email' command definition
|
||||||
|
define command {
|
||||||
|
command_name notify-host-by-email
|
||||||
|
command_line /usr/bin/printf "%b" "***** Naemon *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" \
|
||||||
|
| /usr/bin/mail \
|
||||||
|
-s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
|
||||||
|
}
|
||||||
|
|
||||||
|
# 'notify-service-by-email' command definition
|
||||||
|
define command {
|
||||||
|
command_name notify-service-by-email
|
||||||
|
command_line /usr/bin/printf "%b" "***** Naemon *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" \
|
||||||
|
| /usr/bin/mail \
|
||||||
|
-s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# SAMPLE HOST CHECK COMMANDS
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
# This command checks to see if a host is "alive" by pinging it
|
||||||
|
# The check must result in a 100% packet loss or 5 second (5000ms) round trip
|
||||||
|
# average time to produce a critical error.
|
||||||
|
# Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)
|
||||||
|
# 'check-host-alive' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check-host-alive
|
||||||
|
# command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
|
||||||
|
#}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# SAMPLE SERVICE CHECK COMMANDS
|
||||||
|
#
|
||||||
|
# These are some example service check commands. They may or may not work on
|
||||||
|
# your system, as they must be modified for your plugins. See the HTML
|
||||||
|
# documentation on the plugins for examples of how to configure command definitions.
|
||||||
|
#
|
||||||
|
# NOTE: The following 'check_local_...' functions are designed to monitor
|
||||||
|
# various metrics on the host that Naemon is running on (i.e. this one).
|
||||||
|
################################################################################
|
||||||
|
# 'check_local_disk' command definition
|
||||||
|
define command {
|
||||||
|
command_name check_local_disk
|
||||||
|
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
|
||||||
|
}
|
||||||
|
|
||||||
|
# 'check_local_load' command definition
|
||||||
|
define command {
|
||||||
|
command_name check_local_load
|
||||||
|
command_line $USER1$/check_load -w $ARG1$ -c $ARG2$
|
||||||
|
}
|
||||||
|
|
||||||
|
# 'check_local_procs' command definition
|
||||||
|
define command {
|
||||||
|
command_name check_local_procs
|
||||||
|
command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
|
||||||
|
}
|
||||||
|
|
||||||
|
# 'check_local_users' command definition
|
||||||
|
define command {
|
||||||
|
command_name check_local_users
|
||||||
|
command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
|
||||||
|
}
|
||||||
|
|
||||||
|
# 'check_local_swap' command definition
|
||||||
|
define command {
|
||||||
|
command_name check_local_swap
|
||||||
|
command_line $USER1$/check_swap -w $ARG1$ -c $ARG2$
|
||||||
|
}
|
||||||
|
|
||||||
|
# 'check_local_mrtgtraf' command definition
|
||||||
|
define command {
|
||||||
|
command_name check_local_mrtgtraf
|
||||||
|
command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
|
||||||
|
}
|
||||||
|
#
|
||||||
|
#################################################################################
|
||||||
|
## NOTE: The following 'check_...' commands are used to monitor services on
|
||||||
|
## both local and remote hosts.
|
||||||
|
#################################################################################
|
||||||
|
## 'check_ftp' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_ftp
|
||||||
|
# command_line $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 'check_hpjd' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_hpjd
|
||||||
|
# command_line $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
# 'check_snmp' command definition
|
||||||
|
define command {
|
||||||
|
command_name check_snmp
|
||||||
|
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
|
||||||
|
}
|
||||||
|
#
|
||||||
|
## 'check_http' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_http
|
||||||
|
# command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 'check_ssh' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_ssh
|
||||||
|
# command_line $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 'check_dhcp' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_dhcp
|
||||||
|
# command_line $USER1$/check_dhcp $ARG1$
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 'check_ping' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_ping
|
||||||
|
# command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 'check_pop' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_pop
|
||||||
|
# command_line $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 'check_imap' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_imap
|
||||||
|
# command_line $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 'check_smtp' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_smtp
|
||||||
|
# command_line $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 'check_tcp' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_tcp
|
||||||
|
# command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 'check_udp' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_udp
|
||||||
|
# command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 'check_nt' command definition
|
||||||
|
#define command {
|
||||||
|
# command_name check_nt
|
||||||
|
# command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
|
||||||
|
#}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# SAMPLE PERFORMANCE DATA COMMANDS
|
||||||
|
#
|
||||||
|
# These are sample performance data commands that can be used to send performance
|
||||||
|
# data output to two text files (one for hosts, another for services). If you
|
||||||
|
# plan on simply writing performance data out to a file, consider using the
|
||||||
|
# host_perfdata_file and service_perfdata_file options in the main config file.
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
# 'process-host-perfdata' command definition
|
||||||
|
define command {
|
||||||
|
command_name process-host-perfdata
|
||||||
|
command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" \
|
||||||
|
>> /var/lib/naemon/host-perfdata.out
|
||||||
|
}
|
||||||
|
|
||||||
|
# 'process-service-perfdata' command definition
|
||||||
|
define command {
|
||||||
|
command_name process-service-perfdata
|
||||||
|
command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" \
|
||||||
|
>> /var/lib/naemon/service-perfdata.out
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
###############################################################################
|
||||||
|
# CONTACTS.CFG - SAMPLE CONTACT/CONTACTGROUP DEFINITIONS
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# NOTES: This config file provides you with some example contact and contact
|
||||||
|
# group definitions that you can reference in host and service
|
||||||
|
# definitions.
|
||||||
|
#
|
||||||
|
# You don't need to keep these definitions in a separate file from your
|
||||||
|
# other object definitions. This has been done just to make things
|
||||||
|
# easier to understand.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# CONTACTS
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
# Just one contact defined by default - the Naemon admin (that's you)
|
||||||
|
# This contact definition inherits a lot of default values from the 'generic-contact'
|
||||||
|
# template which is defined elsewhere.
|
||||||
|
define contact {
|
||||||
|
contact_name nagiosadmin ; Short name of user
|
||||||
|
alias Naemon Admin ; Full name of user
|
||||||
|
use generic-contact ; Inherit default values from generic-contact template (defined above)
|
||||||
|
email naemon@localhost ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# CONTACT GROUPS
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
# We only have one contact in this simple configuration file, so there is
|
||||||
|
# no need to create more than one contact group.
|
||||||
|
define contactgroup {
|
||||||
|
contactgroup_name admins
|
||||||
|
alias Naemon Administrators
|
||||||
|
members nagiosadmin
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
# Some generic hostgroup definitions
|
||||||
|
|
||||||
|
# A simple wildcard hostgroup
|
||||||
|
define hostgroup {
|
||||||
|
hostgroup_name all
|
||||||
|
alias All Servers
|
||||||
|
members *
|
||||||
|
}
|
||||||
|
|
||||||
|
# A list of your Ubuntu Linux servers
|
||||||
|
define hostgroup {
|
||||||
|
hostgroup_name ubuntu-servers
|
||||||
|
alias Ubuntu Linux Servers
|
||||||
|
members localhost
|
||||||
|
}
|
||||||
|
|
||||||
|
# A list of your web servers
|
||||||
|
define hostgroup {
|
||||||
|
hostgroup_name http-servers
|
||||||
|
alias HTTP servers
|
||||||
|
members localhost
|
||||||
|
}
|
||||||
|
|
||||||
|
# A list of your ssh-accessible servers
|
||||||
|
define hostgroup {
|
||||||
|
hostgroup_name ssh-servers
|
||||||
|
alias SSH servers
|
||||||
|
members localhost
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
###############################################################################
|
||||||
|
# LOCALHOST.CFG - SAMPLE OBJECT CONFIG FILE FOR MONITORING THIS MACHINE
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# NOTE: This config file is intended to serve as an *extremely* simple
|
||||||
|
# example of how you can create configuration entries to monitor
|
||||||
|
# the local (Linux) machine.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# HOST DEFINITION
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
# Define a host for the local machine
|
||||||
|
# This host definition will inherit all variables that are defined
|
||||||
|
# in (or inherited by) the linux-server host template definition.
|
||||||
|
#define host {
|
||||||
|
# host_name localhost
|
||||||
|
# alias localhost
|
||||||
|
# address 127.0.0.1
|
||||||
|
# use linux-server ; Name of host template to use
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## HOST GROUP DEFINITION
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
################################################################################
|
||||||
|
## Define an optional hostgroup for Linux machines
|
||||||
|
define hostgroup {
|
||||||
|
hostgroup_name linux-servers ; The name of the hostgroup
|
||||||
|
alias Linux Servers ; Long name of the group
|
||||||
|
# members localhost ; Comma separated list of hosts that belong to this group
|
||||||
|
}
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## SERVICE DEFINITIONS
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
################################################################################
|
||||||
|
## Define a service to "ping" the local machine
|
||||||
|
#define service {
|
||||||
|
# service_description PING
|
||||||
|
# host_name localhost
|
||||||
|
# use local-service ; Name of service template to use
|
||||||
|
# check_command check_ping!100.0,20%!500.0,60%
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Define a service to check the disk space of the root partition
|
||||||
|
## on the local machine. Warning if < 20% free, critical if
|
||||||
|
## < 10% free space on partition.
|
||||||
|
#define service {
|
||||||
|
# service_description Root Partition
|
||||||
|
# host_name localhost
|
||||||
|
# use local-service ; Name of service template to use
|
||||||
|
# check_command check_local_disk!20%!10%!/
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Define a service to check the number of currently logged in
|
||||||
|
## users on the local machine. Warning if > 20 users, critical
|
||||||
|
## if > 50 users.
|
||||||
|
#define service {
|
||||||
|
# service_description Current Users
|
||||||
|
# host_name localhost
|
||||||
|
# use local-service ; Name of service template to use
|
||||||
|
# check_command check_local_users!20!50
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Define a service to check the number of currently running procs
|
||||||
|
## on the local machine. Warning if > 250 processes, critical if
|
||||||
|
## > 400 users.
|
||||||
|
#define service {
|
||||||
|
# service_description Total Processes
|
||||||
|
# host_name localhost
|
||||||
|
# use local-service ; Name of service template to use
|
||||||
|
# check_command check_local_procs!250!400!RSZDT
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Define a service to check the load on the local machine.
|
||||||
|
#define service {
|
||||||
|
# service_description Current Load
|
||||||
|
# host_name localhost
|
||||||
|
# use local-service ; Name of service template to use
|
||||||
|
# check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Define a service to check the swap usage the local machine.
|
||||||
|
## Critical if less than 10% of swap is free, warning if less than 20% is free
|
||||||
|
#define service {
|
||||||
|
# service_description Swap Usage
|
||||||
|
# host_name localhost
|
||||||
|
# use local-service ; Name of service template to use
|
||||||
|
# check_command check_local_swap!20!10
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Define a service to check SSH on the local machine.
|
||||||
|
## Disable notifications for this service by default, as not all users may have SSH enabled.
|
||||||
|
#define service {
|
||||||
|
# service_description SSH
|
||||||
|
# host_name localhost
|
||||||
|
# use local-service ; Name of service template to use
|
||||||
|
# check_command check_ssh
|
||||||
|
# notifications_enabled 0
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Define a service to check HTTP on the local machine.
|
||||||
|
## Disable notifications for this service by default, as not all users may have HTTP enabled.
|
||||||
|
#define service {
|
||||||
|
# service_description HTTP
|
||||||
|
# host_name localhost
|
||||||
|
# use local-service ; Name of service template to use
|
||||||
|
# check_command check_http!-u /naemon/
|
||||||
|
# notifications_enabled 0
|
||||||
|
#}
|
||||||
|
#
|
@ -0,0 +1,18 @@
|
|||||||
|
# Generic host definition template - This is NOT a real host, just a template!
|
||||||
|
|
||||||
|
define host{
|
||||||
|
name monitor-host ; The name of this host template
|
||||||
|
notifications_enabled 1 ; Host notifications are enabled
|
||||||
|
event_handler_enabled 1 ; Host 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
|
||||||
|
check_command check-host-alive
|
||||||
|
max_check_attempts 10
|
||||||
|
notification_interval 0
|
||||||
|
notification_period 24x7
|
||||||
|
notification_options d,u,r
|
||||||
|
contact_groups admins
|
||||||
|
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
###############################################################################
|
||||||
|
# PRINTER.CFG - SAMPLE CONFIG FILE FOR MONITORING A NETWORK PRINTER
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# NOTES: This config file assumes that you are using the sample configuration
|
||||||
|
# files that get installed with the Naemon quickstart guide.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# HOST DEFINITIONS
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
# Define a host for the printer we'll be monitoring
|
||||||
|
# Change the host_name, alias, and address to fit your situation
|
||||||
|
#define host {
|
||||||
|
# host_name hplj2605dn ; The name we're giving to this printer
|
||||||
|
# alias HP LaserJet 2605dn ; A longer name associated with the printer
|
||||||
|
# address 192.168.1.30 ; IP address of the printer
|
||||||
|
# use generic-printer ; Inherit default values from a template
|
||||||
|
# hostgroups network-printers ; Host groups this printer is associated with
|
||||||
|
#}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# HOST GROUP DEFINITIONS
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
# A hostgroup for network printers
|
||||||
|
#define hostgroup {
|
||||||
|
# hostgroup_name network-printers ; The name of the hostgroup
|
||||||
|
# alias Network Printers ; Long name of the group
|
||||||
|
#}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# SERVICE DEFINITIONS
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
# Create a service for monitoring the status of the printer
|
||||||
|
# Change the host_name to match the name of the host you defined above
|
||||||
|
# If the printer has an SNMP community string other than "public", change the check_command directive to reflect that
|
||||||
|
#define service {
|
||||||
|
# service_description Printer Status ; The service description
|
||||||
|
# host_name hplj2605dn ; The name of the host the service is associated with
|
||||||
|
# use generic-service ; Inherit values from a template
|
||||||
|
# check_command check_hpjd!-C public ; The command used to monitor the service
|
||||||
|
# check_interval 10 ; Check the service every 10 minutes under normal conditions
|
||||||
|
# retry_interval 1 ; Re-check the service every minute until its final/hard state is determined
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Create a service for "pinging" the printer occassionally. Useful for monitoring RTA, packet loss, etc.
|
||||||
|
#define service {
|
||||||
|
# service_description PING
|
||||||
|
# host_name hplj2605dn
|
||||||
|
# use generic-service
|
||||||
|
# check_command check_ping!3000.0,80%!5000.0,100%
|
||||||
|
# check_interval 10
|
||||||
|
# retry_interval 1
|
||||||
|
#}
|
||||||
|
#
|
@ -0,0 +1,12 @@
|
|||||||
|
# Do not edit by hand - maintained by puppet
|
||||||
|
# obsessive_host_handler
|
||||||
|
define command {
|
||||||
|
command_name obsessive_host_handler
|
||||||
|
command_line /usr/share/icinga/plugins/eventhandlers/distributed-monitoring/send_nsca_host_or_service_check_result 'x.x.x.x' '/etc/send_nsca.cfg' '$HOSTNAME$' '$HOSTSTATE$' '$HOSTOUTPUT$\n$LONGHOSTOUTPUT$|$HOSTPERFDATA$'
|
||||||
|
}
|
||||||
|
|
||||||
|
# obsessive_service_handler
|
||||||
|
define command {
|
||||||
|
command_name obsessive_service_handler
|
||||||
|
command_line /usr/share/icinga/plugins/eventhandlers/distributed-monitoring/send_nsca_host_or_service_check_result 'x.x.x.x' '/etc/send_nsca.cfg' '$HOSTNAME$' '$SERVICEDESC$' '$SERVICESTATE$' '$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$|$SERVICEPERFDATA$'
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
# Do not edit by hand - maintained by puppet
|
||||||
|
# alerts
|
||||||
|
define contactgroup {
|
||||||
|
contactgroup_name alerts
|
||||||
|
alias alerts
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
# Do not edit by hand - maintained by puppet
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
|||||||
|
# Do not edit by hand - maintained by puppet
|
@ -0,0 +1,396 @@
|
|||||||
|
# Do not edit by hand - maintained by puppet
|
||||||
|
# check_apt
|
||||||
|
define service {
|
||||||
|
name check_apt
|
||||||
|
check_command check_nrpe_1arg!check_apt
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Packages available for upgrade
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_boot
|
||||||
|
define service {
|
||||||
|
name check_boot
|
||||||
|
check_command check_nrpe_1arg!check_boot_15_5
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Boot Disk
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_entropy
|
||||||
|
define service {
|
||||||
|
name check_entropy
|
||||||
|
check_command check_nrpe_1arg!check_entropy
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description System Entropy
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_exabgp_announce
|
||||||
|
define service {
|
||||||
|
name check_exabgp_announce
|
||||||
|
check_command check_nrpe_1arg!check_exabgp_announce
|
||||||
|
|
||||||
|
hostgroup_name sunetdrive::lb
|
||||||
|
service_description Status of exabgp routes
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_galera_cluster
|
||||||
|
define service {
|
||||||
|
name check_galera_cluster
|
||||||
|
check_command check_nrpe_1arg!check_galera_cluster
|
||||||
|
|
||||||
|
hostgroup_name galera_monitor
|
||||||
|
service_description Galera Cluster Health
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_load
|
||||||
|
define service {
|
||||||
|
name check_load
|
||||||
|
check_command check_nrpe_1arg!check_load
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description System Load
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_memory
|
||||||
|
define service {
|
||||||
|
name check_memory
|
||||||
|
check_command check_nrpe_1arg!check_memory
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description System Memory
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_mysql_server_status
|
||||||
|
define service {
|
||||||
|
name check_mysql_server_status
|
||||||
|
check_command check_nrpe_1arg!check_mysql_server_status
|
||||||
|
|
||||||
|
hostgroup_name sunetdrive::proxysql
|
||||||
|
service_description Status of mysql servers
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_needrestart
|
||||||
|
define service {
|
||||||
|
name check_needrestart
|
||||||
|
check_command check_nrpe_1arg!check_needrestart
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Processes need restart
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_ntp_time
|
||||||
|
define service {
|
||||||
|
name check_ntp_time
|
||||||
|
check_command check_nrpe_1arg!check_ntp_time
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description System NTP Time
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_process_haveged
|
||||||
|
define service {
|
||||||
|
name check_process_haveged
|
||||||
|
check_command check_nrpe_1arg!check_process_haveged
|
||||||
|
|
||||||
|
hostgroup_name entropyclient
|
||||||
|
service_description haveged running
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_proxysql_server
|
||||||
|
define service {
|
||||||
|
name check_proxysql_server
|
||||||
|
check_command check_nrpe_1arg!check_proxysql_server
|
||||||
|
|
||||||
|
hostgroup_name sunetdrive::proxysql
|
||||||
|
service_description Number of ProxySQL servers available
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_reboot
|
||||||
|
define service {
|
||||||
|
name check_reboot
|
||||||
|
check_command check_nrpe_1arg!check_reboot
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Reboot Needed
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_root
|
||||||
|
define service {
|
||||||
|
name check_root
|
||||||
|
check_command check_nrpe_1arg!check_root
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Root Disk
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_sarimner
|
||||||
|
define service {
|
||||||
|
name check_sarimner
|
||||||
|
check_command check_nrpe_1arg!check_sarimner
|
||||||
|
|
||||||
|
hostgroup_name sunetdrive::lb
|
||||||
|
service_description Status of sarimner interface
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_scriptherder
|
||||||
|
define service {
|
||||||
|
name check_scriptherder
|
||||||
|
check_command check_nrpe_1arg!check_scriptherder
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Scriptherder Status
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_total_procs
|
||||||
|
define service {
|
||||||
|
name check_total_procs
|
||||||
|
check_command check_nrpe_1arg!check_total_procs_lax
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Total Processes
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_uptime
|
||||||
|
define service {
|
||||||
|
name check_uptime
|
||||||
|
check_command check_nrpe_1arg!check_uptime
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Uptime
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_users
|
||||||
|
define service {
|
||||||
|
name check_users
|
||||||
|
check_command check_nrpe_1arg!check_users
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Active Users
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_var
|
||||||
|
define service {
|
||||||
|
name check_var
|
||||||
|
check_command check_nrpe_1arg!check_var
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Var Disk
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# check_zombie_procs
|
||||||
|
define service {
|
||||||
|
name check_zombie_procs
|
||||||
|
check_command check_nrpe_1arg!check_zombie_procs
|
||||||
|
|
||||||
|
hostgroup_name nrpe
|
||||||
|
service_description Zombie Processes
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# service_ping
|
||||||
|
define service {
|
||||||
|
name service_ping
|
||||||
|
check_command check_ping!400.0,1%!500.0,2%
|
||||||
|
|
||||||
|
hostgroup_name all
|
||||||
|
service_description PING
|
||||||
|
|
||||||
|
contact_groups alerts
|
||||||
|
|
||||||
|
max_check_attempts 4
|
||||||
|
check_interval 5
|
||||||
|
retry_interval 1
|
||||||
|
check_period 24x7
|
||||||
|
notification_period 24x7
|
||||||
|
register 1
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,77 @@
|
|||||||
|
###############################################################################
|
||||||
|
# SWITCH.CFG - SAMPLE CONFIG FILE FOR MONITORING A SWITCH
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# NOTES: This config file assumes that you are using the sample configuration
|
||||||
|
# files that get installed with the Naemon quickstart guide.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# HOST DEFINITIONS
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
# Define the switch that we'll be monitoring
|
||||||
|
#define host {
|
||||||
|
# host_name linksys-srw224p ; The name we're giving to this switch
|
||||||
|
# alias Linksys SRW224P Switch ; A longer name associated with the switch
|
||||||
|
# address 192.168.1.253 ; IP address of the switch
|
||||||
|
# use generic-switch ; Inherit default values from a template
|
||||||
|
# hostgroups switches ; Host groups this switch is associated with
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## HOST GROUP DEFINITIONS
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
################################################################################
|
||||||
|
## Create a new hostgroup for switches
|
||||||
|
#define hostgroup {
|
||||||
|
# hostgroup_name switches ; The name of the hostgroup
|
||||||
|
# alias Network Switches ; Long name of the group
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## SERVICE DEFINITIONS
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
################################################################################
|
||||||
|
## Create a service to PING to switch
|
||||||
|
#define service {
|
||||||
|
# service_description PING ; The service description
|
||||||
|
# host_name linksys-srw224p ; The name of the host the service is associated with
|
||||||
|
# use generic-service ; Inherit values from a template
|
||||||
|
# check_command check_ping!200.0,20%!600.0,60% ; The command used to monitor the service
|
||||||
|
# check_interval 5 ; Check the service every 5 minutes under normal conditions
|
||||||
|
# retry_interval 1 ; Re-check the service every minute until its final/hard state is determined
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Monitor uptime via SNMP
|
||||||
|
#define service {
|
||||||
|
# service_description Uptime
|
||||||
|
# host_name linksys-srw224p
|
||||||
|
# use generic-service ; Inherit values from a template
|
||||||
|
# check_command check_snmp!-C public -o sysUpTime.0
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Monitor Port 1 status via SNMP
|
||||||
|
#define service {
|
||||||
|
# service_description Port 1 Link Status
|
||||||
|
# host_name linksys-srw224p
|
||||||
|
# use generic-service ; Inherit values from a template
|
||||||
|
# check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## Monitor bandwidth via MRTG logs
|
||||||
|
#define service {
|
||||||
|
# service_description Port 1 Bandwidth Usage
|
||||||
|
# host_name linksys-srw224p
|
||||||
|
# use generic-service ; Inherit values from a template
|
||||||
|
# check_command check_local_mrtgtraf!/var/lib/mrtg/192.168.1.253_1.log!AVG!1000000,1000000!5000000,5000000!10
|
||||||
|
#}
|
@ -0,0 +1,81 @@
|
|||||||
|
###############################################################################
|
||||||
|
# TIMEPERIODS.CFG - SAMPLE TIMEPERIOD DEFINITIONS
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# NOTES: This config file provides you with some example timeperiod definitions
|
||||||
|
# that you can reference in host, service, contact, and dependency
|
||||||
|
# definitions.
|
||||||
|
#
|
||||||
|
# You don't need to keep timeperiods in a separate file from your other
|
||||||
|
# object definitions. This has been done just to make things easier to
|
||||||
|
# understand.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# TIME PERIODS
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
# This defines a timeperiod where all times are valid for checks,
|
||||||
|
# notifications, etc. The classic "24x7" support nightmare. :-)
|
||||||
|
define timeperiod {
|
||||||
|
timeperiod_name 24x7
|
||||||
|
alias 24 Hours A Day, 7 Days A Week
|
||||||
|
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
|
||||||
|
sunday 00:00-24:00
|
||||||
|
}
|
||||||
|
|
||||||
|
# 'workhours' timeperiod definition
|
||||||
|
define timeperiod {
|
||||||
|
timeperiod_name workhours
|
||||||
|
alias Normal Work Hours
|
||||||
|
monday 09:00-17:00
|
||||||
|
tuesday 09:00-17:00
|
||||||
|
wednesday 09:00-17:00
|
||||||
|
thursday 09:00-17:00
|
||||||
|
friday 09:00-17:00
|
||||||
|
}
|
||||||
|
|
||||||
|
# 'none' timeperiod definition
|
||||||
|
define timeperiod {
|
||||||
|
timeperiod_name none
|
||||||
|
alias No Time Is A Good Time
|
||||||
|
}
|
||||||
|
|
||||||
|
# Some U.S. holidays
|
||||||
|
# Note: The timeranges for each holiday are meant to *exclude* the holidays from being
|
||||||
|
# treated as a valid time for notifications, etc. You probably don't want your pager
|
||||||
|
# going off on New Year's. Although you're employer might... :-)
|
||||||
|
define timeperiod {
|
||||||
|
name us-holidays
|
||||||
|
timeperiod_name us-holidays
|
||||||
|
alias U.S. Holidays
|
||||||
|
december 25 00:00-00:00 ; Christmas
|
||||||
|
january 1 00:00-00:00 ; New Years
|
||||||
|
july 4 00:00-00:00 ; Independence Day
|
||||||
|
monday -1 may 00:00-00:00 ; Memorial Day (last Monday in May)
|
||||||
|
monday 1 september 00:00-00:00 ; Labor Day (first Monday in September)
|
||||||
|
thursday 4 november 00:00-00:00 ; Thanksgiving (4th Thursday in November)
|
||||||
|
}
|
||||||
|
|
||||||
|
# This defines a modified "24x7" timeperiod that covers every day of the
|
||||||
|
# year, except for U.S. holidays (defined in the timeperiod above).
|
||||||
|
define timeperiod {
|
||||||
|
timeperiod_name 24x7_sans_holidays
|
||||||
|
alias 24x7 Sans Holidays
|
||||||
|
use us-holidays ; Get holiday exceptions from other timeperiod
|
||||||
|
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
|
||||||
|
sunday 00:00-24:00
|
||||||
|
}
|
@ -0,0 +1,114 @@
|
|||||||
|
###############################################################################
|
||||||
|
# WINDOWS.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# NOTES: This config file assumes that you are using the sample configuration
|
||||||
|
# files that get installed with the Naemon quickstart guide.
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# 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 {
|
||||||
|
# host_name winserver ; The name we're giving to this host
|
||||||
|
# alias My Windows Server ; A longer name associated with the host
|
||||||
|
# address 192.168.1.2 ; IP address of the host
|
||||||
|
# use windows-server ; Inherit default values from a template
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## 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-servers ; The name of the hostgroup
|
||||||
|
# alias Windows Servers ; Long name of the group
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
################################################################################
|
||||||
|
##
|
||||||
|
## 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 {
|
||||||
|
# service_description NSClient++ Version
|
||||||
|
# host_name winserver
|
||||||
|
# use generic-service
|
||||||
|
# check_command check_nt!CLIENTVERSION
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## 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 {
|
||||||
|
# service_description Uptime
|
||||||
|
# host_name winserver
|
||||||
|
# use generic-service
|
||||||
|
# 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 {
|
||||||
|
# service_description CPU Load
|
||||||
|
# host_name winserver
|
||||||
|
# use generic-service
|
||||||
|
# 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 {
|
||||||
|
# service_description Memory Usage
|
||||||
|
# host_name winserver
|
||||||
|
# use generic-service
|
||||||
|
# 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 {
|
||||||
|
# service_description C:\ Drive Space
|
||||||
|
# host_name winserver
|
||||||
|
# use generic-service
|
||||||
|
# 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 {
|
||||||
|
# service_description W3SVC
|
||||||
|
# host_name winserver
|
||||||
|
# use generic-service
|
||||||
|
# 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 {
|
||||||
|
# service_description Explorer
|
||||||
|
# host_name winserver
|
||||||
|
# use generic-service
|
||||||
|
# check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
|
||||||
|
#}
|
||||||
|
#
|
||||||
|
## example service group
|
||||||
|
#define servicegroup {
|
||||||
|
# servicegroup_name windows
|
||||||
|
# alias Some Windows Checks
|
||||||
|
# members winserver,CPU Load,winserver,Memory Usage
|
||||||
|
#}
|
Loading…
Reference in new issue