Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration readability improvement, fix Vagrantfile and fix service watch #7

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

amontalban
Copy link

@amontalban amontalban commented Jan 26, 2017

Hey guys,

This PR address the following things:

  1. Improve configuration readability, before this PR with the pillar.example the configuration looked like:
# -*- coding: utf-8 -*-
# vim: ft=jinja
    
    
check process nginx with pidfile /var/run/nginx.pid
    
    
    
  group www
  start program = "/etc/init.d/nginx start"
  stop program = "/etc/init.d/nginx stop"
  if failed host 127.0.0.1 port 80 protocol http then restart
  
check process postfix with pidfile /var/spool/postfix/pid/master.pid
    
    
    
  group mail
  start program = "/etc/init.d/postfix start"
  stop program = "/etc/init.d/postfix stop"
  if failed port 25 protocol smtp then restart
  
check process cron with pidfile /var/run/cron.pid
    
    
  group system
  start program = "/etc/init.d/cron start"
  stop program = "/etc/init.d/cron stop"
  depends on cron_rc
  
    
    
check file cron_rc with path /etc/init.d/cron
    
    
    
    
    
  if failed checksum then unmonitor
  if failed permission 755 then unmonitor
  if failed uid root then unmonitor
  if failed gid root then unmonitor
  
check process gdm with pidfile /var/run/gdm.pid
    
    
  start program = "/etc/init.d/gdm start"
  stop program = "/etc/init.d/gdm stop"
  

Now it looks like:

# -*- coding: utf-8 -*-
# vim: ft=jinja
    
check process nginx with pidfile /var/run/nginx.pid
  group www
  start program = "/etc/init.d/nginx start"
  stop program = "/etc/init.d/nginx stop"
  if failed
    host 127.0.0.1 port 80 protocol http
  then restart
  
check process postfix with pidfile /var/spool/postfix/pid/master.pid
  group mail
  start program = "/etc/init.d/postfix start"
  stop program = "/etc/init.d/postfix stop"
  if failed
    port 25 protocol smtp
  then restart
  
check process cron with pidfile /var/run/cron.pid
  group system
  start program = "/etc/init.d/cron start"
  stop program = "/etc/init.d/cron stop"
  depends on cron_rc
  
    
check file cron_rc with path /etc/init.d/cron
  if failed
    checksum
  then unmonitor
  if failed
    permission 755
  then unmonitor
  if failed
    uid root
  then unmonitor
  if failed
    gid root
  then unmonitor
  
check process gdm with pidfile /var/run/gdm.pid
  start program = "/etc/init.d/gdm start"
  stop program = "/etc/init.d/gdm stop"
  1. Fix Vagrantfile to work and also allow to change pillar.example in the host and have it available in the VM. Additionally I used linked_clone to improve tear down/creation times.

  2. When the pillar don't include mail_alert setting the service failed to start due to the watch statement, so I did the other way around by using watch_in.

  3. Add support for FreeBSD.

  4. Allow to change other Monit settings like daemon interval or syslog. Also instead of passing the context to template files I import the map directly.

  5. Allow to configure the service status (In my use case I need the service to be enabled but not running).

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant