{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/49480","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/49480/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/49480/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/49480/events","html_url":"https://github.com/saltstack/salt/pull/49480","id":356215739,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyNTU0MzM1","number":49480,"title":"Salt-based supportconfig","user":{"login":"isbm","id":1073714,"node_id":"MDQ6VXNlcjEwNzM3MTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1073714?v=4","gravatar_id":"","url":"https://api.github.com/users/isbm","html_url":"https://github.com/isbm","followers_url":"https://api.github.com/users/isbm/followers","following_url":"https://api.github.com/users/isbm/following{/other_user}","gists_url":"https://api.github.com/users/isbm/gists{/gist_id}","starred_url":"https://api.github.com/users/isbm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isbm/subscriptions","organizations_url":"https://api.github.com/users/isbm/orgs","repos_url":"https://api.github.com/users/isbm/repos","events_url":"https://api.github.com/users/isbm/events{/privacy}","received_events_url":"https://api.github.com/users/isbm/received_events","type":"User","site_admin":false},"labels":[{"id":189581795,"node_id":"MDU6TGFiZWwxODk1ODE3OTU=","url":"https://api.github.com/repos/saltstack/salt/labels/Awesome","name":"Awesome","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-09-01T16:37:19Z","updated_at":"2018-09-03T14:39:02Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/saltstack/salt/pulls/49480","html_url":"https://github.com/saltstack/salt/pull/49480","diff_url":"https://github.com/saltstack/salt/pull/49480.diff","patch_url":"https://github.com/saltstack/salt/pull/49480.patch"},"body":"### What does this PR do?\r\n\r\nRe-implementation of [Support Config Tool](https://www.suse.com/c/free_tools/supportconfig-linux/) in Salt.\r\n\r\n### What is this?\r\n\r\nOver many years SUSE is using Support Config Tool [to collect system information] (https://www.suse.com/documentation/sled11/book_sle_admin/data/sec_admsupport_supportconfig.html) in order to provide detailed information of a running system to technical support. However, given on its age and therefore design, this tool has a number of limitations that would be nice to do not have.\r\n\r\nImagine, you want to know why one of your supported applications on some machine doesn't work. But you already have Salt running there. Would it be cool to run your crafted (or standard) state-like YAML scenario and then get all the needed data about broken component?\r\n\r\n### Support Scenarios vs States\r\n\r\nSupport Scenario very much looks like orchestration. However, it is not an orchestration on its own. Salt state files (SLS) gets parsed when Salt is already running. That said, Salt is parsing, compiling, injecting required variables etc and then running them. Support Scenario, however, needs to be parsed and compiled _beforehand_ Salt is even running. Additionally, Support Scenario runs a mix of runners and modules.\r\n\r\n### Overview\r\n\r\nSalt Support is implemented on top of Salt as a platform and thus comes with its own CLI command, called `salt-support`. Once installed, you will find it along with `salt`, `salt-key`, `salt-minion` or `salt-master` etc commands. Naturally, it inherits most of the Salt typical features: debugging interface `-l <level>` and other that you already know:\r\n\r\n```\r\n$ salt-support --help\r\n\r\nSalt Support is a program to collect all support data: logs, system\r\nconfiguration etc.\r\n\r\nOptions:\r\n  --version             show program's version number and exit\r\n  -V, --versions-report\r\n                        Show program's dependencies version number and exit.\r\n  -h, --help            show this help message and exit\r\n  -c CONFIG_DIR, --config-dir=CONFIG_DIR\r\n                        Pass in an alternative configuration directory.\r\n                        Default: '/etc/salt'.\r\n  -t TIMEOUT, --timeout=TIMEOUT\r\n                        Change the timeout, if applicable, for the running\r\n                        command (in seconds). Default: 5.\r\n  -P, --show-profiles   Show available profiles\r\n  -p SUPPORT_PROFILE, --profile=SUPPORT_PROFILE\r\n                        Specify support profile or comma-separated profiles,\r\n                        e.g.: \"salt,network\"\r\n  -a SUPPORT_ARCHIVE, --archive=SUPPORT_ARCHIVE\r\n                        Specify name of the resulting support archive. Default\r\n                        is \"/tmp/zeus-support.tar.bz2\".\r\n  -u SUPPORT_UNIT, --unit=SUPPORT_UNIT\r\n                        Specify examined unit (default \"master\").\r\n  -U, --show-units      Show available units\r\n  -f, --force           Force overwrite existing archive, if exists\r\n  -o SUPPORT_OUTPUT_FORMAT, --out=SUPPORT_OUTPUT_FORMAT\r\n                        Set the default output using the specified outputter,\r\n                        unless profile does not overrides this. Default:\r\n                        \"yaml\".\r\n\r\n  Logging Options:\r\n    Logging options which override any settings defined on the\r\n    configuration files.\r\n\r\n    -l LOG_LEVEL, --log-level=LOG_LEVEL\r\n                        Console logging log level. One of 'all', 'garbage',\r\n                        'trace', 'debug', 'profile', 'info', 'warning',\r\n                        'error', 'critical', 'quiet'. Default: 'warning'.\r\n    --log-file=LOG_FILE\r\n                        Log file path. Default: '/var/log/salt/master'.\r\n    --log-file-level=LOG_LEVEL_LOGFILE\r\n                        Logfile logging log level. One of 'all', 'garbage',\r\n                        'trace', 'debug', 'profile', 'info', 'warning',\r\n                        'error', 'critical', 'quiet'. Default: 'warning'.\r\n\r\nYou can find additional help about salt-support issuing \"man salt-support\" or\r\non http://docs.saltstack.com\r\n```\r\n\r\n### Typical Usage\r\n\r\nBy default, `salt-support` is acting as it being a Minion. So the usage is following:\r\n\r\n1. Login to your broken machine:\r\n    `ssh yourmachine`\r\n\r\n2. In case you want other profile than default, list available profiles:\r\n    `salt-support -P`\r\n```\r\nList of available profiles:\r\n  1. default\r\n  2. flt\r\n  3. jobs-active\r\n  4. jobs-last\r\n  5. jobs-trace\r\n  6. network\r\n  7. postgres\r\n  8. salt\r\n  9. users\r\n```\r\n\r\n3. Run it:\r\n    `salt-support`\r\n\r\nAt this point it will collect all the data of the machine, such as system info, its health, disks status, network layout, users, system logs, actual minion configuration, pillars, highstate etc and it will put into an archive in `/tmp/yourhost-support.tar.bz2` file. Now you can send this archive to your technical support. :sunglasses: \r\n\r\n### What happens if I run it?\r\n\r\nEssentially, Support Profile will just call _any_ module or useful runner or useful utility in your battery-included Salt in any combination you want and record that data for you. Your support desk won't need to ask anymore \"How looks output from the following command: .....?\" It will do that for you and you will get a corresponding file inside the archive.\r\n\r\n### What is inside the archive?\r\n\r\nIt is a tree of directories: a date-time when the snapshot has been taken and full path to copied file tree, if you wanted so. Snapshot will contain many self-descriptive text files, such as `systeminfo`, `system-health`, `network`, `packages` etc. You can look into them and get an idea what is going on with the affected machine.\r\n\r\n### Jinja in Support Profile!?\r\n\r\nYes. Each profile is essentially a YAML Jinja2 template, just like SLS. However, difference is that it should be compiled beforehand. Currently there is only one way to call other modules within the template: `{{ salt('cmd.run', 'uname') }}` for example. If module returns a list or any structure, you can just iterate over it, just the same way as you would do in normal Jinja2.\r\n\r\n### Limitations\r\n\r\nCurrent limitations of this implementation as of today (subject to change):\r\n\r\n- As of now, it cannot collect information from remote minions\r\n- It doesn't work over Salt SSH. You need manually \"ssh\" there and run it manually.\r\n- Profiles are still quite basic.\r\n\r\n### Tests written?\r\n\r\nYes\r\n"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/418134159","html_url":"https://github.com/saltstack/salt/pull/49480#issuecomment-418134159","issue_url":"https://api.github.com/repos/saltstack/salt/issues/49480","id":418134159,"node_id":"MDEyOklzc3VlQ29tbWVudDQxODEzNDE1OQ==","user":{"login":"isbm","id":1073714,"node_id":"MDQ6VXNlcjEwNzM3MTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1073714?v=4","gravatar_id":"","url":"https://api.github.com/users/isbm","html_url":"https://github.com/isbm","followers_url":"https://api.github.com/users/isbm/followers","following_url":"https://api.github.com/users/isbm/following{/other_user}","gists_url":"https://api.github.com/users/isbm/gists{/gist_id}","starred_url":"https://api.github.com/users/isbm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isbm/subscriptions","organizations_url":"https://api.github.com/users/isbm/orgs","repos_url":"https://api.github.com/users/isbm/repos","events_url":"https://api.github.com/users/isbm/events{/privacy}","received_events_url":"https://api.github.com/users/isbm/received_events","type":"User","site_admin":false},"created_at":"2018-09-03T14:39:02Z","updated_at":"2018-09-03T14:39:02Z","author_association":"CONTRIBUTOR","body":"@cachedout hopefully this cleans it up."}}
{"actor":{"display_login":"isbm"}}