Skip to content
Snippets Groups Projects
Commit 3998a076 authored by Jupiter Hu's avatar Jupiter Hu
Browse files

Added nhc log level

parent 2e621ad6
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ NHC_RM=slurm ...@@ -3,6 +3,7 @@ NHC_RM=slurm
HELPERDIR={{ nhc_dir }}/libexec/nhc HELPERDIR={{ nhc_dir }}/libexec/nhc
PATH={{ slurm_dir }}/bin:{{ nhc_dir }}/sbin:$PATH PATH={{ slurm_dir }}/bin:{{ nhc_dir }}/sbin:$PATH
LOGFILE=/var/log/nhc.log LOGFILE=/var/log/nhc.log
LOG_LEVEL={{ nhc_log_level }}
CONFFILE="{{ nhc_dir }}/etc/nhc/{{ nhc_config_file }}" CONFFILE="{{ nhc_dir }}/etc/nhc/{{ nhc_config_file }}"
NHC_EMAIL_TO= {{ nhc_emails }} NHC_EMAIL_TO= {{ nhc_emails }}
NHC_EMAIL_SUBJECT="Node failure" NHC_EMAIL_SUBJECT="Node failure"
......
...@@ -10,6 +10,7 @@ config_file=${CONFFILE-/etc/nhc/nhc.conf} ...@@ -10,6 +10,7 @@ config_file=${CONFFILE-/etc/nhc/nhc.conf}
loop=${NHC_LOOP_TIME-300} loop=${NHC_LOOP_TIME-300}
email_subject=${NHC_EMAIL_SUBJECT-notification} email_subject=${NHC_EMAIL_SUBJECT-notification}
logfile=${LOGFILE-/var/log/nhc.log} logfile=${LOGFILE-/var/log/nhc.log}
loglevel=${LOG_LEVEL-0}
email_to=${NHC_EMAIL_TO-root} email_to=${NHC_EMAIL_TO-root}
function log() { function log() {
...@@ -27,7 +28,9 @@ function email() { ...@@ -27,7 +28,9 @@ function email() {
fi fi
} }
log "Start health check ${config_file}" if [ ${loglevel} -gt "0" ]; then
log "Start health check ${config_file}"
fi
nhc -c "${config_file}" > /root/nhc.log 2>&1 || { log "$(cat /root/nhc.log)" && email && exit 1; } nhc -c "${config_file}" > /root/nhc.log 2>&1 || { log "$(cat /root/nhc.log)" && email && exit 1; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment