{"id":20541050,"url":"https://github.com/netways/ido-cleanup","last_synced_at":"2026-02-23T19:41:20.809Z","repository":{"id":64305582,"uuid":"372760553","full_name":"NETWAYS/ido-cleanup","owner":"NETWAYS","description":"Tool to cleanup Icinga 2 IDO outside of Icinga 2","archived":false,"fork":false,"pushed_at":"2025-04-02T14:18:53.000Z","size":58,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-02T15:27:12.033Z","etag":null,"topics":["icinga"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NETWAYS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-06-01T08:42:27.000Z","updated_at":"2025-04-02T14:18:50.000Z","dependencies_parsed_at":"2024-06-20T07:01:30.295Z","dependency_job_id":"927fd607-eef3-4082-8973-cb69136a88d6","html_url":"https://github.com/NETWAYS/ido-cleanup","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fido-cleanup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fido-cleanup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fido-cleanup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NETWAYS%2Fido-cleanup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NETWAYS","download_url":"https://codeload.github.com/NETWAYS/ido-cleanup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248848194,"owners_count":21171323,"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":["icinga"],"created_at":"2024-11-16T01:19:03.405Z","updated_at":"2026-02-23T19:41:20.749Z","avatar_url":"https://github.com/NETWAYS.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IDO Cleanup Tool\n\nIn larger installations of Icinga 2, [IDO DB cleanup] can become a challenge. Those cleanup queries are scheduled in\nbetween any other INSERT or UPDATE query.\n\nThis can cause two problems:\n- Regular updates are deferred when cleanup is running\n- Not all tables are indexed correctly, so cleanup can take longer\n\nThis tool is build to realize IDO cleanup outside of Icinga 2, so you should disable any `cleanup` inside\n`/etc/icinga2/features-available/ido*.conf` and setup this tool as service.\n\nCurrently, only MySQL is supported.\n\n[IDO DB cleanup]: https://icinga.com/docs/icinga-2/latest/doc/14-features/#db-ido-cleanup\n\n## Install\n\nYou can download the built binary from [releases](https://github.com/NETWAYS/ido-cleanup/releases).\n\nTo run the daemon with systemd see [systemd directory](systemd), and install the files like follows, making sure\nto adjust the files to your needs.\n\n```\ncp netways-ido-cleanup.service /etc/systemd/system/\ncp netways-ido-cleanup.env /etc/icinga2/netways-ido-cleanup\nchown icinga.icinga /etc/icinga2/netways-ido-cleanup\nchmod 640 /etc/icinga2/netways-ido-cleanup\n\nsystemctl daemon-reload\nsystemctl enable netways-ido-cleanup.service\nsystemctl start netways-ido-cleanup.service\n\nsystemctl status netways-ido-cleanup.service\n```\n\n## Usage\n\n```\n$ export DB_DSN='icinga:icinga@tcp(database:3306)/icinga'\n$ ./ido-cleanup\n```\n\n```\nUsage of ido-cleanup:\n      --db string                         DB Connecting string (env:DB_DSN) (default \"icinga:icinga@/icinga2\")\n      --instance string                   IDO instance name (default \"default\")\n      --limit int                         Limit deleting rows in one query (default 10000)\n      --interval duration                 Cleanup every X seconds (default 1m0s)\n      --fast-interval duration            Cleanup every X seconds - when more then 2x limit rows to delete (default 10s)\n      --once                              Just run once\n      --noop                              Just check - don't purge\n      --debug                             Enable debug logging\n      --acknowledgements uint             How long to keep entries of acknowledgements in days\n      --commenthistory uint               How long to keep entries of commenthistory in days (default 365)\n      --contactnotifications uint         How long to keep entries of contactnotifications in days (default 365)\n      --contactnotificationmethods uint   How long to keep entries of contactnotificationmethods in days\n      --downtimehistory uint              How long to keep entries of downtimehistory in days (default 365)\n      --eventhandlers uint                How long to keep entries of eventhandlers in days (default 365)\n      --externalcommands uint             How long to keep entries of externalcommands in days\n      --flappinghistory uint              How long to keep entries of flappinghistory in days\n      --hostchecks uint                   How long to keep entries of hostchecks in days\n      --logentries uint                   How long to keep entries of logentries in days (default 365)\n      --notifications uint                How long to keep entries of notifications in days (default 365)\n      --processevents uint                How long to keep entries of processevents in days\n      --statehistory uint                 How long to keep entries of statehistory in days (default 365)\n      --servicechecks uint                How long to keep entries of servicechecks in days\n      --systemcommands uint               How long to keep entries of systemcommands in days\n```\n\n## Example\n\n```\n$ ido-cleanup --once\nINFO[0000] starting ido-cleanup\nINFO[0000] deleted rows  oldest=\"2019-03-01 11:26:44 +0000 UTC\" rows=10000 table=commenthistory took=72.647379ms\nINFO[0000] deleted rows  oldest=\"2019-01-21 19:35:14 +0000 UTC\" rows=6129 table=contactnotifications took=76.247963ms\nINFO[0000] deleted rows  oldest=\"2019-02-06 09:42:08 +0000 UTC\" rows=209 table=downtimehistory took=3.992535ms\nINFO[0000] deleted rows  oldest=\"2019-04-23 07:29:36 +0000 UTC\" rows=60 table=eventhandlers took=6.685573ms\nINFO[0000] deleted rows  oldest=\"2019-01-21 19:35:14 +0000 UTC\" rows=6212 table=notifications took=84.653149ms\nINFO[0000] deleted rows  oldest=\"2019-01-20 10:16:30 +0000 UTC\" rows=10000 table=statehistory took=135.619702ms\nINFO[0000] stopping after one cleanup\n```\n\n## Missing indices\n\nNot all tables are indexed in a way to support fast deletions.\n\nPlease add those indexes to ensure speedy queries.\n\n```mysql\nCREATE INDEX idx_notifications_cleanup ON icinga_notifications (`instance_id`,`start_time`);\nCREATE INDEX idx_contactnotifications_cleanup on icinga_contactnotifications (instance_id, start_time);\n```\n\nSee [Icinga/icinga2#7753](https://github.com/Icinga/icinga2/issues/7753).\n\n# License\n\nCopyright (C) 2021 [NETWAYS GmbH](mailto:info@netways.de)\n\nThis library is distributed under the GPL-3.0 license found in the [LICENSE](./LICENSE)\nfile.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetways%2Fido-cleanup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetways%2Fido-cleanup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetways%2Fido-cleanup/lists"}