--- import BaseLayout from '../../../layouts/BaseLayout.astro'; import Breadcrumbs from '../../../components/Breadcrumbs.astro'; import Sidebar from '../../../components/Sidebar.astro'; import ExporterSection from '../../../components/ExporterSection.astro'; import CautionBanner from '../../../components/CautionBanner.astro'; import { data, getGroupSlug, getServiceSlug, getRuleCount, getAllServices } from '../../../data/rules'; import { SITE_URL, schemaAuthor, schemaPublisher, schemaWebSite, SITE_DATE_PUBLISHED, SCHEMA_IN_LANGUAGE } from '../../../data/site'; export function getStaticPaths() { return getAllServices().map(({ group, service, groupSlug, serviceSlug }) => ({ params: { group: groupSlug, service: serviceSlug }, props: { group, service }, })); } const { group, service } = Astro.props; const base = import.meta.env.BASE_URL.replace(/\/$/, ''); const groupSlug = getGroupSlug(group); const serviceSlug = getServiceSlug(service); const ruleCount = getRuleCount(service); const groupIndex = data.groups.findIndex((g) => getGroupSlug(g) === groupSlug) + 1; const serviceIndex = group.services.findIndex((s) => getServiceSlug(s) === serviceSlug) + 1; // Build exporters summary for keywords (kept for but removed from description) const exporterNames = service.exporters.map((e) => e.name).filter(Boolean).join(', '); // Description: lead with count + service + format signals. Exporter names go in keywords, not here. const metaDesc = `${ruleCount} ready-to-use Prometheus alert rules for ${service.name}. Critical and warning YAML snippets — copy-paste into your Prometheus config or wget download.`; // FAQ JSON-LD for GEO (AI search engines) const faqItems = service.exporters.flatMap((exp) => (exp.rules ?? []).map((rule) => ({ '@type': 'Question', name: `What is the Prometheus alert rule for "${rule.name}"?`, acceptedAnswer: { '@type': 'Answer', text: `${rule.description} PromQL expression: ${rule.query}. Severity: ${rule.severity}${rule.for ? `. Duration: ${rule.for}` : ''}.`, }, })) ); const buildDate = new Date().toISOString().slice(0, 10); const keywords = [ 'Prometheus', 'alerting rules', service.name, 'monitoring', 'PromQL', ...service.exporters.map((e) => e.name).filter(Boolean), ].join(', '); const pageUrl = `${SITE_URL}rules/${groupSlug}/${serviceSlug}/`; const jsonLd = { '@context': 'https://schema.org', '@graph': [ { '@type': 'TechArticle', '@id': `${pageUrl}#article`, headline: `${service.name} Prometheus Alert Rules (${ruleCount})`, description: metaDesc, about: `Prometheus monitoring for ${service.name}`, url: pageUrl, inLanguage: SCHEMA_IN_LANGUAGE, datePublished: SITE_DATE_PUBLISHED, dateModified: buildDate, author: schemaAuthor, publisher: schemaPublisher, isPartOf: schemaWebSite, }, ...(faqItems.length > 0 ? [{ '@type': 'FAQPage', '@id': `${pageUrl}#faq`, mainEntity: faqItems, }] : []), ], }; ---

{service.name} Prometheus Alert Rules

{ruleCount} Prometheus alerting rule{ruleCount !== 1 ? 's' : ''} for {service.name}. {exporterNames && `Exported via ${exporterNames}.`} These rules cover critical and warning conditions — copy and paste the YAML into your Prometheus configuration.

{service.exporters.map((exporter, expIdx) => ( 1} /> ))} {group.services.length > 1 && (

More in {group.name}

{group.services .filter((s) => getServiceSlug(s) !== serviceSlug) .map((s) => ( {s.name} ))}
)}