{"id":26811767,"url":"https://github.com/elmazzun/tshooters","last_synced_at":"2025-03-30T01:39:59.119Z","repository":{"id":271117950,"uuid":"912149025","full_name":"elmazzun/tshooters","owner":"elmazzun","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-05T16:07:29.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-05T16:36:16.298Z","etag":null,"topics":["statically-linked","troubleshooting-tool"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elmazzun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-04T18:33:12.000Z","updated_at":"2025-01-05T16:07:40.000Z","dependencies_parsed_at":"2025-01-05T16:36:20.560Z","dependency_job_id":"3a852498-9bc7-4cee-b530-0f8ecf2ad856","html_url":"https://github.com/elmazzun/tshooters","commit_stats":null,"previous_names":["elmazzun/tshooters"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmazzun%2Ftshooters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmazzun%2Ftshooters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmazzun%2Ftshooters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmazzun%2Ftshooters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elmazzun","download_url":"https://codeload.github.com/elmazzun/tshooters/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246266264,"owners_count":20749754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["statically-linked","troubleshooting-tool"],"created_at":"2025-03-30T01:39:58.578Z","updated_at":"2025-03-30T01:39:59.100Z","avatar_url":"https://github.com/elmazzun.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Troubleshooters\n\n\u003e ⚠️⚠️⚠️ Work In Progress ⚠️⚠️⚠️\n\n**Statically linked troubleshooting tools for Linux systems.**\n\nIf you need to troubleshoot a Linux machine but you don't want to bring \ntroubleshooting tools in such machine by Docker or because your machine is \nlacking a package manager with which install tools, this is what you may need.\n\n## Why?\n\nWhile reading [Brendan Gregg's System Performance: Enterprise and the Cloud](https://www.brendangregg.com/blog/2020-07-15/systems-performance-2nd-edition.html) \nI wondered: *what if I need to troubleshoot a Linux machine but I am unable to* \n*start a troubleshooting Docker image or install any useful tool in the machine?* \n\nI'd copy required tools by `scp` or similar in the machine but such tools \nshould be compatible with machine system libraries: that's why, in different \nDocker containers, I compile troubleshooting tools in a compatible way for \ntarget machine.\n\nI tried to add `vmstat` in BusyBox as a starting point but lot of effort was \nrequired in order to add only that tool: in the end, I decided to statically \ncompile the required tools in a containerized environment; the resulting binaries \nare more chonky but at least they have everything they need inside them.\n\n## Environments\n\nAt the moment, troubleshooting tools are statically linked in following distros:\n\n- `Debian 12`;\n\n- `Ubuntu 22.04`.\n\nThere is a `Dockerfile.\u003cDISTRO\u003e` for every Linux distro: each of it may have \ndifferent package manager and system libraries versions.\n\n`Dockerfile.compile` is used by every distro: it downloads troubleshooting packages \nsource code and compile them, ready to be copied from the resulting container.\n\n## Tools\n\n- from `procps` package: `sysctl`, `vmstat`\n- from `sysstat` package: `iostat`, `mpstat`, `pidstat`, `sar`\n\n## Compilation\n\nJust run `./build.sh` then `docker run` the Docker container from which you want \nto get tools for the target system you need.\n\n```bash\n$ ./build.sh\n...\n\n$ docker images                             \nREPOSITORY            TAG            IMAGE ID       CREATED          SIZE\ntshooters             ubuntu-22-04   61fd47899ff4   30 minutes ago   501MB\ntshooters-build-env   ubuntu-22-04   269206f1815c   31 minutes ago   425MB\ntshooters             debian-12      e028579974e4   32 minutes ago   620MB\ntshooters-build-env   debian-12      083eae208fbf   33 minutes ago   551MB\n\n# Say you want to get vmstat for Ubuntu 22.04\n$ docker run -it --rm tshooters:ubuntu-22-04 bash\nroot@c3be227cc0ec:/binaries$ ls -lah vmstat \n-rwxr-xr-x 1 root root 1.9M Jan  5 14:06 vmstat\n\n# From another terminal, copy the binaries you need\n$ docker cp c3be227cc0ec:/binaries/vmstat .\nSuccessfully copied 1.91MB to .../tshooters/.\n$  ./vmstat   \nprocs -----------memory---------- ---swap-- -----io---- -system-- -------cpu-------\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st gu\n 2  0      0 8453136 302980 4433540  0    0   883   742 2586    4  5  2 92  1  0  0\n```\n\n## TODO\n\n- [ ] add compiled binaries in an Ansible playbook which would inject such \n      binaries in newly printed Linux machines?\n- [ ] `Dockerfile.compile` has way too many layers: reduce them\n- [ ] compile for more Linux distros:\n  - [ ] Fedora\n  - [ ] RHEL\n- [ ] instead of manually copying required tools from containers, just zip them \n  and write them to host file system machine\n- [ ] some automatic testing where binaries are run on virtualized target systems\n      via Firecracker? QEMU? ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmazzun%2Ftshooters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felmazzun%2Ftshooters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmazzun%2Ftshooters/lists"}