Compare commits

..

2 Commits

Author SHA1 Message Date
Kameron Kenny 6ab6efa27d web stuff 2024-12-30 11:31:48 -05:00
Kameron Kenny 98e47f2436 ssl check 2024-12-30 11:26:58 -05:00
7 changed files with 354 additions and 47 deletions

View File

@ -12,7 +12,7 @@ services:
build: build:
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: nagios container_name: nagios
image: docker-registry1.in.thelinuxpro.net:5000/tlp/nagios:241230.0.1 image: docker-registry1.in.thelinuxpro.net:5000/tlp/nagios:241230.0.2
networks: networks:
infra_dev_net: infra_dev_net:
ipv4_address: 10.99.23.36 ipv4_address: 10.99.23.36

View File

@ -1,24 +1,39 @@
command[check_docker_container_status_ns1]=/usr/lib/nagios/plugins/check_docker --status running --containers ns1 command[check_docker_container_status_ns1]=/usr/lib/nagios/plugins/check_docker --status running --containers ns1
command[check_docker_container_cpu_ns1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers ns1 command[check_docker_container_cpu_ns1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers ns1
command[check_docker_container_memory_ns1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers ns1 command[check_docker_container_memory_ns1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers ns1
command[check_docker_container_status_gitea]=/usr/lib/nagios/plugins/check_docker --status running --containers gitea
command[check_docker_container_status_gitea]=/usr/lib/nagios/plugins/check_docker --status running --containers gitea
command[check_docker_container_cpu_gitea]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers gitea command[check_docker_container_cpu_gitea]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers gitea
command[check_docker_container_memory_gitea]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers gitea command[check_docker_container_memory_gitea]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers gitea
command[check_docker_container_status_gitea-db-1]=/usr/lib/nagios/plugins/check_docker --status running --containers gitea-db-1
command[check_docker_container_status_gitea-db-1]=/usr/lib/nagios/plugins/check_docker --status running --containers gitea-db-1
command[check_docker_container_cpu_gitea-db-1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers gitea-db-1 command[check_docker_container_cpu_gitea-db-1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers gitea-db-1
command[check_docker_container_memory_gitea-db-1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers gitea-db-1 command[check_docker_container_memory_gitea-db-1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers gitea-db-1
command[check_docker_container_status_docker-registry1]=/usr/lib/nagios/plugins/check_docker --status running --containers docker-registry1 command[check_docker_container_status_docker-registry1]=/usr/lib/nagios/plugins/check_docker --status running --containers docker-registry1
command[check_docker_container_cpu_docker-registry1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers docker-registry1 command[check_docker_container_cpu_docker-registry1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers docker-registry1
command[check_docker_container_memory_docker-registry1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers docker-registry1 command[check_docker_container_memory_docker-registry1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers docker-registry1
command[check_docker_container_status_thelinux_pro]=/usr/lib/nagios/plugins/check_docker --status running --containers thelinux_pro command[check_docker_container_status_thelinux_pro]=/usr/lib/nagios/plugins/check_docker --status running --containers thelinux_pro
command[check_docker_container_cpu_thelinux_pro]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers thelinux_pro command[check_docker_container_cpu_thelinux_pro]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers thelinux_pro
command[check_docker_container_memory_thelinux_pro]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers thelinux_pro command[check_docker_container_memory_thelinux_pro]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers thelinux_pro
command[check_docker_container_status_nginx-certbot-nginx-1]=/usr/lib/nagios/plugins/check_docker --status running --containers nginx-certbot-nginx-1
command[check_docker_container_cpu_nginx-certbot-nginx-1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers nginx-certbot-nginx-1
command[check_docker_container_memory_nginx-certbot-nginx-1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers nginx-certbot-nginx-1
command[check_docker_container_status_nginx-certbot-certbot-1]=/usr/lib/nagios/plugins/check_docker --status running --containers nginx-certbot-certbot-1
command[check_docker_container_cpu_nginx-certbot-certbot-1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers nginx-certbot-certbot-1
command[check_docker_container_memory_nginx-certbot-certbot-1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers nginx-certbot-certbot-1
command[check_docker_container_status_pihole1]=/usr/lib/nagios/plugins/check_docker --status running --containers pihole1 command[check_docker_container_status_pihole1]=/usr/lib/nagios/plugins/check_docker --status running --containers pihole1
command[check_docker_container_cpu_pihole1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers pihole1 command[check_docker_container_cpu_pihole1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers pihole1
command[check_docker_container_memory_pihole1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers pihole1 command[check_docker_container_memory_pihole1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers pihole1
command[check_docker_container_status_kameronkenny_com_web1]=/usr/lib/nagios/plugins/check_docker --status running --containers kameronkenny.com_web1 command[check_docker_container_status_kameronkenny_com_web1]=/usr/lib/nagios/plugins/check_docker --status running --containers kameronkenny.com_web1
command[check_docker_container_cpu_kameronkenny_com_web1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers kameronkenny.com_web1 command[check_docker_container_cpu_kameronkenny_com_web1]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers kameronkenny.com_web1
command[check_docker_container_memory_kameronkenny_com_web1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers kameronkenny.com_web1 command[check_docker_container_memory_kameronkenny_com_web1]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers kameronkenny.com_web1
command[check_docker_container_status_jenkins]=/usr/lib/nagios/plugins/check_docker --status running --containers jenkins command[check_docker_container_status_jenkins]=/usr/lib/nagios/plugins/check_docker --status running --containers jenkins
command[check_docker_container_cpu_jenkins]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers jenkins command[check_docker_container_cpu_jenkins]=/usr/lib/nagios/plugins/check_docker --cpu 90:95 --containers jenkins
command[check_docker_container_memory_jenkins]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers jenkins command[check_docker_container_memory_jenkins]=/usr/lib/nagios/plugins/check_docker --memory 90:95:% --containers jenkins

View File

@ -12,7 +12,7 @@
# LOG FILE # LOG FILE
# This is the main log file where service and host events are logged # This is the main log file where service and host events are logged
# for historical purposes. This should be the first option specified # for historical purposes. This should be the first option specified
# in the config file!!! # in the config file!!!
log_file=/opt/nagios/var/nagios.log log_file=/opt/nagios/var/nagios.log
@ -26,14 +26,14 @@ log_file=/opt/nagios/var/nagios.log
# if you wish (as shown below), or keep them all in a single config file. # if you wish (as shown below), or keep them all in a single config file.
# You can specify individual object config files as shown below: # You can specify individual object config files as shown below:
cfg_file=/opt/nagios/etc/objects/commands.cfg #cfg_file=/opt/nagios/etc/objects/000-commands.cfg
cfg_file=/opt/nagios/etc/objects/contacts.cfg #cfg_file=/opt/nagios/etc/objects/contacts.cfg
cfg_file=/opt/nagios/etc/objects/timeperiods.cfg #cfg_file=/opt/nagios/etc/objects/timeperiods.cfg
cfg_file=/opt/nagios/etc/objects/templates.cfg #cfg_file=/opt/nagios/etc/objects/001-templates.cfg
# Definitions for monitoring the local (Linux) host # Definitions for monitoring the local (Linux) host
cfg_file=/opt/nagios/etc/objects/localhost.cfg #cfg_file=/opt/nagios/etc/objects/localhost.cfg
cfg_file=/opt/nagios/etc/objects/docker-hosts.cfg #cfg_file=/opt/nagios/etc/objects/101-docker-hosts.cfg
# Definitions for monitoring a Windows machine # Definitions for monitoring a Windows machine
#cfg_file=/opt/nagios/etc/objects/windows.cfg #cfg_file=/opt/nagios/etc/objects/windows.cfg
@ -49,7 +49,7 @@ cfg_file=/opt/nagios/etc/objects/docker-hosts.cfg
# extension) in a particular directory by using the cfg_dir # extension) in a particular directory by using the cfg_dir
# directive as shown below: # directive as shown below:
#cfg_dir=/opt/nagios/etc/objects cfg_dir=/opt/nagios/etc/objects
#cfg_dir=/opt/nagios/etc/servers #cfg_dir=/opt/nagios/etc/servers
#cfg_dir=/opt/nagios/etc/printers #cfg_dir=/opt/nagios/etc/printers
@ -61,7 +61,7 @@ cfg_file=/opt/nagios/etc/objects/docker-hosts.cfg
# OBJECT CACHE FILE # OBJECT CACHE FILE
# This option determines where object definitions are cached when # This option determines where object definitions are cached when
# Nagios starts/restarts. The CGIs read object definitions from # Nagios starts/restarts. The CGIs read object definitions from
# this cache file (rather than looking at the object config files # this cache file (rather than looking at the object config files
# directly) in order to prevent inconsistencies that can occur # directly) in order to prevent inconsistencies that can occur
# when the config files are modified after Nagios starts. # when the config files are modified after Nagios starts.
@ -77,7 +77,7 @@ object_cache_file=/opt/nagios/var/objects.cache
# file. You can then start Nagios with the -u option to have it read # file. You can then start Nagios with the -u option to have it read
# object definitions from this precached file, rather than the standard # object definitions from this precached file, rather than the standard
# object configuration files (see the cfg_file and cfg_dir options above). # object configuration files (see the cfg_file and cfg_dir options above).
# Using a precached object file can speed up the time needed to (re)start # Using a precached object file can speed up the time needed to (re)start
# the Nagios process if you've got a large and/or complex configuration. # the Nagios process if you've got a large and/or complex configuration.
# Read the documentation section on optimizing Nagios to find our more # Read the documentation section on optimizing Nagios to find our more
# about how this feature works. # about how this feature works.
@ -111,7 +111,7 @@ status_file=/opt/nagios/var/status.dat
# STATUS FILE UPDATE INTERVAL # STATUS FILE UPDATE INTERVAL
# This option determines the frequency (in seconds) that # This option determines the frequency (in seconds) that
# Nagios will periodically dump program, host, and # Nagios will periodically dump program, host, and
# service status data. # service status data.
status_update_interval=10 status_update_interval=10
@ -119,7 +119,7 @@ status_update_interval=10
# NAGIOS USER # NAGIOS USER
# This determines the effective user that Nagios should run as. # This determines the effective user that Nagios should run as.
# You can either supply a username or a UID. # You can either supply a username or a UID.
nagios_user=nagios nagios_user=nagios
@ -127,7 +127,7 @@ nagios_user=nagios
# NAGIOS GROUP # NAGIOS GROUP
# This determines the effective group that Nagios should run as. # This determines the effective group that Nagios should run as.
# You can either supply a group name or a GID. # You can either supply a group name or a GID.
nagios_group=nagios nagios_group=nagios
@ -150,7 +150,7 @@ check_external_commands=1
# This is the file that Nagios checks for external command requests. # This is the file that Nagios checks for external command requests.
# It is also where the command CGI will write commands that are submitted # It is also where the command CGI will write commands that are submitted
# by users, so it must be writeable by the user that the web server # by users, so it must be writeable by the user that the web server
# is running as (usually 'nobody'). Permissions should be set at the # is running as (usually 'nobody'). Permissions should be set at the
# directory level instead of on the file, as the file is deleted every # directory level instead of on the file, as the file is deleted every
# time its contents are processed. # time its contents are processed.
@ -242,7 +242,7 @@ log_rotation_method=d
# LOG ARCHIVE PATH # LOG ARCHIVE PATH
# This is the directory where archived (rotated) log files should be # This is the directory where archived (rotated) log files should be
# placed (assuming you've chosen to do log rotation). # placed (assuming you've chosen to do log rotation).
log_archive_path=/opt/nagios/var/archives log_archive_path=/opt/nagios/var/archives
@ -414,7 +414,7 @@ max_host_check_spread=30
# MAXIMUM CONCURRENT SERVICE CHECKS # MAXIMUM CONCURRENT SERVICE CHECKS
# This option allows you to specify the maximum number of # This option allows you to specify the maximum number of
# service checks that can be run in parallel at any given time. # service checks that can be run in parallel at any given time.
# Specifying a value of 1 for this variable essentially prevents # Specifying a value of 1 for this variable essentially prevents
# any service checks from being parallelized. A value of 0 # any service checks from being parallelized. A value of 0
@ -436,7 +436,7 @@ check_result_reaper_frequency=10
# MAX CHECK RESULT REAPER TIME # MAX CHECK RESULT REAPER TIME
# This is the max amount of time (in seconds) that a single # This is the max amount of time (in seconds) that a single
# check result reaper event will be allowed to run before # check result reaper event will be allowed to run before
# returning control back to Nagios so it can perform other # returning control back to Nagios so it can perform other
# duties. # duties.
@ -450,7 +450,7 @@ max_check_result_reaper_time=30
# service checks that have not yet been processed. # service checks that have not yet been processed.
# #
# Note: Make sure that only one instance of Nagios has access # Note: Make sure that only one instance of Nagios has access
# to this directory! # to this directory!
check_result_path=/opt/nagios/var/spool/checkresults check_result_path=/opt/nagios/var/spool/checkresults
@ -459,7 +459,7 @@ check_result_path=/opt/nagios/var/spool/checkresults
# MAX CHECK RESULT FILE AGE # MAX CHECK RESULT FILE AGE
# This option determines the maximum age (in seconds) which check # This option determines the maximum age (in seconds) which check
# result files are considered to be valid. Files older than this # result files are considered to be valid. Files older than this
# threshold will be mercilessly deleted without further processing. # threshold will be mercilessly deleted without further processing.
max_check_result_file_age=3600 max_check_result_file_age=3600
@ -521,14 +521,14 @@ enable_predictive_service_dependency_checks=1
# SOFT STATE DEPENDENCIES # SOFT STATE DEPENDENCIES
# This option determines whether or not Nagios will use soft state # This option determines whether or not Nagios will use soft state
# information when checking host and service dependencies. Normally # information when checking host and service dependencies. Normally
# Nagios will only use the latest hard host or service state when # Nagios will only use the latest hard host or service state when
# checking dependencies. If you want it to use the latest state (regardless # checking dependencies. If you want it to use the latest state (regardless
# of whether its a soft or hard state type), enable this option. # of whether its a soft or hard state type), enable this option.
# Values: # Values:
# 0 = Don't use soft state dependencies (default) # 0 = Don't use soft state dependencies (default)
# 1 = Use soft state dependencies # 1 = Use soft state dependencies
soft_state_dependencies=0 soft_state_dependencies=0
@ -546,7 +546,7 @@ soft_state_dependencies=0
# This option determines whether or not Nagios will attempt to # This option determines whether or not Nagios will attempt to
# automatically reschedule active host and service checks to # automatically reschedule active host and service checks to
# "smooth" them out over time. This can help balance the load on # "smooth" them out over time. This can help balance the load on
# the monitoring server. # the monitoring server.
# WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE # WARNING: THIS IS AN EXPERIMENTAL FEATURE - IT CAN DEGRADE
# PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY # PERFORMANCE, RATHER THAN INCREASE IT, IF USED IMPROPERLY
@ -601,7 +601,7 @@ perfdata_timeout=5
# This setting determines whether or not Nagios will save state # This setting determines whether or not Nagios will save state
# information for services and hosts before it shuts down. Upon # information for services and hosts before it shuts down. Upon
# startup Nagios will reload all saved service and host state # startup Nagios will reload all saved service and host state
# information before starting to monitor. This is useful for # information before starting to monitor. This is useful for
# maintaining long-term data on state statistics, etc, but will # maintaining long-term data on state statistics, etc, but will
# slow Nagios down a bit when it (re)starts. Since its only # slow Nagios down a bit when it (re)starts. Since its only
# a one-time penalty, I think its well worth the additional # a one-time penalty, I think its well worth the additional
@ -613,7 +613,7 @@ retain_state_information=1
# STATE RETENTION FILE # STATE RETENTION FILE
# This is the file that Nagios should use to store host and # This is the file that Nagios should use to store host and
# service state information before it shuts down. The state # service state information before it shuts down. The state
# information in this file is also read immediately prior to # information in this file is also read immediately prior to
# starting to monitor the network when Nagios is restarted. # starting to monitor the network when Nagios is restarted.
# This file is used only if the retain_state_information # This file is used only if the retain_state_information
@ -636,7 +636,7 @@ retention_update_interval=60
# USE RETAINED PROGRAM STATE # USE RETAINED PROGRAM STATE
# This setting determines whether or not Nagios will set # This setting determines whether or not Nagios will set
# program status variables based on the values saved in the # program status variables based on the values saved in the
# retention file. If you want to use retained program status # retention file. If you want to use retained program status
# information, set this value to 1. If not, set this value # information, set this value to 1. If not, set this value
@ -663,7 +663,7 @@ use_retained_scheduling_info=1
# program restarts. # program restarts.
# #
# The values of the masks are bitwise ANDs of values specified # The values of the masks are bitwise ANDs of values specified
# by the "MODATTR_" definitions found in include/common.h. # by the "MODATTR_" definitions found in include/common.h.
# For example, if you do not want the current enabled/disabled state # For example, if you do not want the current enabled/disabled state
# of flap detection and event handlers for hosts to be retained, you # of flap detection and event handlers for hosts to be retained, you
# would use a value of 24 for the host attribute mask... # would use a value of 24 for the host attribute mask...
@ -707,7 +707,7 @@ interval_length=60
# enable this option to ensure that you stay on top of the latest critical # enable this option to ensure that you stay on top of the latest critical
# patches to Nagios. Nagios is critical to you - make sure you keep it in # patches to Nagios. Nagios is critical to you - make sure you keep it in
# good shape. Nagios will check once a day for new updates. Data collected # good shape. Nagios will check once a day for new updates. Data collected
# by Nagios Enterprises from the update check is processed in accordance # by Nagios Enterprises from the update check is processed in accordance
# with our privacy policy - see https://api.nagios.org for details. # with our privacy policy - see https://api.nagios.org for details.
check_for_updates=1 check_for_updates=1
@ -716,10 +716,10 @@ check_for_updates=1
# BARE UPDATE CHECK # BARE UPDATE CHECK
# This option deterines what data Nagios will send to api.nagios.org when # This option deterines what data Nagios will send to api.nagios.org when
# it checks for updates. By default, Nagios will send information on the # it checks for updates. By default, Nagios will send information on the
# current version of Nagios you have installed, as well as an indicator as # current version of Nagios you have installed, as well as an indicator as
# to whether this was a new installation or not. Nagios Enterprises uses # to whether this was a new installation or not. Nagios Enterprises uses
# this data to determine the number of users running specific version of # this data to determine the number of users running specific version of
# Nagios. Enable this option if you do not want this information to be sent. # Nagios. Enable this option if you do not want this information to be sent.
bare_update_check=0 bare_update_check=0
@ -739,7 +739,7 @@ use_aggressive_host_checking=0
# SERVICE CHECK EXECUTION OPTION # SERVICE CHECK EXECUTION OPTION
# This determines whether or not Nagios will actively execute # This determines whether or not Nagios will actively execute
# service checks when it initially starts. If this option is # service checks when it initially starts. If this option is
# disabled, checks are not actively made, but Nagios can still # disabled, checks are not actively made, but Nagios can still
# receive and process passive check results that come in. Unless # receive and process passive check results that come in. Unless
# you're implementing redundant hosts or have a special need for # you're implementing redundant hosts or have a special need for
@ -761,7 +761,7 @@ accept_passive_service_checks=1
# HOST CHECK EXECUTION OPTION # HOST CHECK EXECUTION OPTION
# This determines whether or not Nagios will actively execute # This determines whether or not Nagios will actively execute
# host checks when it initially starts. If this option is # host checks when it initially starts. If this option is
# disabled, checks are not actively made, but Nagios can still # disabled, checks are not actively made, but Nagios can still
# receive and process passive check results that come in. Unless # receive and process passive check results that come in. Unless
# you're implementing redundant hosts or have a special need for # you're implementing redundant hosts or have a special need for
@ -818,7 +818,7 @@ process_performance_data=1
# These commands are run after every host and service check is # These commands are run after every host and service check is
# performed. These commands are executed only if the # performed. These commands are executed only if the
# enable_performance_data option (above) is set to 1. The command # enable_performance_data option (above) is set to 1. The command
# argument is the short name of a command definition that you # argument is the short name of a command definition that you
# define in your host configuration file. Read the HTML docs for # define in your host configuration file. Read the HTML docs for
# more information on performance data. # more information on performance data.
@ -908,7 +908,7 @@ obsess_over_services=0
# OBSESSIVE COMPULSIVE SERVICE PROCESSOR COMMAND # OBSESSIVE COMPULSIVE SERVICE PROCESSOR COMMAND
# This is the command that is run for every service check that is # This is the command that is run for every service check that is
# processed by Nagios. This command is executed only if the # processed by Nagios. This command is executed only if the
# obsess_over_services option (above) is set to 1. The command # obsess_over_services option (above) is set to 1. The command
# argument is the short name of a command definition that you # argument is the short name of a command definition that you
# define in your host configuration file. Read the HTML docs for # define in your host configuration file. Read the HTML docs for
# more information on implementing distributed monitoring. # more information on implementing distributed monitoring.
@ -932,7 +932,7 @@ obsess_over_hosts=0
# OBSESSIVE COMPULSIVE HOST PROCESSOR COMMAND # OBSESSIVE COMPULSIVE HOST PROCESSOR COMMAND
# This is the command that is run for every host check that is # This is the command that is run for every host check that is
# processed by Nagios. This command is executed only if the # processed by Nagios. This command is executed only if the
# obsess_over_hosts option (above) is set to 1. The command # obsess_over_hosts option (above) is set to 1. The command
# argument is the short name of a command definition that you # argument is the short name of a command definition that you
# define in your host configuration file. Read the HTML docs for # define in your host configuration file. Read the HTML docs for
# more information on implementing distributed monitoring. # more information on implementing distributed monitoring.
@ -971,9 +971,9 @@ passive_host_checks_are_soft=0
# ORPHANED HOST/SERVICE CHECK OPTIONS # ORPHANED HOST/SERVICE CHECK OPTIONS
# These options determine whether or not Nagios will periodically # These options determine whether or not Nagios will periodically
# check for orphaned host service checks. Since service checks are # check for orphaned host service checks. Since service checks are
# not rescheduled until the results of their previous execution # not rescheduled until the results of their previous execution
# instance are processed, there exists a possibility that some # instance are processed, there exists a possibility that some
# checks may never get rescheduled. A similar situation exists for # checks may never get rescheduled. A similar situation exists for
# host checks, although the exact scheduling details differ a bit # host checks, although the exact scheduling details differ a bit
@ -1046,7 +1046,7 @@ date_format=iso8601
# the system configured timezone. # the system configured timezone.
# #
# NOTE: In order to display the correct timezone in the CGIs, you # NOTE: In order to display the correct timezone in the CGIs, you
# will also need to alter the Apache directives for the CGI path # will also need to alter the Apache directives for the CGI path
# to include your timezone. Example: # to include your timezone. Example:
# #
# <Directory "/usr/local/nagios/sbin/"> # <Directory "/usr/local/nagios/sbin/">
@ -1101,7 +1101,7 @@ use_regexp_matching=0
# "TRUE" REGULAR EXPRESSION MATCHING # "TRUE" REGULAR EXPRESSION MATCHING
# This option controls whether or not "true" regular expression # This option controls whether or not "true" regular expression
# matching takes place in the object config files. This option # matching takes place in the object config files. This option
# only has an effect if regular expression matching is enabled # only has an effect if regular expression matching is enabled
# (see above). If this option is DISABLED, regular expression # (see above). If this option is DISABLED, regular expression
@ -1190,7 +1190,7 @@ enable_environment_macros=0
# This option determines how much (if any) debugging information will # This option determines how much (if any) debugging information will
# be written to the debug file. OR values together to log multiple # be written to the debug file. OR values together to log multiple
# types of information. # types of information.
# Values: # Values:
# -1 = Everything # -1 = Everything
# 0 = Nothing # 0 = Nothing
# 1 = Functions # 1 = Functions

View File

@ -152,6 +152,11 @@ define command{
command_line $USER1$/check_http -S -I $HOSTADDRESS$ -H $HOSTNAME$ command_line $USER1$/check_http -S -I $HOSTADDRESS$ -H $HOSTNAME$
} }
define command{
command_name check_ssl_cert
command_line $USER1$/check_ssl_certificate -a "-servername $HOSTNAME$" -H $HOSTADDRESS$ -w 21 -c 7
}
# 'check_ssh' command definition # 'check_ssh' command definition
define command{ define command{
command_name check_ssh command_name check_ssh

View File

@ -12,3 +12,10 @@ define service{
service_description HTTPS service_description HTTPS
check_command check_https check_command check_https
} }
define service{
use generic-service,graphed-service
hostgroup_name web-hosts
service_description SSL Certificate
check_command check_ssl_cert
}

View File

@ -1,4 +1,6 @@
### Service Definitions per docker host ### Service Definitions per docker host
## PI501
define service{ define service{
use local-service,graphed-service use local-service,graphed-service
host_name pi501.in.thelinuxpro.net host_name pi501.in.thelinuxpro.net
@ -42,6 +44,7 @@ define service{
host_name pi501.in.thelinuxpro.net host_name pi501.in.thelinuxpro.net
service_description Container Memory: ns1 service_description Container Memory: ns1
check_command check_nrpe!check_docker_container_memory_ns1 check_command check_nrpe!check_docker_container_memory_ns1
register 0
} }
define service{ define service{
@ -63,6 +66,7 @@ define service{
host_name pi501.in.thelinuxpro.net host_name pi501.in.thelinuxpro.net
service_description Container Memory: gitea service_description Container Memory: gitea
check_command check_nrpe!check_docker_container_memory_gitea check_command check_nrpe!check_docker_container_memory_gitea
register 0
} }
define service{ define service{
@ -84,6 +88,7 @@ define service{
host_name pi501.in.thelinuxpro.net host_name pi501.in.thelinuxpro.net
service_description Container Memory: gitea-db-1 service_description Container Memory: gitea-db-1
check_command check_nrpe!check_docker_container_memory_gitea-db-1 check_command check_nrpe!check_docker_container_memory_gitea-db-1
register 0
} }
define service{ define service{
@ -105,6 +110,7 @@ define service{
host_name pi501.in.thelinuxpro.net host_name pi501.in.thelinuxpro.net
service_description Container Memory: docker-registry1 service_description Container Memory: docker-registry1
check_command check_nrpe!check_docker_container_memory_docker-registry1 check_command check_nrpe!check_docker_container_memory_docker-registry1
register 0
} }
define service{ define service{
@ -126,6 +132,51 @@ define service{
host_name pi501.in.thelinuxpro.net host_name pi501.in.thelinuxpro.net
service_description Container Memory: thelinux_pro service_description Container Memory: thelinux_pro
check_command check_nrpe!check_docker_container_memory_thelinux_pro check_command check_nrpe!check_docker_container_memory_thelinux_pro
register 0
}
define service{
use local-service,graphed-service
host_name pi501.in.thelinuxpro.net
service_description Container Status: nginx-certbot-nginx-1
check_command check_nrpe!check_docker_container_status_nginx-certbot-nginx-1
}
define service{
use local-service,graphed-service
host_name pi501.in.thelinuxpro.net
service_description Container CPU: nginx-certbot-nginx-1
check_command check_nrpe!check_docker_container_cpu_nginx-certbot-nginx-1
}
define service{
use local-service,graphed-service
host_name pi501.in.thelinuxpro.net
service_description Container Memory: nginx-certbot-nginx-1
check_command check_nrpe!check_docker_container_memory_nginx-certbot-nginx-1
register 0
}
define service{
use local-service,graphed-service
host_name pi501.in.thelinuxpro.net
service_description Container Status: nginx-certbot-certbot-1
check_command check_nrpe!check_docker_container_status_nginx-certbot-certbot-1
}
define service{
use local-service,graphed-service
host_name pi501.in.thelinuxpro.net
service_description Container CPU: nginx-certbot-certbot-1
check_command check_nrpe!check_docker_container_cpu_nginx-certbot-certbot-1
}
define service{
use local-service,graphed-service
host_name pi501.in.thelinuxpro.net
service_description Container Memory: nginx-certbot-certbot-1
check_command check_nrpe!check_docker_container_memory_nginx-certbot-certbot-1
register 0
} }
define service{ define service{
@ -147,6 +198,7 @@ define service{
host_name pi501.in.thelinuxpro.net host_name pi501.in.thelinuxpro.net
service_description Container Memory: pihole1 service_description Container Memory: pihole1
check_command check_nrpe!check_docker_container_memory_pihole1 check_command check_nrpe!check_docker_container_memory_pihole1
register 0
} }
define service{ define service{
@ -168,6 +220,7 @@ define service{
host_name pi501.in.thelinuxpro.net host_name pi501.in.thelinuxpro.net
service_description Container Memory: kameronkenny_com_web1 service_description Container Memory: kameronkenny_com_web1
check_command check_nrpe!check_docker_container_memory_kameronkenny_com_web1 check_command check_nrpe!check_docker_container_memory_kameronkenny_com_web1
register 0
} }
define service{ define service{
@ -189,8 +242,24 @@ define service{
host_name pi501.in.thelinuxpro.net host_name pi501.in.thelinuxpro.net
service_description Container Memory: jenkins service_description Container Memory: jenkins
check_command check_nrpe!check_docker_container_memory_jenkins check_command check_nrpe!check_docker_container_memory_jenkins
register 0
} }
define service{
use local-service,graphed-service
host_name pi501.in.thelinuxpro.net
service_description Container Status: kameronkenny.com_web1
check_command check_nrpe!check_docker_container_status_kameronkenny.com_web1
}
define service{
use local-service,graphed-service
host_name pi501.in.thelinuxpro.net
service_description Container CPU: kameronkenny.com_web1
check_command check_nrpe!check_docker_container_cpu_kameronkenny.com_web1
}
## PI502
define service{ define service{
use local-service,graphed-service use local-service,graphed-service
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
@ -210,6 +279,7 @@ define service{
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
service_description Container Memory: ns2 service_description Container Memory: ns2
check_command check_nrpe!check_docker_container_memory_ns2 check_command check_nrpe!check_docker_container_memory_ns2
register 0
} }
define service{ define service{
@ -231,6 +301,7 @@ define service{
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
service_description Container Memory: blackbox-exporter service_description Container Memory: blackbox-exporter
check_command check_nrpe!check_docker_container_memory_blackbox-exporter check_command check_nrpe!check_docker_container_memory_blackbox-exporter
register 0
} }
define service{ define service{
@ -252,6 +323,7 @@ define service{
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
service_description Container Memory: grafana service_description Container Memory: grafana
check_command check_nrpe!check_docker_container_memory_grafana check_command check_nrpe!check_docker_container_memory_grafana
register 0
} }
define service{ define service{
@ -273,6 +345,7 @@ define service{
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
service_description Container Memory: pihole-exporter service_description Container Memory: pihole-exporter
check_command check_nrpe!check_docker_container_memory_pihole-exporter check_command check_nrpe!check_docker_container_memory_pihole-exporter
register 0
} }
define service{ define service{
@ -294,6 +367,7 @@ define service{
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
service_description Container Memory: unpoller service_description Container Memory: unpoller
check_command check_nrpe!check_docker_container_memory_unpoller check_command check_nrpe!check_docker_container_memory_unpoller
register 0
} }
define service{ define service{
@ -315,6 +389,7 @@ define service{
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
service_description Container Memory: pihole2 service_description Container Memory: pihole2
check_command check_nrpe!check_docker_container_memory_pihole2 check_command check_nrpe!check_docker_container_memory_pihole2
register 0
} }
define service{ define service{
@ -336,6 +411,7 @@ define service{
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
service_description Container Memory: prometheus service_description Container Memory: prometheus
check_command check_nrpe!check_docker_container_memory_prometheus check_command check_nrpe!check_docker_container_memory_prometheus
register 0
} }
define service{ define service{
@ -357,6 +433,7 @@ define service{
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
service_description Container Memory: syslog-ng service_description Container Memory: syslog-ng
check_command check_nrpe!check_docker_container_memory_syslog-ng check_command check_nrpe!check_docker_container_memory_syslog-ng
register 0
} }
define service{ define service{
@ -378,6 +455,7 @@ define service{
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
service_description Container Memory: telegraf service_description Container Memory: telegraf
check_command check_nrpe!check_docker_container_memory_telegraf check_command check_nrpe!check_docker_container_memory_telegraf
register 0
} }
define service{ define service{
@ -399,8 +477,10 @@ define service{
host_name pi502.in.thelinuxpro.net host_name pi502.in.thelinuxpro.net
service_description Container Memory: influxdb_telegraf-influxdb-1 service_description Container Memory: influxdb_telegraf-influxdb-1
check_command check_nrpe!check_docker_container_memory_influxdb_telegraf-influxdb-1 check_command check_nrpe!check_docker_container_memory_influxdb_telegraf-influxdb-1
register 0
} }
## PI503
define service{ define service{
use local-service,graphed-service use local-service,graphed-service
host_name pi503.in.thelinuxpro.net host_name pi503.in.thelinuxpro.net
@ -420,5 +500,6 @@ define service{
host_name pi503.in.thelinuxpro.net host_name pi503.in.thelinuxpro.net
service_description Container Memory: nagios service_description Container Memory: nagios
check_command check_nrpe!check_docker_container_memory_nagios check_command check_nrpe!check_docker_container_memory_nagios
register 0
} }

View File

@ -0,0 +1,199 @@
#!/usr/bin/perl -w
#
# check_ssl_certificate
# Nagios script to check ssl certificate expirations
#
# Copyright (c) 2006-2008 David Alden <alden@math.ohio-state.edu>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# Changes:
# 10/30/2008 dja <alden@math.ohio-state.edu>
# - fixed a bug which caused it to not deal with certs that expire
# on a single digit day (thanks to Christian Sava, Kyle Smith &
# Raphael Berlamont)
#
# 10/09/2007 dja <alden@math.ohio-state.edu>
# - fixed a bug which caused it to improperly report expired certs
# (thanks to Hassan Alusesi for pointing this out)
# - no longer use temporary files or Date::Manip
# (thanks to tommybobbins on NagiosExchange)
# - added the printing of the Common Name (CN) if verbose is specified
# (thanks to mp72 on NagiosExchange)
#
#
# Description:
# This script will check if an SSL certificate is going to expire. For
# example, to check the IMAP certificate on an imaps port:
#
# check_ssl_certificate -H 1.1.1.1 -p 993
#
#
# Installation:
# Edit this script, replacing the line:
# use lib "/usr/lib/nagios/plugins";
# with the path to your nagios plugins directory (where utils.pm is
# located). Also edit the line:
# my $openssl = "/usr/bin/openssl";
# with the path to your openssl binary. Then copy the script into
# your nagios plugins directory.
#
#
use strict;
use Time::Local;
use Getopt::Long;
use lib "/usr/lib64/nagios/plugins";
use utils qw(%ERRORS &print_revision &support &usage);
my $PROGNAME="check_ssl_certificates";
my $REVISION="1.2";
#
$ENV{PATH}="/usr/sbin:/usr/bin:/bin";
#
my $openssl = "/usr/bin/openssl";
my $critical = 7;
my $help;
my $host;
my $port = 443;
my $additional = '';
my $verbose;
my $version;
my $warning = 30;
#
my %months = ('Jan' => 0, 'Feb' => 1, 'Mar' => 2, 'Apr' => 3, 'May' => 4,
'Jun' => 5, 'Jul' => 6, 'Aug' => 7, 'Sep' => 8, 'Oct' => 9,
'Nov' => 10, 'Dec' => 11);
#
Getopt::Long::Configure('bundling');
if (GetOptions(
"a=s" => \$additional,
"c:s" => \$critical,
"h" => \$help,
"H:s" => \$host,
"o=s" => \$openssl,
"p=i" => \$port,
"v" => \$verbose,
"V" => \$version,
"w:s" => \$warning,
) == 0) {
print_usage();
exit $ERRORS{'UNKNOWN'}
}
if ($version) {
print_revision($PROGNAME, "\$Revision: $REVISION \$");
exit $ERRORS{'OK'};
}
if ($help) {
print_help();
exit $ERRORS{'OK'};
}
if (! utils::is_hostname($host)) {
usage("");
exit $ERRORS{'UNKNOWN'};
}
open(OPENSSL, "$openssl s_client -connect $host:$port $additional < /dev/null 2>&1 | $openssl x509 -enddate -noout |") ||
die "unable to open $openssl: $!";
my $date;
while (<OPENSSL>) {
if ($_ =~ /^notAfter=(.*)/) {
$date = $1;
chomp($date);
# last;
}
}
close(OPENSSL);
$date =~ s/ +/ /g;
my ($month, $day, $hour, $min, $sec, $year, $tz) = split(/[\s+|:]/, $date);
print "m=$month, d=$day, h=$hour, m=$min, s=$sec, y=$year, z=$tz\n";
my $daysLeft = int((timegm($sec, $min, $hour, $day, $months{$month}, $year - 1900) - time()) / 86400);
my $cn="this certificate";
if ($verbose) {
open(OPENSSL, "$openssl s_client -connect $host:$port $additional < /dev/null 2>&1 |") ||
die "unable to open $openssl: $!";
while (<OPENSSL>) {
next unless $_ =~ /Certificate chain/;
while (<OPENSSL>) {
next unless $_ =~ /CN=(.*)/;
($cn) = split(/\//, $1);
$cn .= "[$host]" if ($cn ne $host);
last;
}
}
}
if ($daysLeft < 0) {
print "$PROGNAME: CRITICAL - $cn expired " . abs($daysLeft) . " day(s) ago.\n";
} elsif ($daysLeft <= $critical) {
print "$PROGNAME: CRITICAL - only $daysLeft day(s) left for $cn.\n";
exit $ERRORS{'CRITICAL'};
} elsif ($daysLeft <= $warning) {
print "$PROGNAME: WARNING - only $daysLeft day(s) left for $cn.\n";
exit $ERRORS{'WARNING'};
} elsif ($verbose) {
print "$PROGNAME: $daysLeft day(s) left for $cn.\n";
}
exit $ERRORS{'OK'};
sub print_help {
print_revision($PROGNAME, "\$Revision: $REVISION \$");
print "Copyright (c) 2006 David Alden
Check if an SSL certificate is close to expiring
";
print_usage();
print "
-a <add> add the text to the openssl line, used for checking the smtp ssl
certificate with starttls (\"-a '-starttls smtp'\")
-c <num> exit with CRITICAL status if number of days left is less than <num>
-h show this help script
-H <host> check the certificate on the indicated host
-o <path> path to openssl binary
-p <port> check the certificate on the specified port
-w <num> exit with WARNING status if number of days left is less than <num>
-v show the number of days left
-V show version and license information
";
support();
}
sub print_usage {
print "Usage: $PROGNAME -H <host> [-p <port>] [-c <low>:<high>] [-w <low>:<high>]\n";
return();
}