From ad2f04e6a053335aed31fcdb8eb48ab1490c51b5 Mon Sep 17 00:00:00 2001 From: Kameron Kenny Date: Mon, 30 Dec 2024 11:00:56 -0500 Subject: [PATCH] web hosts --- overlay/opt/nagios/etc/objects/000-commands.cfg | 17 +++++++++++------ .../opt/nagios/etc/objects/001-templates.cfg | 15 +++++++++++++++ .../opt/nagios/etc/objects/102-web-hosts.cfg | 14 ++++++++++++++ .../opt/nagios/etc/objects/200-hostgroups.cfg | 7 +++++++ .../etc/objects/302-web-services-hostgroup.cfg | 14 ++++++++++++++ 5 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 overlay/opt/nagios/etc/objects/102-web-hosts.cfg create mode 100644 overlay/opt/nagios/etc/objects/302-web-services-hostgroup.cfg diff --git a/overlay/opt/nagios/etc/objects/000-commands.cfg b/overlay/opt/nagios/etc/objects/000-commands.cfg index 750b8cb..417223a 100644 --- a/overlay/opt/nagios/etc/objects/000-commands.cfg +++ b/overlay/opt/nagios/etc/objects/000-commands.cfg @@ -4,7 +4,7 @@ # # 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. @@ -17,7 +17,7 @@ # 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 +# 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. # ################################################################################ @@ -47,7 +47,7 @@ define command{ # 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 +# 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) @@ -65,7 +65,7 @@ define command{ # 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 +# 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 @@ -143,9 +143,14 @@ define command{ # 'check_http' command definition define command{ command_name check_http - command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$ + command_line $USER1$/check_http -I $HOSTADDRESS$ -H $HOSTNAME$ } +# 'check_https' command definition +define command{ + command_name check_https + command_line $USER1$/check_http -S -I $HOSTADDRESS$ -H $HOSTNAME$ + } # 'check_ssh' command definition define command{ @@ -231,7 +236,7 @@ define command { # # 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 +# 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. # ################################################################################ diff --git a/overlay/opt/nagios/etc/objects/001-templates.cfg b/overlay/opt/nagios/etc/objects/001-templates.cfg index 535f5b0..ffe96d3 100644 --- a/overlay/opt/nagios/etc/objects/001-templates.cfg +++ b/overlay/opt/nagios/etc/objects/001-templates.cfg @@ -97,6 +97,21 @@ define host{ register 0 } +define host{ + name web-host + use generic-host + hostgroups web-hosts + check_period 24x7 + check_interval 2 + retry_interval 1 + max_check_attempts 3 + check_command check-host-alive + notification_period 24x7 + notification_interval 120 + notification_options d,u,r + contact_groups admins + register 0 +} # Define a template for switches that we can reuse define host{ diff --git a/overlay/opt/nagios/etc/objects/102-web-hosts.cfg b/overlay/opt/nagios/etc/objects/102-web-hosts.cfg new file mode 100644 index 0000000..77a35fc --- /dev/null +++ b/overlay/opt/nagios/etc/objects/102-web-hosts.cfg @@ -0,0 +1,14 @@ +### Hosts +define host{ + use web-host + host_name kameronkenny.com + alias kameronkenny.com + address 204.8.15.81 +} + +define host{ + use web-host + host_name thelinux.pro + alias thelinux.pro + address 204.8.15.81 +} diff --git a/overlay/opt/nagios/etc/objects/200-hostgroups.cfg b/overlay/opt/nagios/etc/objects/200-hostgroups.cfg index 2b38da9..148cd5e 100644 --- a/overlay/opt/nagios/etc/objects/200-hostgroups.cfg +++ b/overlay/opt/nagios/etc/objects/200-hostgroups.cfg @@ -4,3 +4,10 @@ define hostgroup{ alias Docker Hosts members pi501.in.thelinuxpro.net,pi502.in.thelinuxpro.net,pi503.in.thelinuxpro.net,pi504.in.thelinuxpro.net } + +### Hostgroup +define hostgroup{ + hostgroup_name web-hosts + alias web Hosts + members kameronkenny.com,thelinux.pro +} diff --git a/overlay/opt/nagios/etc/objects/302-web-services-hostgroup.cfg b/overlay/opt/nagios/etc/objects/302-web-services-hostgroup.cfg new file mode 100644 index 0000000..eea760f --- /dev/null +++ b/overlay/opt/nagios/etc/objects/302-web-services-hostgroup.cfg @@ -0,0 +1,14 @@ +### Service definitions for all web hosts +define service{ + use generic-service,graphed-service + hostgroup_name web-hosts + service_description PING + check_command check_ping!100.0,20%!500.0,60% +} + +define service{ + use generic-service,graphed-service + hostgroup_name web-hosts + service_description HTTPS + check_command check_https +}