{
  "checks": [
    {
      "name": "Ping",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ping",
      "parameters": {},
      "sort_order": 0,
      "value_type": "duration",
      "description": "",
      "check_config": {},
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": null,
      "threshold_warn": null,
      "interval_seconds": 60,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "Postgres connections",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_script",
      "parameters": {
        "script_id": "eb9f0573-74ba-579b-821f-aeacb8fa0edc",
        "value_unit": "conns",
        "extract_value": "^(\\d+)"
      },
      "sort_order": 0,
      "value_type": "gauge",
      "description": "",
      "check_config": {
        "script_id": "eb9f0573-74ba-579b-821f-aeacb8fa0edc",
        "value_unit": "conns",
        "extract_value": "^(\\d+)"
      },
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": 140,
      "threshold_warn": 80,
      "interval_seconds": 60,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "Postgres replication lag (seconds)",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_script",
      "parameters": {
        "script_id": "bd730050-ffa8-5399-9ff5-4e91de72197b",
        "value_unit": "s",
        "extract_value": "^(\\d+)"
      },
      "sort_order": 1,
      "value_type": "gauge",
      "description": "",
      "check_config": {
        "script_id": "bd730050-ffa8-5399-9ff5-4e91de72197b",
        "value_unit": "s",
        "extract_value": "^(\\d+)"
      },
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": 300,
      "threshold_warn": 30,
      "interval_seconds": 60,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "PG Port",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "port",
      "parameters": {
        "port": 5432
      },
      "sort_order": 1,
      "value_type": "status",
      "description": "",
      "check_config": {
        "port": 5432
      },
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": null,
      "threshold_warn": null,
      "interval_seconds": 60,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "Postgres deadlocks (since reset)",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_script",
      "parameters": {
        "script_id": "1d4a4b87-a07d-5f9b-9809-159287d38fdd",
        "value_unit": "deadlocks",
        "extract_value": "^(\\d+)"
      },
      "sort_order": 2,
      "value_type": "counter",
      "description": "",
      "check_config": {
        "script_id": "1d4a4b87-a07d-5f9b-9809-159287d38fdd",
        "value_unit": "deadlocks",
        "extract_value": "^(\\d+)"
      },
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": 10,
      "threshold_warn": 1,
      "interval_seconds": 300,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "CPU",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_cpu",
      "parameters": {},
      "sort_order": 2,
      "value_type": "gauge",
      "description": "",
      "check_config": {},
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": 95,
      "threshold_warn": 80,
      "interval_seconds": 120,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "Memory",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_mem",
      "parameters": {},
      "sort_order": 3,
      "value_type": "gauge",
      "description": "",
      "check_config": {},
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": 95,
      "threshold_warn": 85,
      "interval_seconds": 120,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "Postgres oldest XID age (% wraparound)",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_script",
      "parameters": {
        "script_id": "cad7dde5-e3a0-5620-81a5-1f67afe21eac",
        "value_unit": "%",
        "extract_value": "^(\\d+)"
      },
      "sort_order": 3,
      "value_type": "gauge",
      "description": "",
      "check_config": {
        "script_id": "cad7dde5-e3a0-5620-81a5-1f67afe21eac",
        "value_unit": "%",
        "extract_value": "^(\\d+)"
      },
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": 90,
      "threshold_warn": 70,
      "interval_seconds": 3600,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "Disk /var/lib/postgresql",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_disk",
      "parameters": {
        "mount": "/var/lib/postgresql"
      },
      "sort_order": 4,
      "value_type": "gauge",
      "description": "",
      "check_config": {
        "mount": "/var/lib/postgresql"
      },
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": 90,
      "threshold_warn": 80,
      "interval_seconds": 300,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "Postgres long-running queries (>5min)",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_script",
      "parameters": {
        "script_id": "65b5aea2-362a-5734-a1e0-a9ffc85eae15",
        "value_unit": "queries",
        "extract_value": "^(\\d+)"
      },
      "sort_order": 4,
      "value_type": "gauge",
      "description": "",
      "check_config": {
        "script_id": "65b5aea2-362a-5734-a1e0-a9ffc85eae15",
        "value_unit": "queries",
        "extract_value": "^(\\d+)"
      },
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": 5,
      "threshold_warn": 1,
      "interval_seconds": 120,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "Postgres bloat — biggest table (% dead tuples)",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_script",
      "parameters": {
        "script_id": "a75f65c3-69bc-5062-8618-ae5cb6ce3256",
        "value_unit": "%",
        "extract_value": "^(\\d+)"
      },
      "sort_order": 5,
      "value_type": "gauge",
      "description": "",
      "check_config": {
        "script_id": "a75f65c3-69bc-5062-8618-ae5cb6ce3256",
        "value_unit": "%",
        "extract_value": "^(\\d+)"
      },
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": 50,
      "threshold_warn": 20,
      "interval_seconds": 3600,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "PG Service",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_script",
      "parameters": {
        "script_id": "d0ce1cc7-a0db-539f-9052-d18fd1cd269a",
        "match_regex": "^active$"
      },
      "sort_order": 5,
      "value_type": "gauge",
      "description": "",
      "check_config": {
        "script_id": "d0ce1cc7-a0db-539f-9052-d18fd1cd269a",
        "match_regex": "^active$"
      },
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": null,
      "threshold_warn": null,
      "interval_seconds": 120,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    },
    {
      "name": "Postgres service running",
      "auto_add": true,
      "check_mode": "passive",
      "check_type": "ssh_script",
      "parameters": {
        "script_id": "26d42967-9513-5e44-8e36-36aee34d0cf1",
        "value_unit": "up",
        "match_regex": "^0$",
        "extract_value": "^(\\d+)",
        "fail_if_match": true
      },
      "sort_order": 6,
      "value_type": "gauge",
      "description": "",
      "check_config": {
        "script_id": "26d42967-9513-5e44-8e36-36aee34d0cf1",
        "value_unit": "up",
        "match_regex": "^0$",
        "extract_value": "^(\\d+)",
        "fail_if_match": true
      },
      "is_telemetry": false,
      "interpretation": null,
      "threshold_crit": null,
      "threshold_warn": null,
      "interval_seconds": 60,
      "threshold_direction": "upper",
      "confirmation_attempts": 1,
      "confirmation_interval_seconds": 10
    }
  ],
  "profile": {
    "icon": "server",
    "name": "PostgreSQL Database",
    "tags": [
      "postgresql",
      "database",
      "ssh"
    ],
    "vendor": "generic",
    "category": "server",
    "os_family": "linux",
    "description": "PostgreSQL Server: Port, Service, CPU, RAM, Disk.",
    "ip_required": true,
    "port_layout": null,
    "visual_type": null,
    "snmp_enabled": false,
    "agent_capable": false,
    "requires_snmp": true,
    "description_md": "PostgreSQL Server: Port, Service, CPU, RAM, Disk.",
    "requires_agent": false,
    "sysoid_patterns": null,
    "sysdescr_patterns": null,
    "requires_collector": true
  },
  "scripts": [
    {
      "name": "Postgres connections",
      "script_id": "eb9f0573-74ba-579b-821f-aeacb8fa0edc",
      "is_builtin": true,
      "description": "Auto-registered builtin SSH script.",
      "interpreter": "bash",
      "script_body": "sudo -u postgres psql -tAc 'SELECT count(*) FROM pg_stat_activity' 2>/dev/null || echo 0",
      "expected_output": "nagios"
    },
    {
      "name": "Postgres replication lag (seconds)",
      "script_id": "bd730050-ffa8-5399-9ff5-4e91de72197b",
      "is_builtin": true,
      "description": "Auto-registered builtin SSH script.",
      "interpreter": "bash",
      "script_body": "sudo -u postgres psql -tAc \\\"SELECT COALESCE(EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp()))::int, 0)\\\" 2>/dev/null || echo 0",
      "expected_output": "nagios"
    },
    {
      "name": "Postgres deadlocks (since reset)",
      "script_id": "1d4a4b87-a07d-5f9b-9809-159287d38fdd",
      "is_builtin": true,
      "description": "Auto-registered builtin SSH script.",
      "interpreter": "bash",
      "script_body": "sudo -u postgres psql -tAc 'SELECT sum(deadlocks)::int FROM pg_stat_database' 2>/dev/null || echo 0",
      "expected_output": "nagios"
    },
    {
      "name": "Postgres oldest XID age (% wraparound)",
      "script_id": "cad7dde5-e3a0-5620-81a5-1f67afe21eac",
      "is_builtin": true,
      "description": "Auto-registered builtin SSH script.",
      "interpreter": "bash",
      "script_body": "sudo -u postgres psql -tAc \\\"SELECT (max(age(datfrozenxid))::float / 2000000000 * 100)::int FROM pg_database\\\" 2>/dev/null || echo 0",
      "expected_output": "nagios"
    },
    {
      "name": "Postgres long-running queries (>5min)",
      "script_id": "65b5aea2-362a-5734-a1e0-a9ffc85eae15",
      "is_builtin": true,
      "description": "Auto-registered builtin SSH script.",
      "interpreter": "bash",
      "script_body": "sudo -u postgres psql -tAc \\\"SELECT count(*) FROM pg_stat_activity WHERE state='active' AND now()-query_start > interval '5 minutes'\\\" 2>/dev/null || echo 0",
      "expected_output": "nagios"
    },
    {
      "name": "Postgres bloat — biggest table (% dead tuples)",
      "script_id": "a75f65c3-69bc-5062-8618-ae5cb6ce3256",
      "is_builtin": true,
      "description": "Auto-registered builtin SSH script.",
      "interpreter": "bash",
      "script_body": "sudo -u postgres psql -tAc \\\"SELECT COALESCE(max(round(100*n_dead_tup::numeric/NULLIF(n_live_tup,0)))::int, 0) FROM pg_stat_user_tables WHERE n_live_tup>1000\\\" 2>/dev/null || echo 0",
      "expected_output": "nagios"
    },
    {
      "name": "PG Service",
      "script_id": "d0ce1cc7-a0db-539f-9052-d18fd1cd269a",
      "is_builtin": true,
      "description": "Auto-registered from builtin profile-check 'PG Service'.",
      "interpreter": "bash",
      "script_body": "systemctl is-active postgresql",
      "expected_output": "nagios"
    },
    {
      "name": "Postgres service running",
      "script_id": "26d42967-9513-5e44-8e36-36aee34d0cf1",
      "is_builtin": true,
      "description": "Auto-registered builtin SSH script.",
      "interpreter": "bash",
      "script_body": "systemctl is-active postgresql 2>/dev/null | grep -c '^active$' || echo 0",
      "expected_output": "nagios"
    }
  ],
  "schema_version": 1
}