evomaintenance: upstream release 22.07
This commit is contained in:
parent
a8c117146c
commit
0d086731ae
|
@ -14,6 +14,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
* evomaintenance: upstream release 22.07
|
||||||
* mongodb: replace version_compare() with version()
|
* mongodb: replace version_compare() with version()
|
||||||
* nagios-nrpe: exclude /run/shm and /run/lock from check_disk1
|
* nagios-nrpe: exclude /run/shm and /run/lock from check_disk1
|
||||||
* nagios-nrpe: check_disk1 returns only alerts
|
* nagios-nrpe: check_disk1 returns only alerts
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# Copyright 2007-2022 Evolix <info@evolix.fr>, Gregory Colpart <reg@evolix.fr>,
|
# Copyright 2007-2022 Evolix <info@evolix.fr>, Gregory Colpart <reg@evolix.fr>,
|
||||||
# Jérémy Lecour <jlecour@evolix.fr> and others.
|
# Jérémy Lecour <jlecour@evolix.fr> and others.
|
||||||
|
|
||||||
VERSION="22.01"
|
VERSION="22.07"
|
||||||
|
|
||||||
show_version() {
|
show_version() {
|
||||||
cat <<END
|
cat <<END
|
||||||
|
@ -47,6 +47,7 @@ Options
|
||||||
--no-evocheck disable evocheck execution
|
--no-evocheck disable evocheck execution
|
||||||
--auto use "auto" mode
|
--auto use "auto" mode
|
||||||
--no-auto use "manual" mode (default)
|
--no-auto use "manual" mode (default)
|
||||||
|
--autosysadmin author change as autosysadmin
|
||||||
-v, --verbose increase verbosity
|
-v, --verbose increase verbosity
|
||||||
-n, --dry-run actions are not executed
|
-n, --dry-run actions are not executed
|
||||||
--help print this message and exit
|
--help print this message and exit
|
||||||
|
@ -97,13 +98,22 @@ get_who() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_begin_date() {
|
get_begin_date() {
|
||||||
|
# XXX A begin date isn't applicable when used in autosysadmin, so we
|
||||||
|
# use the same date as the end date.
|
||||||
|
if is_autosysadmin; then
|
||||||
|
get_end_date
|
||||||
|
else
|
||||||
printf "%s %s" "$(date "+%Y")" "$(get_who | cut -d" " -f3,4,5)"
|
printf "%s %s" "$(date "+%Y")" "$(get_who | cut -d" " -f3,4,5)"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_ip() {
|
get_ip() {
|
||||||
ip=$(get_who | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
|
ip=$(get_who | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
|
||||||
[ -z "${ip}" ] && ip="unknown (no tty)"
|
if is_autosysadmin || [ "${ip}" = ":0" ]; then
|
||||||
[ "${ip}" = ":0" ] && ip="localhost"
|
ip="localhost"
|
||||||
|
elif [ -z "${ip}" ]; then
|
||||||
|
ip="unknown (no tty)"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "${ip}"
|
echo "${ip}"
|
||||||
}
|
}
|
||||||
|
@ -116,6 +126,14 @@ get_now() {
|
||||||
date +"%Y-%m-%dT%H:%M:%S%z"
|
date +"%Y-%m-%dT%H:%M:%S%z"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_user() {
|
||||||
|
if is_autosysadmin; then
|
||||||
|
echo autosysadmin
|
||||||
|
else
|
||||||
|
logname
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
get_complete_hostname() {
|
get_complete_hostname() {
|
||||||
REAL_HOSTNAME=$(get_fqdn)
|
REAL_HOSTNAME=$(get_fqdn)
|
||||||
if [ "${HOSTNAME}" = "${REAL_HOSTNAME}" ]; then
|
if [ "${HOSTNAME}" = "${REAL_HOSTNAME}" ]; then
|
||||||
|
@ -174,6 +192,10 @@ print_session_data() {
|
||||||
printf "Message : %s\n" "${MESSAGE}"
|
printf "Message : %s\n" "${MESSAGE}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_autosysadmin() {
|
||||||
|
test "${AUTOSYSADMIN}" -eq 1
|
||||||
|
}
|
||||||
|
|
||||||
is_repository_readonly() {
|
is_repository_readonly() {
|
||||||
if [ "$(get_system)" = "OpenBSD" ]; then
|
if [ "$(get_system)" = "OpenBSD" ]; then
|
||||||
partition=$(stat -f '%Sd' $1)
|
partition=$(stat -f '%Sd' $1)
|
||||||
|
@ -382,6 +404,7 @@ AUTO=${AUTO:-"0"}
|
||||||
EVOCHECK=${EVOCHECK:-"0"}
|
EVOCHECK=${EVOCHECK:-"0"}
|
||||||
GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20}
|
GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20}
|
||||||
API_ENDPOINT=${API_ENDPOINT:-""}
|
API_ENDPOINT=${API_ENDPOINT:-""}
|
||||||
|
AUTOSYSADMIN=${AUTOSYSADMIN:-0}
|
||||||
|
|
||||||
# initialize variables
|
# initialize variables
|
||||||
MESSAGE=""
|
MESSAGE=""
|
||||||
|
@ -497,7 +520,7 @@ HOSTNAME_TEXT=$(get_complete_hostname)
|
||||||
IP=$(get_ip)
|
IP=$(get_ip)
|
||||||
BEGIN_DATE=$(get_begin_date)
|
BEGIN_DATE=$(get_begin_date)
|
||||||
END_DATE=$(get_end_date)
|
END_DATE=$(get_end_date)
|
||||||
USER=$(logname)
|
USER=$(get_user)
|
||||||
|
|
||||||
PATH=${PATH}:/usr/sbin
|
PATH=${PATH}:/usr/sbin
|
||||||
|
|
||||||
|
@ -536,6 +559,11 @@ EVOCHECK_BIN="/usr/share/scripts/evocheck.sh"
|
||||||
|
|
||||||
GIT_REPOSITORIES="/etc /etc/bind /usr/share/scripts"
|
GIT_REPOSITORIES="/etc /etc/bind /usr/share/scripts"
|
||||||
|
|
||||||
|
# Add /etc directories from lxc containers if they are git directories
|
||||||
|
if [ -d /var/lib/lxc ]; then
|
||||||
|
GIT_REPOSITORIES="${GIT_REPOSITORIES} $(find /var/lib/lxc/ -maxdepth 3 -name 'etc' | tr '\n' ' ' | sed 's/[[:space:]]\+$//')"
|
||||||
|
fi
|
||||||
|
|
||||||
# initialize variable
|
# initialize variable
|
||||||
GIT_STATUSES=""
|
GIT_STATUSES=""
|
||||||
# git statuses
|
# git statuses
|
||||||
|
|
Loading…
Reference in a new issue