bundles: fix some icinga checks

This commit is contained in:
Franzi 2020-11-21 10:30:05 +01:00
parent 11071914e0
commit 5419bf31fb
Signed by: kunsi
GPG key ID: 12E3D2136B818350
6 changed files with 17 additions and 6 deletions

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
statusfile=/var/tmp/unattended_upgrades.status statusfile="/var/tmp/unattended_upgrades.status"
if ! [[ -f "$statusfile" ]] if ! [[ -f "$statusfile" ]]
then then
echo "Status file not found" echo "Status file not found"

View file

@ -16,7 +16,7 @@ then
fi fi
fi fi
statusfile=/var/tmp/unattended_upgrades.status statusfile="/var/tmp/unattended_upgrades.status"
# Workaround, because /var/tmp is usually 1777 # Workaround, because /var/tmp is usually 1777
[[ "$UID" == 0 ]] && chown root:root "$statusfile" [[ "$UID" == 0 ]] && chown root:root "$statusfile"

View file

@ -96,11 +96,16 @@ def monitoring(metadata):
for vname, vconfig in metadata.get('nginx/vhosts', {}).items(): for vname, vconfig in metadata.get('nginx/vhosts', {}).items():
domain = vconfig.get('domain', vname) domain = vconfig.get('domain', vname)
if metadata.get('nginx/use_ssl_for_all_connections'):
scheme = 'https'
else:
scheme = 'http'
if 'website_check_path' in vconfig and 'website_check_string' in vconfig: if 'website_check_path' in vconfig and 'website_check_string' in vconfig:
services['NGINX VHOST {} CONTENT'.format(vname)] = { services['NGINX VHOST {} CONTENT'.format(vname)] = {
'check_command': 'check_http_wget', 'check_command': 'check_http_wget',
'vars.http_wget_contains': vconfig['website_check_string'], 'vars.http_wget_contains': vconfig['website_check_string'],
'vars.http_wget_url': '{}{}'.format(domain, vconfig['website_check_path']), 'vars.http_wget_url': '{}://{}{}'.format(scheme, domain, vconfig['website_check_path']),
} }
if vconfig.get('check_ssl', False): if vconfig.get('check_ssl', False):

View file

@ -42,7 +42,8 @@ else:
}) })
@metadata_reactor # FIXME find a working, non-shitty check for that
#@metadata_reactor
def fill_icinga_spam_blocklist_check_with_hostname(metadata): def fill_icinga_spam_blocklist_check_with_hostname(metadata):
checks = {} checks = {}

View file

@ -8,6 +8,11 @@ with open(join(repo.path, 'data', 'sshmon', 'sshmon.pub'), 'r') as fp:
pubkey = fp.read().strip() pubkey = fp.read().strip()
defaults = { defaults = {
'apt': {
'packages': {
'python3-requests': {},
},
},
'icinga2_api': { 'icinga2_api': {
'basic': { 'basic': {
'services': { 'services': {

View file

@ -72,10 +72,10 @@ if node.has_bundle('sshmon'):
'zfs': { 'zfs': {
'services': { 'services': {
'ZFS AUTO SNAPSHOT': { 'ZFS AUTO SNAPSHOT': {
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_zfs_auto_snapshot', 'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zfs_auto_snapshot',
}, },
'ZFS MOUNTED VOLUMES': { 'ZFS MOUNTED VOLUMES': {
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_zfs_volumes', 'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zfs_volumes',
}, },
'ZFS OLD SNAPSHOTS': { 'ZFS OLD SNAPSHOTS': {
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zfs_old_snapshots', 'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_zfs_old_snapshots',