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

updates to the nagios_config role to facilitate a shared nagios server

parent 831915c4
No related branches found
No related tags found
1 merge request!50Nagios update
......@@ -27,8 +27,4 @@
sudo: true
notify: restart apache2
-
name: "Starting Apache2"
service: name=apache2 state=started enabled=yes
sudo: true
......@@ -30,3 +30,11 @@
name: "Change permissions for /var/www"
file: path=/var/www state=directory owner=root group={{ apache_user }} mode=0775
sudo: true
-
name: "Starting Apache2"
service: name=apache2 state=started enabled=yes
sudo: true
when: ansible_os_family=="Debian"
###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS
###############################################################################
################################################################################
# NOTIFICATION COMMANDS
################################################################################
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
#define command{
# command_name notify-service-by-email
# command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
# }
################################################################################
# HOST CHECK COMMANDS
################################################################################
# On Debian, check-host-alive is being defined from within the
# nagios-plugins-basic package
################################################################################
# PERFORMANCE DATA COMMANDS
################################################################################
# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/nagios3/host-perfdata.out
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/lib/nagios3/service-perfdata.out
}
---
- name: configure monitoring
template: src={{ item }}_nagios2.cfg.j2 dest=/etc/nagios3/conf.d/{{ item }}_nagios2.cfg
copy: src={{ item }}_nagios2.cfg dest=/etc/nagios3/conf.d/{{ item }}_nagios2.cfg
with_items:
- 'hostgroups'
- 'hosts'
......@@ -8,19 +8,26 @@
- 'services'
- 'contactgroup'
- 'contacts'
- 'generic-host'
- 'generic-service'
sudo: true
- name: remove unwanted configure files
file: path={{ item }}_nagios2.cfg.j2 state=absent
file: path=/etc/nagios3/conf.d/{{ item }}_nagios2.cfg state=absent
with_items:
- 'localhost'
- 'extinfo'
sudo: true
- name: change cgi config
template: src=cgi.cfg.j2 dest=/etc/nagios3/cgi.cfg
copy: src=cgi.cfg dest=/etc/nagios3/cgi.cfg
sudo: true
- name: change the default email command
copy: src=commands.cfg dest=/etc/nagios3/commands.cfg
become: true
become_user: root
- name: nagios restart
service: name=nagios3 state=restarted
sudo: true
......
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