Skip to content

Wrong order of lines in /etc/monit/monit.d/modules  #4

@arthurzenika

Description

@arthurzenika
# salt-call pillar.get monit
[snip]
        "modules": {
            "salt-minion": {
                "process": {
                    "config": {
                        "start": "service salt-minion start", 
                        "stop": "service salt-minion stop"
                    }, 
                    "with": {
                        "pidfile": "/var/run/salt-minion.pid"
                    }, 
                    "custom": {
                        "name": "salt-minion"
                    }
                }
            }, 
            "nginx": {
                "process": {
                    "config": {
                        "stop": "service nginx stop", 
                        "start": "service nginx start", 
                        "group": "www-data"
                    }, 
                    "if": {
                        "action": "restart", 
                        "failed": "host 127.0.0.1 port 80 protocol http"
                    }, 
                    "with": {
                        "pidfile": "/var/run/nginx.pid"
                    }, 
                    "custom": {
                        "name": "nginx"
                    }
                }
            }, 
            "varnish": {
                "process": {
                    "config": {
                        "start": "service varnish start", 
                        "stop": "service varnish stop"
                    }, 
                    "if": {
                        "action": "restart", 
                        "failed": "host 127.0.0.1 port 6081 protocol http"
                    }, 
                    "with": {
                        "pidfile": "/var/run/varnish.pid"
                    }, 
                    "if2": {
                        "action": "restart", 
                        "failed": "host 127.0.0.1 port 6082 protocol http"
                    }, 
                    "custom": {
                        "name": "varnish"
                    }
                }
            }
        }

Gives the following config, the order is wrong

# cat conf.d/modules 
# -*- coding: utf-8 -*-
# vim: ft=jinja
    
  start program = "service salt-minion start"
  stop program = "service salt-minion stop"
check process salt-minion with pidfile /var/run/salt-minion.pid
  
    
  stop program = "service nginx stop"
  start program = "service nginx start"
  group www-data
  if failed host 127.0.0.1 port 80 protocol http then restart
check process nginx with pidfile /var/run/nginx.pid
  
    
  start program = "service varnish start"
  stop program = "service varnish stop"
  if failed host 127.0.0.1 port 6081 protocol http then restart
check process varnish with pidfile /var/run/varnish.pid
  if failed host 127.0.0.1 port 6082 protocol http then restart
  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions