Skip to content
Snippets Groups Projects
Commit 25ff3b55 authored by Chris Hines's avatar Chris Hines
Browse files

branch nhc out of slurm-common into its own role

parent 9d6f1c27
No related branches found
No related tags found
1 merge request!51branch nhc out of slurm-common into its own role
...@@ -39,10 +39,6 @@ ...@@ -39,10 +39,6 @@
template: dest=/etc/sysconfig/nhc src=nhc.sysconfig.j2 mode=644 template: dest=/etc/sysconfig/nhc src=nhc.sysconfig.j2 mode=644
sudo: true sudo: true
- name: copy cron script
template: dest={{ nhc_dir }}/sbin/nhc_cron src=nhc_cron.j2 mode=755
sudo: true
- name: copy nhc log rotate script - name: copy nhc log rotate script
template: dest=/etc/logrotate.d/nhc src=nhclog.j2 mode=644 template: dest=/etc/logrotate.d/nhc src=nhclog.j2 mode=644
sudo: true sudo: true
...@@ -51,3 +47,8 @@ ...@@ -51,3 +47,8 @@
copy: src=nhc.conf dest={{ nhc_dir }}/etc/nhc/{{ nhc_config_file }} copy: src=nhc.conf dest={{ nhc_dir }}/etc/nhc/{{ nhc_config_file }}
become: true become: true
become_user: root become_user: root
- name: install nhc scripts
copy: src=scripts/ dest={{ nhc_dir }}/etc/nhc/
become: true
become_user: root
...@@ -170,5 +170,4 @@ ...@@ -170,5 +170,4 @@
when: slurm_lua is defined when: slurm_lua is defined
- include: installCgroup.yml - include: installCgroup.yml
- include: installNhc.yml
#!/bin/bash
error=""
state_change="1"
current_state="0"
previous_state="0"
[ -e /etc/sysconfig/nhc ] && . /etc/sysconfig/nhc
config_file=${CONFFILE-/etc/nhc/nhc.conf}
loop=${NHC_LOOP_TIME-300}
email_subject=${NHC_EMAIL_SUBJECT-notification}
logfile=${LOGFILE-/var/log/nhc.log}
loglevel=${LOG_LEVEL-0}
email_to=${NHC_EMAIL_TO-root}
function log() {
message="$1"
echo "$(date): ${message}" >> ${logfile}
}
function email() {
post=$(cat /root/nhc_cron_sendemail.txt)
if [ -z "${post}" ]; then
message=$(cat /root/nhc.log)
echo "${message}" | mail -s "${email_subject}" "${email_to}"
log "Node error, send email to ${email_to}"
echo "1" >| /root/nhc_cron_sendemail.txt
fi
}
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; }
echo -n "" >| /root/nhc_cron_sendemail.txt
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