1"use strict";(globalThis.webpackChunkmission_control=globalThis.webpackChunkmission_control||[]).push([[274],{28211(e,n,s){s.d(n,{U_:()=>a,tb:()=>c,v0:()=>i});s(96540);var t=s(97486),r=s(74848);const o={scraper:{icon:t.pUm,label:"Scraper",anchor:"catalog",color:"#2563eb",bg:"#dbeafe",border:"#93c5fd"},healthcheck:{icon:t.XkQ,label:"Health Check",anchor:"health-checks",color:"#d97706",bg:"#fef3c7",border:"#fcd34d"},playbook:{icon:t.WxB,label:"Playbook",anchor:"playbooks",color:"#7c3aed",bg:"#ede9fe",border:"#c4b5fd"},notifications:{icon:t.IrQ,label:"Notifications",anchor:"notifications",color:"#16a34a",bg:"#dcfce7",border:"#86efac"},actions:{icon:t.KD0,label:"Actions",anchor:"actions",color:"#4f46e5",bg:"#e0e7ff",border:"#a5b4fc"},relationship:{icon:t.pUm,label:"Relationship",anchor:"relationship",color:"#d97706",bg:"#fef3c7",border:"#fcd34d"}};function a({type:e,label:n}){const s=o[e];if(!s)return null;const t=s.icon;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-sm font-medium",style:{backgroundColor:s.bg,color:s.color,border:`1px solid ${s.border}`},children:[(0,r.jsx)(t,{className:"w-4 h-4"}),n||s.label]})}function i({children:e}){return(0,r.jsx)("div",{className:"flex flex-wrap gap-2 mb-6 not-prose",children:e})}function c({type:e}){const n=o[e];if(!n)return null;const s=n.icon;return(0,r.jsx)("h2",{id:n.anchor,className:"flex items-center gap-2 mt-8 mb-4 not-prose",children:(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-base font-medium",style:{backgroundColor:n.bg,color:n.color,border:`1px solid ${n.border}`},children:[(0,r.jsx)(s,{className:"w-5 h-5"}),n.label]})})}},34351(e,n,s){s(96540);var t=s(21733),r=s(92224),o=s(34164),a=s(74848);s.d(n,["C",0,({columns:e=3,gap:n="gap-x-4 gap-y-4",children:s})=>(0,a.jsx)("div",{className:(0,o.A)("text-slate-900 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",n),children:s}),"Z",0,({title:e,icon:n,size:s="md",height:i="min-h-20 md:min-h-32",link:c,href:l,variant:d="primary",bordered:p=!0,padded:h=!0,sidebar:u,children:g})=>{c=c||l,u&&(c=u.href,u.customProps?.icon&&(n=(0,a.jsx)(r.A,{name:u.customProps?.icon})),e=u.label),n&&"string"==typeof n&&(n=(0,a.jsx)(r.A,{name:n}));const m=(0,a.jsx)("div",{className:(0,o.A)(i,"flex rounded-lg",p&&"border border-slate-200 border-solid hover:border-slate-300 hover:shadow-lg",h&&"md"==s&&"p-2 sm:p-5",h&&"sm"==s&&"p-1 sm:p-2",s),children:(0,a.jsxs)("div",{className:"items-start flex-col flex-grow justify-around flex",children:[(0,a.jsxs)("span",{className:"flex flex-row items-center space-x-1 ",children:[n&&n,(0,a.jsx)("span",{className:(0,o.A)("md"==s&&"text-2xl","sm"==s&&"text-xl"),children:e})]}),g]})});return c?(0,a.jsx)(t.A,{to:c,className:"unstyled ",children:m}):m}])},92224(e,n,s){s.d(n,{A:()=>c});s(96540);var t=s(97486),r=s(37399),o=s(91406),a=s(34164),i=s(74848);function c({name:e,height:n=22,className:s,url:c,children:l,...d}){if("config-db"==(e=e.replaceAll("--","-").replaceAll("::","-").toLowerCase().replaceAll("k8-","k8s-").replaceAll("kubernetes-","k8s-")))return(0,i.jsx)(o.ntS,{...d});if("canary-checker"==e&&(e="heart"),"getting-started"==e&&(e="lsicon:path-outline"),"concepts"==e&&(e="fluent:brain-circuit-24-regular"),"events"==e&&(e="carbon:lightning"),"tutorial"==e&&(e="learning"),"dedupe"==e)return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"20",height:"20",viewBox:"0 0 50 50",children:(0,i.jsx)("path",{d:"M 17 4 L 17 6 L 44 6 L 44 40 L 36 40 L 36 42 L 46 42 L 46 4 L 17 4 z M 4 8 L 4 46 L 34 46 L 34 45 L 34 8 L 4 8 z M 6 10 L 32 10 L 32 44 L 6 44 L 6 10 z M 18 20 L 18 26 L 12 26 L 12 28 L 18 28 L 18 34 L 20 34 L 20 28 L 26 28 L 26 26 L 20 26 L 20 20 L 18 20 z"})});if("rate-limit"==e)return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",...d,width:"20",height:"20",viewBox:"0 0 50 50",children:(0,i.jsx)("path",{d:"M 25 2 C 12.316406 2 2 12.316406 2 25 C 2 37.683594 12.316406 48 25 48 C 37.683594 48 48 37.683594 48 25 C 48 12.316406 37.683594 2 25 2 Z M 32.5 16.1875 C 37.601563 16.1875 38.09375 21.007813 38.09375 22.90625 C 38.09375 23.605469 38.09375 24.210938 38.09375 24.8125 C 38.09375 30.3125 36.90625 33.40625 32.40625 33.40625 C 28.90625 33.40625 26.6875 31.511719 26.6875 24.8125 C 26.789063 18.914063 28.398438 16.187
15 32.5 16.1875 Z M 14.3125 16.5 L 22.6875 16.5 L 22.6875 18.3125 L 15.90625 18.3125 L 15 23.1875 C 15.699219 22.488281 16.789063 22 18.1875 22 C 22.585938 22 23.6875 25.511719 23.6875 27.8125 C 23.6875 31.511719 20.886719 33.40625 17.6875 33.40625 C 13.789063 33.40625 12.3125 30.59375 12.3125 28.59375 L 14.3125 28.59375 C 14.3125 29.695313 15.207031 31.6875 17.90625 31.6875 C 20.605469 31.6875 21.5 29.289063 21.5 27.6875 C 21.5 25.1875 19.6875 23.8125 17.6875 23.8125 C 15.988281 23.8125 14.898438 24.90625 14.5 25.40625 L 12.6875 25.3125 Z M 32.5 17.90625 C 29.898438 17.90625 29 20.507813 29 23.40625 L 29 24.8125 C 29 29.8125 30 31.6875 32.5 31.6875 C 34.699219 31.6875 36 30.210938 36 24.8125 L 36 23.40625 C 36 21.707031 35.601563 17.90625 32.5 17.90625 Z"})});if("scraper"==e)return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",...d,viewBox:"0 0 50 50",children:(0,i.jsx)("path",{d:"M 28.992188 7 C 23.983187 7 19.408891 9.4429063 17.212891 13.878906 C 16.077891 13.127906 14.747469 12.722656 13.355469 12.722656 C 9.6514687 12.722656 6.6102812 15.610953 6.3632812 19.251953 C 2.5812812 20.629953 1.1842379e-15 24.258078 0 28.330078 C 0 33.662078 4.3379219 38 9.6699219 38 L 24.179688 38 C 24.069688 37.348 24 36.683 24 36 C 24 29.373 29.373 24 36 24 C 42.218 24 47.330453 28.728156 47.939453 34.785156 C 49.224453 33.242156 50 31.260609 50 29.099609 C 50 24.538609 46.554906 20.767859 42.128906 20.255859 C 42.138906 20.064859 42.142578 19.878312 42.142578 19.695312 C 42.142578 12.444312 36.243188 7 28.992188 7 z M 36 26 C 30.488997 26 26 30.488997 26 36 C 26 41.511003 30.488997 46 36 46 C 38.396508 46 40.597385 45.148986 42.322266 43.736328 L 48.292969 49.707031 L 49.707031 48.292969 L 43.736328 42.322266 C 45.148986 40.597385 46 38.396508 46 36 C 46 30.488997 41.511003 26 36 26 z M 36 28 C 40.430123 28 44 31.569877 44 36 C 44 40.430123 40.430123 44 36 44 C 31.569877 44 28 40.430123 28 36 C 28 31.569877 31.569877 28 36 28 z"})});let p=t.GtP[e];if(!p)return(0,i.jsx)(r.In,{icon:e,...d,height:20,width:20});let h=(0,i.jsxs)("div",{className:"inline-block spacing-x-2",children:[(0,i.jsx)(p,{className:(0,a.A)("align-middle",s),name:e,size:n,...d}),(0,i.jsx)("span",{children:l})]});return null!=c?(0,i.jsx)("a",{href:c,children:h}):h}},21733(e,n,s){s.d(n,{A:()=>o});s(96540);var t=s(68957),r=s(74848);function o(e){return(0,r.jsx)(t.A,{...e})}},30363(e,n,s){s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>u,frontMatter:()=>c,metadata:()=>t,toc:()=>p});const t=JSON.parse('{"id":"integrations/postgres","title":"PostgreSQL","description":"Mission Control integrates with PostgreSQL to monitor your database infrastructure.","source":"@site/docs/integrations/postgres.mdx","sourceDirName":"integrations","slug":"/integrations/postgres","permalink":"/docs/integrations/postgres","draft":false,"unlisted":false,"editUrl":"https://github.com/flanksource/docs/tree/main/docs/integrations/postgres.mdx","tags":[],"version":"current","frontMatter":{"title":"PostgreSQL","sidebar_custom_props":{"icon":"postgres"}},"sidebar":"integrations","previous":{"title":"Opensearch","permalink":"/docs/integrations/opensearch"},"next":{"title":"Prometheus","permalink":"/docs/integrations/prometheus"}}');var r=s(74848),o=s(28453),a=s(34351),i=s(28211);const c={title:"PostgreSQL",sidebar_custom_props:{icon:"postgres"}},l=void 0,d={},p=[{value:"Connection Check",id:"connection-check",level:3},{value:"Next Steps",id:"next-steps",level:2}];function h(e){const n={code:"code",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components},{Details:s}=n;return s||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.v0,{children:[(0,r.jsx)(i.U_,{type:"healthcheck"}),(0,r.jsx)(i.U_,{type:"scraper"})]}),"\n",(0,r.jsx)(n.p,{children:"Mission Control integrates with PostgreSQL to monitor your database infrastructure."}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(i.tb,{type:"healthcheck"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"Use cases:"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Verify database connectivity and authentication"}),"\n",(0,r.jsx)(n.li,{children:"Execute SQL queries and validate results against expected values"}),"\n",(0,r.jsx)(n.li,{children:"Monitor replication lag, connection counts, and database health"}),"\n",(0,r.jsx)(n.li,{children:"Alert when queries return unexpected results or databases become unavailable"}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"connection-check",children:"Connection Check"}),"\n",(0,r.jsx)(n.p,{children:"Test database connectivity and run validation queries."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",metastring:'title="postgres-connection-check.yaml"',children:"apiVersion: canaries.flanksource.com/v1\nkind: Canary\nmetadata:\n name: postgres-connection\nspec:\n interval: 30\n postgres:\n - name: production-db\n url: postgres://user:password@postgres:5432/mydb?sslmode=require\n query: SELECT 1\n"})}),"\n",(0,r.jsx)(s,{summary:"Query Validation",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",metastring:'title="postgres-query-check.yaml"',children:"apiVersion: canaries.flanksource.com/v1\nkind: Canary\nmetadata:\n name: postgres-replication\nspec:\n interval: 60\n postgres:\n - name: replication-lag\n connection: connection://postgres/production\n query: |\n SELECT EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp()))::INT\n AS replication_lag_seconds\n test:\n expr: results[0].replication_lag_seconds < 30\n"})})}),"\n",(0,r.jsx)(s,{summary:"Using Connection References",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",metastring:'title="postgres-connection-ref.yaml"',children:"apiVersion: canaries.flanksource.com/v1\nkind: Canary\nmetadata:\n name: postgres-check\nspec:\n interval: 30\n postgres:\n - name: user-count\n connection: connection://postgres/analytics\n query: SELECT COUNT(*) as count FROM users WHERE active = true\n test:\n expr: results[0].c
1ount > 0\n"})})}),"\n",(0,r.jsx)(n.hr,{}),"\n",(0,r.jsx)(i.tb,{type:"scraper"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"Use cases:"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Scrape database metadata and configurations into the catalog"}),"\n",(0,r.jsx)(n.li,{children:"Track database settings and schema changes"}),"\n",(0,r.jsx)(n.li,{children:"Monitor database users and permissions"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-yaml",metastring:'title="postgres-scraper.yaml"',children:'apiVersion: configs.flanksource.com/v1\nkind: ScrapeConfig\nmetadata:\n name: postgres-config\nspec:\n schedule: "@every 1h"\n sql:\n - connection: connection://postgres/production\n driver: postgres\n query: |\n SELECT datname as name,\n pg_database_size(datname) as size_bytes,\n datconnlimit as connection_limit\n FROM pg_database\n WHERE datistemplate = false\n items:\n - type: Postgres::Database\n id: .name\n name: .name\n'})}),"\n",(0,r.jsx)(n.h2,{id:"next-steps",children:"Next Steps"}),"\n",(0,r.jsxs)(a.C,{children:[(0,r.jsx)(a.Z,{icon:"scraper",title:"SQL Scraper Reference",href:"/docs/guide/config-db/scrapers/sql",children:(0,r.jsx)(n.p,{children:"SQL scraper configuration options"})}),(0,r.jsx)(a.Z,{icon:"mssql",title:"SQL Server Integration",href:"/docs/integrations/sql-server",children:(0,r.jsx)(n.p,{children:"Monitor Microsoft SQL Server databases"})})]})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},28453(e,n,s){s.d(n,{R:()=>a,x:()=>i});var t=s(96540);const r={},o=t.createContext(r);function a(e){const n=t.useContext(o);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:a(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.