Skip to content

Instantly share code, notes, and snippets.

@DaffyDuke
Created March 5, 2017 17:08
Show Gist options
  • Save DaffyDuke/9debe6cf95d9e97546d90c532f53174a to your computer and use it in GitHub Desktop.
Save DaffyDuke/9debe6cf95d9e97546d90c532f53174a to your computer and use it in GitHub Desktop.
Notes Foreman

identify hosts with specific error (here, bad /etc/hosts in foreman reports)

SELECT DISTINCT "hosts"."name", "reports".id, "reports"."reported_at" AS alias_0 FROM "reports" LEFT OUTER JOIN "hosts" ON "hosts"."id" = "reports"."host_id" AND "hosts"."type" IN ('Host::Managed') LEFT OUTER JOIN "hosts" "hosts_reports_join" ON "hosts_reports_join"."id" = "reports"."host_id"AND "hosts_reports_join"."type" IN ('Host::Managed') LEFT OUTER JOIN "environments" ON "environments"."id" = "hosts_reports_join"."environment_id" LEFT OUTER JOIN "logs" ON "logs"."report_id" = "reports"."id" LEFT OUTER JOIN "messages" ON "messages"."id" = "logs"."message_id" LEFT OUTER JOIN "logs" "logs_reports_join" ON "logs_reports_join"."report_id" = "reports"."id" LEFT OUTER JOIN "sources" ON "sources"."id" = "logs_reports_join"."source_id" where messages.value like 'Could not prefetch host provider ''parsed'': Could not parse line%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment