{"id":20511294,"url":"https://github.com/intility/blog-ping-machine","last_synced_at":"2025-04-13T22:41:51.777Z","repository":{"id":42226182,"uuid":"427815799","full_name":"intility/blog-ping-machine","owner":"intility","description":"Sample project to showcase some basic OTP patterns","archived":false,"fork":false,"pushed_at":"2023-01-06T08:43:05.000Z","size":1101,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-27T13:01:53.548Z","etag":null,"topics":["elixir","otp"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/intility.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}},"created_at":"2021-11-14T02:02:31.000Z","updated_at":"2024-09-27T16:28:13.000Z","dependencies_parsed_at":"2023-02-05T17:40:12.606Z","dependency_job_id":null,"html_url":"https://github.com/intility/blog-ping-machine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intility%2Fblog-ping-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intility%2Fblog-ping-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intility%2Fblog-ping-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intility%2Fblog-ping-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intility","download_url":"https://codeload.github.com/intility/blog-ping-machine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248794565,"owners_count":21162613,"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":["elixir","otp"],"created_at":"2024-11-15T20:35:26.946Z","updated_at":"2025-04-13T22:41:51.736Z","avatar_url":"https://github.com/intility.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The ping machine\n\nThe ping machine demonstrates some core Elixir and OTP programming concepts using\n`Supervisors`, `GenServers` and `Tasks` to concurrently ping all hosts in a network subnet range.\n\n![Ping Machine](illustration.png)\n\n**DISCLAIMER: We will not actually send any ping requests. This is trival to implement,\nbut beside the point of this demo. We simply sleeps for a given amount of time and\nrandomly choose if the \"request\" was successful or not.**\n\nIf you would like to read the full tutorial, it's available over at the\n[{engineering@intility}](https://engineering.intility.com/article/building-a-concurrent-network-pinger-pt-1) blog!\n\n## Running the project\n\nJust run the project using `iex -S mix` from the project root.\n\n```shell\n$ mix deps.get\n...\n$ iex -S mix\niex(1)\u003e {:ok, pid} = PingMachine.start_ping(\"192.168.1.0/24\")\n[info]  Started pinging all hosts in range 192.168.1.0/24\n{:ok, #PID\u003c0.212.0\u003e}\n[info]  Successfully pinged host 192.168.1.139\n[info]  Successfully pinged host 192.168.1.254\n[error] Failed to ping host 192.168.1.29\n[info]  Successfully pinged host 192.168.1.21\n[info]  Successfully pinged host 192.168.1.108\n[error] Failed to ping host 192.168.1.119\n[info]  Successfully pinged host 192.168.1.16\n[error] Failed to ping host 192.168.1.109\n\niex(2)\u003e PingMachine.get_successful_hosts(pid)\n[ \"192.168.1.84\", \"192.168.1.161\", \"192.168.1.50\", \"192.168.1.2\",\n \"192.168.1.226\", \"192.168.1.97\", \"192.168.1.186\", \"192.168.1.233\",\n \"192.168.1.72\", \"192.168.1.148\", \"192.168.1.180\", \"192.168.1.203\",\n \"192.168.1.73\", \"192.168.1.107\", ...]\n\niex(3)\u003e PingMachine.get_failed_hosts(pid)\n[ \"192.168.1.113\", \"192.168.1.24\", \"192.168.1.101\", \"192.168.1.193\",\n \"192.168.1.197\", \"192.168.1.219\", \"192.168.1.22\", \"192.168.1.165\",\n \"192.168.1.128\", \"192.168.1.155\", \"192.168.1.76\", \"192.168.1.183\",\n \"192.168.1.104\", \"192.168.1.110\", \"192.168.1.163\", \"192.168.1.156\", ...]\n\niex(4)\u003e PingMachine.stop_ping(pid)\n:ok\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintility%2Fblog-ping-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintility%2Fblog-ping-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintility%2Fblog-ping-machine/lists"}