{"id":29101068,"url":"https://github.com/zodman/pingdoomer","last_synced_at":"2025-06-28T19:08:43.649Z","repository":{"id":42291959,"uuid":"241801114","full_name":"zodman/pingdoomer","owner":"zodman","description":"Ping hostname monitor and blacklist","archived":false,"fork":false,"pushed_at":"2022-12-08T03:40:55.000Z","size":101,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-25T04:45:56.634Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://hackmd.io/@CZ7Qf8ZASPiRGhV9236VSQ/BJ6JzKGzI","language":"Python","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/zodman.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":"2020-02-20T05:26:42.000Z","updated_at":"2020-05-04T02:47:22.000Z","dependencies_parsed_at":"2023-01-24T08:25:26.385Z","dependency_job_id":null,"html_url":"https://github.com/zodman/pingdoomer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zodman/pingdoomer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zodman%2Fpingdoomer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zodman%2Fpingdoomer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zodman%2Fpingdoomer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zodman%2Fpingdoomer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zodman","download_url":"https://codeload.github.com/zodman/pingdoomer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zodman%2Fpingdoomer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262482449,"owners_count":23318141,"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":[],"created_at":"2025-06-28T19:08:39.564Z","updated_at":"2025-06-28T19:08:43.643Z","avatar_url":"https://github.com/zodman.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pingdoomer\n\n## django ping monitor and blacklist\n\n\n\n### Models\n\n```python\nclass Account(models.Model):\n    name = fields.CharField()\n    externa_id = fields.IntegerField()\n    \nclass Host(models.Model)\n    hostname = fields.CharField()\n    account = fields.ForeignKey()\n```\n\n### Django rest framework\n\n    - POST create\n    - PUT update\n    - DEL delete\n\n#### Api (protected by Apikey for writing and other for reading):\n\n    v1/api/account/\n    v1/api/account/\u003caccount_id\u003e/hosts/\n    v1/api/account/\u003caccount_id\u003e/hosts/\u003chost_id\u003e/\n        - GET for obtain all data to graph. and last result\n\n\n\n\n\n### TimeserieDB:: InfluxDB\n\nI will store the ping stats using [pingparsing](https://pypi.org/project/pingparsing/) into a [influxdb](https://github.com/influxdata/influxdb-python)\n\n```python=\n$ python\n\u003e\u003e\u003e from influxdb import InfluxDBClient\n\u003e\u003e\u003e json_body = [\n    {\n        \"measurement\": \"account_\u003cexternal_id\u003e\",\n        \"tags\": {\n            \"hostname\": \"\u003chostname\u003e\",\n        },\n        \"time\": \"2009-11-10T23:00:00Z\",\n        \"fields\": {\n            \"packet_transmit\": 10,\n            \"packet_receive\": 10,\n            \"packet_loss_rate\": 0.0,\n            \"packet_loss_count\": 0,\n            \"rtt_min\": 34.189,\n            \"rtt_avg\": 46.054,\n            \"rtt_max\": 63.246,\n            \"rtt_mdev\": 9.122,\n            \"packet_duplicate_rate\": 0.0,\n            \"packet_duplicate_count\": 0\n\n        }\n    }\n]\n\u003e\u003e\u003e client = InfluxDBClient('localhost', 8086, 'root', 'root', 'example')\n\u003e\u003e\u003e client.create_database('example')\n\u003e\u003e\u003e client.write_points(json_body)\n\u003e\u003e\u003e result = client.query('select * from account_\u003cslug\u003e group by hostname;')\n\u003e\u003e\u003e print(\"Result: {0}\".format(result))\n```\n\n\n### Celery tasks\n\n- scheduler()\n    - Obtain all host and throw everything to workers\n\n- run(account__name, host)\n    - execute the ping on host\n    - parse the ping stats\n    - insert into influxdb\n\nCelery workers to execute the ping and a celery scheduler to execute each time needed.\n\n\n### commands to add\n\n```\n pip install httpie\n http POST localhost:8000/api/accounts/ 'Authorization:Token \u003ctoken\u003e' name=andres1 external_id=10\n http POST localhost:8000/api/accounts/6/hosts/ 'Authorization:Token \u003ctoken\u003e' hostname=waifu.ca\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzodman%2Fpingdoomer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzodman%2Fpingdoomer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzodman%2Fpingdoomer/lists"}