nagios: Split AWS and non-AWS hosts, for ntp checks.

The non-AWS hosts cannot use the AWS ntp server for their check.
This commit is contained in:
Alex Vandiver 2022-06-13 14:56:59 -07:00 committed by Alex Vandiver
parent 872efdee58
commit c74f195fba
4 changed files with 33 additions and 14 deletions

View File

@ -82,7 +82,7 @@ define command{
define command{
command_name check_ntp_time
command_line /usr/lib/nagios/plugins/check_by_ssh -p $ARG1$ -l nagios -t 30 -i /var/lib/nagios/.ssh/id_ed25519 -H $HOSTADDRESS$ -C '/usr/lib/nagios/plugins/check_ntp_time -H 169.254.169.123 -w .5 -c 1'
command_line /usr/lib/nagios/plugins/check_by_ssh -p $ARG1$ -l nagios -t 30 -i /var/lib/nagios/.ssh/id_ed25519 -H $HOSTADDRESS$ -C '/usr/lib/nagios/plugins/check_ntp_time -H $ARG2$ -w .5 -c 1'
}
define command{

View File

@ -5,6 +5,16 @@ define hostgroup {
members *
}
define hostgroup {
hostgroup_name aws_host
alias Hosts in AWS
}
define hostgroup {
hostgroup_name non_aws_host
alias Hosts not in AWS
}
define hostgroup {
hostgroup_name pageable_servers
alias Servers for whom we want to page

View File

@ -127,10 +127,19 @@ define service {
define service {
use generic-service
service_description Check NTP time
check_command check_ntp_time!22
service_description Check AWS NTP time
check_command check_ntp_time!22!169.254.169.123
max_check_attempts 3
hostgroup_name all
hostgroup_name aws_host
contact_groups admins
}
define service {
use generic-service
service_description Check non-AWS NTP time
check_command check_ntp_time!22!pool.ntp.org
max_check_attempts 5
hostgroup_name non_aws_host
contact_groups admins
}

View File

@ -4,7 +4,7 @@ define host{
host_name <%= host %>
alias <%= host %>
address <%= host %>.<%= @default_host_domain %>
hostgroups all,web,frontends,prod_frontends,pageable_servers
hostgroups all,aws_host,web,frontends,prod_frontends,pageable_servers
}
<% end -%>
@ -14,7 +14,7 @@ define host{
host_name <%= host %>
alias <%= host %>
address <%= host %>
hostgroups all,web,frontends,staging_frontends,not_pageable_servers,postgresql,postgresql_primary
hostgroups all,non_aws_host,web,frontends,staging_frontends,not_pageable_servers,postgresql,postgresql_primary
}
<% end -%>
@ -24,7 +24,7 @@ define host{
host_name <%= host %>
alias <%= host %>
address <%= host %>.<%= @default_host_domain %>
hostgroups all,web,frontends,staging_frontends,not_pageable_servers
hostgroups all,aws_host,web,frontends,staging_frontends,not_pageable_servers
}
<% end -%>
@ -34,7 +34,7 @@ define host{
host_name <%= host %>
alias <%= host %>
address <%= host %>.<%= @default_host_domain %>
hostgroups all,zmirror,zmirror_main
hostgroups all,non_aws_host,zmirror,zmirror_main
}
<% end -%>
@ -44,7 +44,7 @@ define host{
host_name <%= host %>
alias <%= host %>
address <%= host %>.<%= @default_host_domain %>
hostgroups all,zmirror,zmirrorp
hostgroups all,non_aws_host,zmirror,zmirrorp
}
<% end -%>
@ -54,7 +54,7 @@ define host{
host_name <%= host %>
alias <%= host %>
address <%= host %>.<%= @default_host_domain %>
hostgroups all,postgresql,postgresql_primary,pageable_servers
hostgroups all,aws_host,postgresql,postgresql_primary,pageable_servers
}
<% end -%>
@ -64,7 +64,7 @@ define host{
host_name <%= host %>
alias <%= host %>
address <%= host %>.<%= @default_host_domain %>
hostgroups all,postgresql,pageable_servers
hostgroups all,aws_host,postgresql,pageable_servers
}
<% end -%>
@ -74,7 +74,7 @@ define host{
host_name <%= host %>
alias <%= host %>
address <%= host %>.<%= @default_host_domain %>
hostgroups all,not_pageable_servers
hostgroups all,aws_host,not_pageable_servers
}
<% end -%>
@ -84,7 +84,7 @@ define host{
host_name <%= host %>
alias <%= host %>
address <%= host %>.<%= @default_host_domain %>
hostgroups all,not_pageable_servers, redis
hostgroups all,aws_host,not_pageable_servers, redis
}
<% end -%>
@ -94,6 +94,6 @@ define host{
host_name <%= host %>
alias <%= host %>
address <%= host %>.<%= @default_host_domain %>
hostgroups all,pageable_servers,smokescreen
hostgroups all,aws_host,pageable_servers,smokescreen
}
<% end -%>