Странное поведение неправильного пароля с криптодиском GRUB

Смещение NTP может быть получено с помощью следующего конвейера UNIX:

/usr/sbin/ntpq -pn | /usr/bin/awk 'BEGIN { offset=1000 } $1 ~ /^\*/ { offset=$9 } END { print offset }'

Число узлов NTP может быть получено с помощью следующего конвейера UNIX:

/usr/sbin/ntpq -pn | egrep -c '^\*|^\+'

Для ответвления NTP мы используем:

  • предупреждение> 250 мс
  • критическое> 500 мс

Для количества пиров NTP мы используем:

  • порог предупреждения нет
  • критический

Готовность к Zabbix-мониторингу NTP ( источник: Joyent):

# NTP
UserParameter=ntp.offset,/usr/sbin/ntpq -pn | /usr/bin/awk 'BEGIN { offset=1000 } $1 ~ /^\*/ { offset=$9 } END { print offset }'
UserParameter=ntp.peers,/usr/sbin/ntpq -pn | egrep -c '^\*|^\+'

Плагины мониторинга NTP, готовые к Nagios:

check_ntp_offset:

#!/bin/bash
# thresholds
thresh_warn=250
thresh_crit=500

# metric
ntp_offset=$(/usr/sbin/ntpq -pn | /usr/bin/awk 'BEGIN { offset=1000 } $1 ~ /^\*/ { offset=$9 } END { print offset }')

# Exit codes
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3

if [[ ! "$ntp_offset" =~ ^[0-9]+$ ]] ; then
   # NTP offset could not be read successfully
   echo "NTP OFFSET UNKNOWN - $ntp_offset"
   exit $STATE_UNKNOWN
elif [[ "$ntp_offset" -gt "$thresh_crit" ]] ; then
   # NTP offset is higher than the critical threshold
   echo "NTP OFFSET CRITICAL - ${ntp_offset}ms (> ${thresh_crit}ms)"
   exit $STATE_CRITICAL
elif [[ "$ntp_offset" -gt "$thresh_warn" ]] ; then
   # NTP offset is higher than the warning threshold
   echo "NTP OFFSET WARNING - ${ntp_offset}ms (> ${thresh_warn}ms)"
   exit $STATE_WARNING
else
   # NTP offset is within thresholds
   echo "NTP OFFSET OK - ${ntp_offset}ms (< ${thresh_warn}ms)"
   exit $STATE_OK
fi

check_ntp_peers:

#!/bin/bash
# thresholds
thresh_warn=1
thresh_crit=1

# metric
ntp_peers=$(/usr/sbin/ntpq -pn | egrep -c '^\*|^\+')

# Exit codes
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3

if [[ ! "$ntp_peers" =~ ^[0-9]+$ ]] ; then
   # NTP peers could not be read successfully
   echo "NTP PEERS UNKNOWN - $ntp_peers"
   exit $STATE_UNKNOWN
elif [[ "$ntp_peers" -lt "$thresh_crit" ]] ; then
   # NTP peers is lower than the critical threshold
   echo "NTP PEERS CRITICAL - $ntp_peers (< $thresh_crit)"
   exit $STATE_CRITICAL
elif [[ "$ntp_peers" -lt "$thresh_warn" ]] ; then
   # NTP peers is lower than the warning threshold
   echo "NTP PEERS WARNING - $ntp_peers (< $thresh_warn)"
   exit $STATE_WARNING
else
   # NTP peers is within thresholds
   echo "NTP PEERS OK - $ntp_peers (> $thresh_warn)"
   exit $STATE_OK
fi

Я действительно должен позволить настраивать предупреждения и критические пороги в сценариях Nagios с помощью -w и -c. Без этого они не могут быть полностью готовы к плагинам. Дальнейшие инструкции по этому поводу в учебнике здесь: http://www.kernel-panic.it/openbsd/nagios/nagios6.html

8
03.11.2016, 16:54
0 ответов

Теги

Похожие вопросы