web stuff

This commit is contained in:
Kameron Kenny 2024-12-30 11:31:48 -05:00
parent 98e47f2436
commit 6ab6efa27d
7 changed files with 155 additions and 47 deletions

View File

@ -12,7 +12,7 @@ services:
build:
dockerfile: Dockerfile
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:
infra_dev_net:
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_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_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_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_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_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_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_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_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_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_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_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_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_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

View File

@ -12,7 +12,7 @@
# LOG FILE
# 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!!!
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.
# You can specify individual object config files as shown below:
cfg_file=/opt/nagios/etc/objects/commands.cfg
cfg_file=/opt/nagios/etc/objects/contacts.cfg
cfg_file=/opt/nagios/etc/objects/timeperiods.cfg
cfg_file=/opt/nagios/etc/objects/templates.cfg
#cfg_file=/opt/nagios/etc/objects/000-commands.cfg
#cfg_file=/opt/nagios/etc/objects/contacts.cfg
#cfg_file=/opt/nagios/etc/objects/timeperiods.cfg
#cfg_file=/opt/nagios/etc/objects/001-templates.cfg
# Definitions for monitoring the local (Linux) host
cfg_file=/opt/nagios/etc/objects/localhost.cfg
cfg_file=/opt/nagios/etc/objects/docker-hosts.cfg
#cfg_file=/opt/nagios/etc/objects/localhost.cfg
#cfg_file=/opt/nagios/etc/objects/101-docker-hosts.cfg
# Definitions for monitoring a Windows machine
#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
# 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/printers
@ -61,7 +61,7 @@ cfg_file=/opt/nagios/etc/objects/docker-hosts.cfg
# OBJECT CACHE FILE
# 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
# directly) in order to prevent inconsistencies that can occur
# 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
# object definitions from this precached file, rather than the standard
# 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.
# Read the documentation section on optimizing Nagios to find our more
# about how this feature works.
@ -111,7 +111,7 @@ status_file=/opt/nagios/var/status.dat
# STATUS FILE UPDATE INTERVAL
# 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.
status_update_interval=10
@ -119,7 +119,7 @@ status_update_interval=10
# 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.
nagios_user=nagios
@ -127,7 +127,7 @@ nagios_user=nagios
# 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.
nagios_group=nagios
@ -150,7 +150,7 @@ check_external_commands=1
# This is the file that Nagios checks for external command requests.
# 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
# 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
# time its contents are processed.
@ -242,7 +242,7 @@ log_rotation_method=d
# 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).
log_archive_path=/opt/nagios/var/archives
@ -414,7 +414,7 @@ max_host_check_spread=30
# 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.
# Specifying a value of 1 for this variable essentially prevents
# any service checks from being parallelized. A value of 0
@ -436,7 +436,7 @@ check_result_reaper_frequency=10
# MAX CHECK RESULT REAPER TIME
# 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
# duties.
@ -450,7 +450,7 @@ max_check_result_reaper_time=30
# service checks that have not yet been processed.
#
# 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
@ -459,7 +459,7 @@ check_result_path=/opt/nagios/var/spool/checkresults
# MAX CHECK RESULT FILE AGE
# 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.
max_check_result_file_age=3600
@ -521,14 +521,14 @@ enable_predictive_service_dependency_checks=1
# SOFT STATE DEPENDENCIES
# This option determines whether or not Nagios will use soft state
# information when checking host and service dependencies. Normally
# Nagios will only use the latest hard host or service state when
# This option determines whether or not Nagios will use soft state
# information when checking host and service dependencies. Normally
# Nagios will only use the latest hard host or service state when
# 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:
# 0 = Don't use soft state dependencies (default)
# 1 = Use soft state dependencies
# 0 = Don't use soft state dependencies (default)
# 1 = Use soft state dependencies
soft_state_dependencies=0
@ -546,7 +546,7 @@ soft_state_dependencies=0
# This option determines whether or not Nagios will attempt to
# automatically reschedule active host and service checks to
# "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
# 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
# information for services and hosts before it shuts down. Upon
# 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
# slow Nagios down a bit when it (re)starts. Since its only
# a one-time penalty, I think its well worth the additional
@ -613,7 +613,7 @@ retain_state_information=1
# STATE RETENTION FILE
# 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
# starting to monitor the network when Nagios is restarted.
# This file is used only if the retain_state_information
@ -636,7 +636,7 @@ retention_update_interval=60
# 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
# retention file. If you want to use retained program status
# information, set this value to 1. If not, set this value
@ -663,7 +663,7 @@ use_retained_scheduling_info=1
# program restarts.
#
# 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
# of flap detection and event handlers for hosts to be retained, you
# 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
# 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
# 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.
check_for_updates=1
@ -716,10 +716,10 @@ check_for_updates=1
# BARE UPDATE CHECK
# 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
# 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.
bare_update_check=0
@ -739,7 +739,7 @@ use_aggressive_host_checking=0
# SERVICE CHECK EXECUTION OPTION
# 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
# receive and process passive check results that come in. Unless
# you're implementing redundant hosts or have a special need for
@ -761,7 +761,7 @@ accept_passive_service_checks=1
# HOST CHECK EXECUTION OPTION
# 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
# receive and process passive check results that come in. Unless
# 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
# performed. These commands are executed only if the
# 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
# more information on performance data.
@ -908,7 +908,7 @@ obsess_over_services=0
# OBSESSIVE COMPULSIVE SERVICE PROCESSOR COMMAND
# This is the command that is run for every service check that is
# 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
# define in your host configuration file. Read the HTML docs for
# more information on implementing distributed monitoring.
@ -932,7 +932,7 @@ obsess_over_hosts=0
# OBSESSIVE COMPULSIVE HOST PROCESSOR COMMAND
# This is the command that is run for every host check that is
# 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
# define in your host configuration file. Read the HTML docs for
# more information on implementing distributed monitoring.
@ -971,9 +971,9 @@ passive_host_checks_are_soft=0
# 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
# 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
# checks may never get rescheduled. A similar situation exists for
# host checks, although the exact scheduling details differ a bit
@ -1046,7 +1046,7 @@ date_format=iso8601
# the system configured timezone.
#
# 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:
#
# <Directory "/usr/local/nagios/sbin/">
@ -1101,7 +1101,7 @@ use_regexp_matching=0
# "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
# only has an effect if regular expression matching is enabled
# (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
# be written to the debug file. OR values together to log multiple
# types of information.
# Values:
# Values:
# -1 = Everything
# 0 = Nothing
# 1 = Functions

View File

@ -152,6 +152,11 @@ define command{
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
define command{
command_name check_ssh

View File

@ -12,3 +12,10 @@ define service{
service_description 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
## PI501
define service{
use local-service,graphed-service
host_name pi501.in.thelinuxpro.net
@ -42,6 +44,7 @@ define service{
host_name pi501.in.thelinuxpro.net
service_description Container Memory: ns1
check_command check_nrpe!check_docker_container_memory_ns1
register 0
}
define service{
@ -63,6 +66,7 @@ define service{
host_name pi501.in.thelinuxpro.net
service_description Container Memory: gitea
check_command check_nrpe!check_docker_container_memory_gitea
register 0
}
define service{
@ -84,6 +88,7 @@ define service{
host_name pi501.in.thelinuxpro.net
service_description Container Memory: gitea-db-1
check_command check_nrpe!check_docker_container_memory_gitea-db-1
register 0
}
define service{
@ -105,6 +110,7 @@ define service{
host_name pi501.in.thelinuxpro.net
service_description Container Memory: docker-registry1
check_command check_nrpe!check_docker_container_memory_docker-registry1
register 0
}
define service{
@ -126,6 +132,51 @@ define service{
host_name pi501.in.thelinuxpro.net
service_description 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{
@ -147,6 +198,7 @@ define service{
host_name pi501.in.thelinuxpro.net
service_description Container Memory: pihole1
check_command check_nrpe!check_docker_container_memory_pihole1
register 0
}
define service{
@ -168,6 +220,7 @@ define service{
host_name pi501.in.thelinuxpro.net
service_description Container Memory: kameronkenny_com_web1
check_command check_nrpe!check_docker_container_memory_kameronkenny_com_web1
register 0
}
define service{
@ -189,8 +242,24 @@ define service{
host_name pi501.in.thelinuxpro.net
service_description 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{
use local-service,graphed-service
host_name pi502.in.thelinuxpro.net
@ -210,6 +279,7 @@ define service{
host_name pi502.in.thelinuxpro.net
service_description Container Memory: ns2
check_command check_nrpe!check_docker_container_memory_ns2
register 0
}
define service{
@ -231,6 +301,7 @@ define service{
host_name pi502.in.thelinuxpro.net
service_description Container Memory: blackbox-exporter
check_command check_nrpe!check_docker_container_memory_blackbox-exporter
register 0
}
define service{
@ -252,6 +323,7 @@ define service{
host_name pi502.in.thelinuxpro.net
service_description Container Memory: grafana
check_command check_nrpe!check_docker_container_memory_grafana
register 0
}
define service{
@ -273,6 +345,7 @@ define service{
host_name pi502.in.thelinuxpro.net
service_description Container Memory: pihole-exporter
check_command check_nrpe!check_docker_container_memory_pihole-exporter
register 0
}
define service{
@ -294,6 +367,7 @@ define service{
host_name pi502.in.thelinuxpro.net
service_description Container Memory: unpoller
check_command check_nrpe!check_docker_container_memory_unpoller
register 0
}
define service{
@ -315,6 +389,7 @@ define service{
host_name pi502.in.thelinuxpro.net
service_description Container Memory: pihole2
check_command check_nrpe!check_docker_container_memory_pihole2
register 0
}
define service{
@ -336,6 +411,7 @@ define service{
host_name pi502.in.thelinuxpro.net
service_description Container Memory: prometheus
check_command check_nrpe!check_docker_container_memory_prometheus
register 0
}
define service{
@ -357,6 +433,7 @@ define service{
host_name pi502.in.thelinuxpro.net
service_description Container Memory: syslog-ng
check_command check_nrpe!check_docker_container_memory_syslog-ng
register 0
}
define service{
@ -378,6 +455,7 @@ define service{
host_name pi502.in.thelinuxpro.net
service_description Container Memory: telegraf
check_command check_nrpe!check_docker_container_memory_telegraf
register 0
}
define service{
@ -399,8 +477,10 @@ define service{
host_name pi502.in.thelinuxpro.net
service_description Container Memory: influxdb_telegraf-influxdb-1
check_command check_nrpe!check_docker_container_memory_influxdb_telegraf-influxdb-1
register 0
}
## PI503
define service{
use local-service,graphed-service
host_name pi503.in.thelinuxpro.net
@ -420,5 +500,6 @@ define service{
host_name pi503.in.thelinuxpro.net
service_description Container Memory: nagios
check_command check_nrpe!check_docker_container_memory_nagios
register 0
}

0
overlay/opt/nagios/libexec/check_ssl_certificate Normal file → Executable file
View File