saltstack / saltstack/salt

Monit summary command no longer works with newer version of monit

Open
#54,753 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Confirmed severity-high
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

Monit has upgraded the output of the summary command to present a new table. I can't remember what it looked like before, but I believe it was a much simpler text output (there certainly wasn't a drawn table).

This appears to have broken the Salt monit summary command.

Setup

I don't believe any custom setup is required other than Monit to be installed. The version I have is 5.26.0. I'm afraid I don't know which version triggered the change, other than it appears to be between version 5.2.5 (which comes with Amazon Linux V1 base AMI) and 5.26.0 which is the latest.

Steps to Reproduce Issue

Here's the output of running monit summary on the machine, not via Salt:

[root@hostname ~]# monit summary
Monit 5.26.0 uptime: 9d 5h 12m
┌─────────────────────────────────┬────────────────────────────┬───────────────┐
│ Service Name                    │ Status                     │ Type          │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ hostname goes here    ...       │ OK                         │ System        │
├─────────────────────────────────┼────────────────────────────┼───────────────┤
│ rootfs_inodes                   │ OK                         │ Filesystem    │
└─────────────────────────────────┴────────────────────────────┴───────────────┘

And here's the output of running it via Salt:

[root@hostname ~]# salt 'hostname' monit.summary
hostname:
    ----------

It can still be run manually, but the command is a bit more of a mouthful:

[root@hostname ~]# salt 'hostname' cmd.run "monit summary"
hostname:
    Monit 5.26.0 uptime: 9d 5h 12m
     Service Name                     Status                      Type
     hostname...                      OK                          System
     rootfs_inodes                    OK                          Filesystem

This seems to be the relevant culprit:
https://github.com/saltstack/salt/blob/a606177f0bdd39c0736e65e60a75156b82b0163d/salt/modules/monit.py#L102-L132

Specifically:
https://github.com/saltstack/salt/blob/develop/salt/modules/monit.py#L122-L131

Versions Report
Salt Version:
           Salt: 2019.2.0

Dependency Versions:
           cffi: 1.10.0
       cherrypy: Not Installed
       dateutil: 2.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: 0.26.0
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.18
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.3
         Python: 2.7.16 (default, Jul 19 2019, 22:59:28)
   python-gnupg: 0.4.1
         PyYAML: 3.10
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist:
         locale: UTF-8
        machine: x86_64
        release: 4.14.138-89.102.amzn1.x86_64
         system: Linux
        version: Not Installed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in salt/modules/monit.py around lines 102-132, especially 122-131, and reproduce monit.summary with Monit 5.26.0. Trace how the new table output is processed and verify that Salt returns the summary rather than an empty result; done means the command works with the newer output format.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.