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

Add postfix, re-create a new nagios server and further fix other issues

parent 7a282b74
No related branches found
No related tags found
1 merge request!17Add postfix, re-create a new nagios server and further fix other issues
Showing with 159 additions and 4 deletions
...@@ -10,6 +10,13 @@ ...@@ -10,6 +10,13 @@
- 'contacts' - 'contacts'
sudo: true sudo: true
- name: remove unwanted configure files
file: path={{ item }}_nagios2.cfg.j2 state=absent
with_items:
- 'localhost'
- 'extinfo'
sudo: true
- name: change cgi config - name: change cgi config
template: src=cgi.cfg.j2 dest=/etc/nagios3/cgi.cfg template: src=cgi.cfg.j2 dest=/etc/nagios3/cgi.cfg
sudo: true sudo: true
......
# Some generic hostgroup definitions # Some generic hostgroup definitions
{% for group in groups %} {% for group in groups %}
{% if group != "ungrouped" %}
{% set nodelist = [] %} {% set nodelist = [] %}
{% for node in groups[group] %} {% for node in groups[group] %}
{% if nodelist.append(node) %} {% if nodelist.append(node) %}
...@@ -10,4 +11,5 @@ define hostgroup { ...@@ -10,4 +11,5 @@ define hostgroup {
hostgroup_name {{ group }} hostgroup_name {{ group }}
members {{ nodelist|unique|join(',') }} members {{ nodelist|unique|join(',') }}
} }
{% endif %}
{% endfor %} {% endfor %}
#!/usr/bin/python
import sys, os, pwd
import getopt
import commands
import subprocess
STATE_OK=0
STATE_WARNING=1
check_apache=subprocess.Popen("service apache2 status", shell=True, stdout=subprocess.PIPE)
apache_status=check_apache.communicate()[0]
if "run" in apache_status:
print "Apache is Running"
sys.exit(STATE_OK)
else:
print "Apache is NOT Running !!"
sys.exit(STATE_WARNING)
sys.exit(STATE_OK)
...@@ -12,9 +12,14 @@ function check_disk() { ...@@ -12,9 +12,14 @@ function check_disk() {
local space="$1" local space="$1"
local used=$(df -h ${space} | grep "^/" | awk '{print $5}' | sed -e 's/%//') local used=$(df -h ${space} | grep "^/" | awk '{print $5}' | sed -e 's/%//')
local threshhold=$((90)) local critical_threshhold=$((90))
local warning_threshhold=$((80))
if (( ${used} > ${threshhold} )); then if (( ${used} > ${critical_threshhold} )); then
echo "CRITICAL: ${HOST_NAME} is running out of filesystem space"
exit "${STATE_CRITICAL}"
fi
if (( ${used} > ${warning_threshhold} )); then
echo "WARNING: ${HOST_NAME} is running out of filesystem space" echo "WARNING: ${HOST_NAME} is running out of filesystem space"
exit "${STATE_WARNING}" exit "${STATE_WARNING}"
fi fi
......
#!/usr/bin/python
import sys, os, pwd
import getopt
import commands
import subprocess
STATE_OK=0
STATE_WARNING=1
check_ldap=subprocess.Popen("service slapd status", shell=True, stdout=subprocess.PIPE)
ldap_status=check_ldap.communicate()[0]
if "run" in ldap_status:
print "Ldap is Running"
sys.exit(STATE_OK)
else:
print "Ldap is NOT Running !!"
sys.exit(STATE_WARNING)
sys.exit(STATE_OK)
#!/bin/bash
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
function main () {
id chines
local r=$?
if [ ${r} -ne 0 ]; then
echo "Broken LDAP authentication"
return $STATE_CRITICAL
fi
echo "LDAP authentication OK"
return $STATE_OK
}
main
exit $?
No preview for this file type
#!/usr/bin/python
import sys, os, pwd
import getopt
import commands
import subprocess
STATE_OK=0
STATE_WARNING=1
check_mysql=subprocess.Popen("service mysqld status", shell=True, stdout=subprocess.PIPE)
mysql_status=check_mysql.communicate()[0]
if "run" in mysql_status:
print "Mysql is Running"
sys.exit(STATE_OK)
else:
print "Mysql is NOT Running !!"
sys.exit(STATE_WARNING)
sys.exit(STATE_OK)
#!/usr/bin/python
import sys, os, pwd
import getopt
import commands
import subprocess
STATE_OK=0
STATE_WARNING=1
check_slurm=subprocess.Popen("service slurm status", shell=True, stdout=subprocess.PIPE)
slurm_status=check_slurm.communicate()[0]
if "run" in slurm_status:
print "Slurm is Running"
sys.exit(STATE_OK)
else:
print "Slurm is NOT Running !!"
sys.exit(STATE_WARNING)
sys.exit(STATE_OK)
#!/usr/bin/python
import sys, os, pwd
import getopt
import commands
import subprocess
STATE_OK=0
STATE_WARNING=1
check_slurmdbd=subprocess.Popen("service slurmdbd status", shell=True, stdout=subprocess.PIPE)
slurmdbd_status=check_slurmdbd.communicate()[0]
if "run" in slurmdbd_status:
print "Slurmdbd is Running"
sys.exit(STATE_OK)
else:
print "Slurmdbd is NOT Running !!"
sys.exit(STATE_WARNING)
sys.exit(STATE_OK)
...@@ -3,12 +3,16 @@ ...@@ -3,12 +3,16 @@
user: name=nagios system=yes createhome=yes home={{ nagios_home }} shell=/bin/bash user: name=nagios system=yes createhome=yes home={{ nagios_home }} shell=/bin/bash
sudo: true sudo: true
- name: create ssh directory
file: path={{ nagios_home }}/.ssh state=directory owner=nagios mode=700
sudo: true
- name: authorize_key - name: authorize_key
authorized_key: user=nagios key="{{ lookup('file', 'files/nagios_public_key') }}" path="{{ nagios_home }}"/.ssh/authorized_keys authorized_key: user=nagios key="{{ lookup('file', 'files/nagios_public_key') }}" path="{{ nagios_home }}/.ssh/authorized_keys"
sudo: true sudo: true
- name: make scripts directory - name: make scripts directory
file: path=/var/lib/nagios/scripts state=directory owner=nagios mode=755 file: path={{ nagios_home }}/scripts state=directory owner=nagios mode=755
sudo: true sudo: true
- name: install monitor scripts - name: install monitor scripts
......
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