ossobv / vcutil

Misc. simple utilities to aid version control and host maintenance.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RFE for psdiff - support subdirectories for config files

vilitux opened this issue · comments

To easily manage multiple pieces of config, it would be nice to support multiple configuration files under a directory instead of a single config file (/etc/psdiff.conf). Example:

$ ls -l /etc/psdiff.conf.d/
-rw-r--r-- 1 root root 0 sep 27 14:43 docker.conf
-rw-r--r-- 1 root root 0 sep 27 14:43 tetris.conf
-rw-r--r-- 1 root root 0 sep 27 14:43 zabbix.conf

Fixed in 4abe57a

# cat /etc/psdiff.d/kvm.py

class ProcessFormatterMixin(object):
    def adjust(self, process):
        super(ProcessFormatterMixin, self).adjust(process)

        # For kvm, show only "/usr/bin/kvm -id X -name Y".
        if process.cmdline.startswith('/usr/bin/kvm '):
            p = process.cmdline.split()
            new = [p[0]]
            [new.extend(p[i:i+2])
             for i, j in enumerate(p)
             if j.startswith(('-id', '-name'))]
            process.cmdline = ' '.join(new)

If the psdiff.conf is removed.