1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624
|
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>check_postgres.pl>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a>
<ul>
<li><a href="#Output-Modes">Output Modes</a>
<ul>
<li><a href="#Nagios-output">Nagios output</a></li>
<li><a href="#MRTG-output">MRTG output</a></li>
<li><a href="#Simple-output">Simple output</a></li>
<li><a href="#Cacti-output">Cacti output</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#DATABASE-CONNECTION-OPTIONS">DATABASE CONNECTION OPTIONS</a></li>
<li><a href="#OTHER-OPTIONS">OTHER OPTIONS</a></li>
<li><a href="#ACTIONS">ACTIONS</a>
<ul>
<li><a href="#archive_ready">archive_ready</a></li>
<li><a href="#autovac_freeze">autovac_freeze</a></li>
<li><a href="#backends">backends</a></li>
<li><a href="#bloat">bloat</a></li>
<li><a href="#checkpoint">checkpoint</a></li>
<li><a href="#cluster_id">cluster_id</a></li>
<li><a href="#commitratio">commitratio</a></li>
<li><a href="#connection">connection</a></li>
<li><a href="#custom_query">custom_query</a></li>
<li><a href="#database_size">database_size</a></li>
<li><a href="#dbstats">dbstats</a></li>
<li><a href="#disabled_triggers">disabled_triggers</a></li>
<li><a href="#disk_space">disk_space</a></li>
<li><a href="#fsm_pages">fsm_pages</a></li>
<li><a href="#fsm_relations">fsm_relations</a></li>
<li><a href="#hitratio">hitratio</a></li>
<li><a href="#hot_standby_delay">hot_standby_delay</a></li>
<li><a href="#relation_size">relation_size</a></li>
<li><a href="#index_size">index_size</a></li>
<li><a href="#table_size">table_size</a></li>
<li><a href="#indexes_size">indexes_size</a></li>
<li><a href="#total_relation_size">total_relation_size</a></li>
<li><a href="#last_analyze">last_analyze</a></li>
<li><a href="#last_vacuum">last_vacuum</a></li>
<li><a href="#last_autoanalyze">last_autoanalyze</a></li>
<li><a href="#last_autovacuum">last_autovacuum</a></li>
<li><a href="#listener">listener</a></li>
<li><a href="#locks">locks</a></li>
<li><a href="#logfile">logfile</a></li>
<li><a href="#new_version_bc">new_version_bc</a></li>
<li><a href="#new_version_box">new_version_box</a></li>
<li><a href="#new_version_cp">new_version_cp</a></li>
<li><a href="#new_version_pg">new_version_pg</a></li>
<li><a href="#new_version_tnm">new_version_tnm</a></li>
<li><a href="#pgb_pool_cl_active">pgb_pool_cl_active</a></li>
<li><a href="#pgb_pool_cl_waiting">pgb_pool_cl_waiting</a></li>
<li><a href="#pgb_pool_sv_active">pgb_pool_sv_active</a></li>
<li><a href="#pgb_pool_sv_idle">pgb_pool_sv_idle</a></li>
<li><a href="#pgb_pool_sv_used">pgb_pool_sv_used</a></li>
<li><a href="#pgb_pool_sv_tested">pgb_pool_sv_tested</a></li>
<li><a href="#pgb_pool_sv_login">pgb_pool_sv_login</a></li>
<li><a href="#pgb_pool_maxwait">pgb_pool_maxwait</a></li>
<li><a href="#pgbouncer_backends">pgbouncer_backends</a></li>
<li><a href="#pgbouncer_checksum">pgbouncer_checksum</a></li>
<li><a href="#pgagent_jobs">pgagent_jobs</a></li>
<li><a href="#prepared_txns">prepared_txns</a></li>
<li><a href="#query_runtime">query_runtime</a></li>
<li><a href="#query_time">query_time</a></li>
<li><a href="#replicate_row">replicate_row</a></li>
<li><a href="#replication_slots">replication_slots</a></li>
<li><a href="#same_schema">same_schema</a></li>
<li><a href="#sequence1">sequence</a></li>
<li><a href="#settings_checksum">settings_checksum</a></li>
<li><a href="#slony_status">slony_status</a></li>
<li><a href="#timesync">timesync</a></li>
<li><a href="#txn_idle">txn_idle</a></li>
<li><a href="#txn_time">txn_time</a></li>
<li><a href="#txn_wraparound">txn_wraparound</a></li>
<li><a href="#version">version</a></li>
<li><a href="#wal_files">wal_files</a></li>
<li><a href="#rebuild_symlinks">rebuild_symlinks</a></li>
<li><a href="#rebuild_symlinks_force">rebuild_symlinks_force</a></li>
</ul>
</li>
<li><a href="#BASIC-FILTERING">BASIC FILTERING</a></li>
<li><a href="#USER-NAME-FILTERING">USER NAME FILTERING</a></li>
<li><a href="#TEST-MODE">TEST MODE</a></li>
<li><a href="#FILES">FILES</a></li>
<li><a href="#ENVIRONMENT-VARIABLES">ENVIRONMENT VARIABLES</a></li>
<li><a href="#TIPS-AND-TRICKS">TIPS AND TRICKS</a></li>
<li><a href="#DEPENDENCIES">DEPENDENCIES</a></li>
<li><a href="#DEVELOPMENT">DEVELOPMENT</a></li>
<li><a href="#MAILING-LIST">MAILING LIST</a></li>
<li><a href="#HISTORY">HISTORY</a></li>
<li><a href="#BUGS-AND-LIMITATIONS">BUGS AND LIMITATIONS</a></li>
<li><a href="#AUTHOR">AUTHOR</a></li>
<li><a href="#NAGIOS-EXAMPLES">NAGIOS EXAMPLES</a></li>
<li><a href="#LICENSE-AND-COPYRIGHT">LICENSE AND COPYRIGHT</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p><b>check_postgres.pl</b> - a Postgres monitoring script for Nagios, MRTG, Cacti, and others</p>
<p>This documents describes check_postgres.pl version 2.24.0</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<pre><code> ## Create all symlinks
check_postgres.pl --symlinks
## Check connection to Postgres database 'pluto':
check_postgres.pl --action=connection --db=pluto
## Same things, but using the symlink
check_postgres_connection --db=pluto
## Warn if > 100 locks, critical if > 200, or > 20 exclusive
check_postgres_locks --warning=100 --critical="total=200:exclusive=20"
## Show the current number of idle connections on port 6543:
check_postgres_txn_idle --port=6543 --output=simple
## There are many other actions and options, please keep reading.
The latest news and documentation can always be found at:
https://bucardo.org/check_postgres/</code></pre>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>check_postgres.pl is a Perl script that runs many different tests against one or more Postgres databases. It uses the psql program to gather the information, and outputs the results in one of three formats: Nagios, MRTG, or simple.</p>
<h2 id="Output-Modes">Output Modes</h2>
<p>The output can be changed by use of the <code>--output</code> option. The default output is nagios, although this can be changed at the top of the script if you wish. The current option choices are <b>nagios</b>, <b>mrtg</b>, and <b>simple</b>. To avoid having to enter the output argument each time, the type of output is automatically set if no --output argument is given, and if the current directory has one of the output options in its name. For example, creating a directory named mrtg and populating it with symlinks via the <i>--symlinks</i> argument would ensure that any actions run from that directory will always default to an output of "mrtg" As a shortcut for --output=simple, you can enter --simple, which also overrides the directory naming trick.</p>
<h3 id="Nagios-output">Nagios output</h3>
<p>The default output format is for Nagios, which is a single line of information, along with four specific exit codes:</p>
<dl>
<dt id="OK">0 (OK)</dt>
<dd>
</dd>
<dt id="WARNING">1 (WARNING)</dt>
<dd>
</dd>
<dt id="CRITICAL">2 (CRITICAL)</dt>
<dd>
</dd>
<dt id="UNKNOWN">3 (UNKNOWN)</dt>
<dd>
</dd>
</dl>
<p>The output line is one of the words above, a colon, and then a short description of what was measured. Additional statistics information, as well as the total time the command took, can be output as well: see the documentation on the arguments <i><a href="#showperf-VAL">--showperf</a></i>, <i><a href="#perflimit-i">--perflimit</a></i>, and <i><a href="#showtime-VAL">--showtime</a></i>.</p>
<h3 id="MRTG-output">MRTG output</h3>
<p>The MRTG output is four lines, with the first line always giving a single number of importance. When possible, this number represents an actual value such as a number of bytes, but it may also be a 1 or a 0 for actions that only return "true" or "false", such as check_postgres_version. The second line is an additional stat and is only used for some actions. The third line indicates an "uptime" and is not used. The fourth line is a description and usually indicates the name of the database the stat from the first line was pulled from, but may be different depending on the action.</p>
<p>Some actions accept an optional <i>--mrtg</i> argument to further control the output.</p>
<p>See the documentation on each action for details on the exact MRTG output for each one.</p>
<h3 id="Simple-output">Simple output</h3>
<p>The simple output is simply a truncated version of the MRTG one, and simply returns the first number and nothing else. This is very useful when you just want to check the state of something, regardless of any threshold. You can transform the numeric output by appending KB, MB, GB, TB, or EB to the output argument, for example:</p>
<pre><code> --output=simple,MB</code></pre>
<h3 id="Cacti-output">Cacti output</h3>
<p>The Cacti output consists of one or more items on the same line, with a simple name, a colon, and then a number. At the moment, the only action with explicit Cacti output is 'dbstats', and using the --output option is not needed in this case, as Cacti is the only output for this action. For many other actions, using --simple is enough to make Cacti happy.</p>
<h1 id="DATABASE-CONNECTION-OPTIONS">DATABASE CONNECTION OPTIONS</h1>
<p>All actions accept a common set of database options.</p>
<dl>
<dt id="H-NAME-or---host-NAME"><b>-H NAME</b> or <b>--host=NAME</b></dt>
<dd>
<p>Connect to the host indicated by NAME. Can be a comma-separated list of names. Multiple host arguments are allowed. If no host is given, defaults to the <code>PGHOST</code> environment variable or no host at all (which indicates using a local Unix socket). You may also use "--dbhost".</p>
</dd>
<dt id="p-PORT-or---port-PORT"><b>-p PORT</b> or <b>--port=PORT</b></dt>
<dd>
<p>Connects using the specified PORT number. Can be a comma-separated list of port numbers, and multiple port arguments are allowed. If no port number is given, defaults to the <code>PGPORT</code> environment variable. If that is not set, it defaults to 5432. You may also use "--dbport"</p>
</dd>
<dt id="db-NAME-or---dbname-NAME"><b>-db NAME</b> or <b>--dbname=NAME</b></dt>
<dd>
<p>Specifies which database to connect to. Can be a comma-separated list of names, and multiple dbname arguments are allowed. If no dbname option is provided, defaults to the <code>PGDATABASE</code> environment variable. If that is not set, it defaults to 'postgres' if psql is version 8 or greater, and 'template1' otherwise.</p>
</dd>
<dt id="u-USERNAME-or---dbuser-USERNAME"><b>-u USERNAME</b> or <b>--dbuser=USERNAME</b></dt>
<dd>
<p>The name of the database user to connect as. Can be a comma-separated list of usernames, and multiple dbuser arguments are allowed. If this is not provided, it defaults to the <code>PGUSER</code> environment variable, otherwise it defaults to 'postgres'.</p>
</dd>
<dt id="dbpass-PASSWORD"><b>--dbpass=PASSWORD</b></dt>
<dd>
<p>Provides the password to connect to the database with. Use of this option is highly discouraged. Instead, one should use a .pgpass or pg_service.conf file.</p>
</dd>
<dt id="dbservice-NAME"><b>--dbservice=NAME</b></dt>
<dd>
<p>The name of a service inside of the pg_service.conf file. Before version 9.0 of Postgres, this is a global file, usually found in /etc/pg_service.conf. If you are using version 9.0 or higher of Postgres, you can use the file ".pg_service.conf" in the home directory of the user running the script, e.g. nagios.</p>
<p>This file contains a simple list of connection options. You can also pass additional information when using this option such as --dbservice="maindatabase sslmode=require"</p>
<p>The documentation for this file can be found at https://www.postgresql.org/docs/current/static/libpq-pgservice.html</p>
</dd>
</dl>
<p>The database connection options can be grouped: <i>--host=a,b --host=c --port=1234 --port=3344</i> would connect to a-1234, b-1234, and c-3344. Note that once set, an option carries over until it is changed again.</p>
<p>Examples:</p>
<pre><code> --host=a,b --port=5433 --db=c
Connects twice to port 5433, using database c, to hosts a and b: a-5433-c b-5433-c
--host=a,b --port=5433 --db=c,d
Connects four times: a-5433-c a-5433-d b-5433-c b-5433-d
--host=a,b --host=foo --port=1234 --port=5433 --db=e,f
Connects six times: a-1234-e a-1234-f b-1234-e b-1234-f foo-5433-e foo-5433-f
--host=a,b --host=x --port=5432,5433 --dbuser=alice --dbuser=bob -db=baz
Connects three times: a-5432-alice-baz b-5433-alice-baz x-5433-bob-baz
--dbservice="foo" --port=5433
Connects using the named service 'foo' in the pg_service.conf file, but overrides the port</code></pre>
<h1 id="OTHER-OPTIONS">OTHER OPTIONS</h1>
<p>Other options include:</p>
<dl>
<dt id="action-NAME"><b>--action=NAME</b></dt>
<dd>
<p>States what action we are running. Required unless using a symlinked file, in which case the name of the file is used to figure out the action.</p>
</dd>
<dt id="warning-VAL-or--w-VAL"><b>--warning=VAL or -w VAL</b></dt>
<dd>
<p>Sets the threshold at which a warning alert is fired. The valid options for this option depends on the action used.</p>
</dd>
<dt id="critical-VAL-or--c-VAL"><b>--critical=VAL or -c VAL</b></dt>
<dd>
<p>Sets the threshold at which a critical alert is fired. The valid options for this option depends on the action used.</p>
</dd>
<dt id="t-VAL-or---timeout-VAL"><b>-t VAL</b> or <b>--timeout=VAL</b></dt>
<dd>
<p>Sets the timeout in seconds after which the script will abort whatever it is doing and return an UNKNOWN status. The timeout is per Postgres cluster, not for the entire script. The default value is 10; the units are always in seconds.</p>
</dd>
<dt id="assume-standby-mode"><b>--assume-standby-mode</b></dt>
<dd>
<p>If specified, first the check if server in standby mode will be performed (--datadir is required), if so, all checks that require SQL queries will be ignored and "Server in standby mode" with OK status will be returned instead.</p>
<p>Example:</p>
<pre><code> postgres@db$./check_postgres.pl --action=version --warning=8.1 --datadir /var/lib/postgresql/8.3/main/ --assume-standby-mode
POSTGRES_VERSION OK: Server in standby mode | time=0.00</code></pre>
</dd>
<dt id="assume-prod"><b>--assume-prod</b></dt>
<dd>
<p>If specified, check if server in production mode is performed (--datadir is required). The option is only relevant for (<code>symlink: check_postgres_checkpoint</code>).</p>
<p>Example:</p>
<pre><code> postgres@db$./check_postgres.pl --action=checkpoint --datadir /var/lib/postgresql/8.3/main/ --assume-prod
POSTGRES_CHECKPOINT OK: Last checkpoint was 72 seconds ago | age=72;;300 mode=MASTER</code></pre>
</dd>
<dt id="assume-async"><b>--assume-async</b></dt>
<dd>
<p>If specified, indicates that any replication between servers is asynchronous. The option is only relevant for (<code>symlink: check_postgres_same_schema</code>).</p>
<p>Example: postgres@db$./check_postgres.pl --action=same_schema --assume-async --dbhost=star,line</p>
</dd>
<dt id="h-or---help"><b>-h</b> or <b>--help</b></dt>
<dd>
<p>Displays a help screen with a summary of all actions and options.</p>
</dd>
<dt id="man"><b>--man</b></dt>
<dd>
<p>Displays the entire manual.</p>
</dd>
<dt id="V-or---version"><b>-V</b> or <b>--version</b></dt>
<dd>
<p>Shows the current version.</p>
</dd>
<dt id="v-or---verbose"><b>-v</b> or <b>--verbose</b></dt>
<dd>
<p>Set the verbosity level. Can call more than once to boost the level. Setting it to three or higher (in other words, issuing <code>-v -v -v</code>) turns on debugging information for this program which is sent to stderr.</p>
</dd>
<dt id="showperf-VAL"><b>--showperf=VAL</b></dt>
<dd>
<p>Determines if we output additional performance data in standard Nagios format (at end of string, after a pipe symbol, using name=value). VAL should be 0 or 1. The default is 1. Only takes effect if using Nagios output mode.</p>
</dd>
<dt id="perflimit-i"><b>--perflimit=i</b></dt>
<dd>
<p>Sets a limit as to how many items of interest are reported back when using the <i>showperf</i> option. This only has an effect for actions that return a large number of items, such as <b>table_size</b>. The default is 0, or no limit. Be careful when using this with the <i>--include</i> or <i>--exclude</i> options, as those restrictions are done <i>after</i> the query has been run, and thus your limit may not include the items you want. Only takes effect if using Nagios output mode.</p>
</dd>
<dt id="showtime-VAL"><b>--showtime=VAL</b></dt>
<dd>
<p>Determines if the time taken to run each query is shown in the output. VAL should be 0 or 1. The default is 1. No effect unless <i>showperf</i> is on. Only takes effect if using Nagios output mode.</p>
</dd>
<dt id="test"><b>--test</b></dt>
<dd>
<p>Enables test mode. See the <a href="#TEST-MODE">"TEST MODE"</a> section below.</p>
</dd>
<dt id="PGBINDIR-PATH"><b>--PGBINDIR=PATH</b></dt>
<dd>
<p>Tells the script where to find the psql binaries. Useful if you have more than one version of the PostgreSQL executables on your system, or if there are not in your path. Note that this option is in all uppercase. By default, this option is <i>not allowed</i>. To enable it, you must change the <code>$NO_PSQL_OPTION</code> near the top of the script to 0. Avoid using this option if you can, and instead use environment variable c<PGBINDIR> or hard-coded <code>$PGBINDIR</code> variable, also near the top of the script, to set the path to the PostgreSQL to use.</p>
</dd>
<dt id="PSQL-PATH"><b>--PSQL=PATH</b></dt>
<dd>
<p><i>(deprecated, this option may be removed in a future release!)</i> Tells the script where to find the psql program. Useful if you have more than one version of the psql executable on your system, or if there is no psql program in your path. Note that this option is in all uppercase. By default, this option is <i>not allowed</i>. To enable it, you must change the <code>$NO_PSQL_OPTION</code> near the top of the script to 0. Avoid using this option if you can, and instead hard-code your psql location into the <code>$PSQL</code> variable, also near the top of the script.</p>
</dd>
<dt id="symlinks"><b>--symlinks</b></dt>
<dd>
<p>Creates symlinks to the main program for each action.</p>
</dd>
<dt id="output-VAL"><b>--output=VAL</b></dt>
<dd>
<p>Determines the format of the output, for use in various programs. The default is 'nagios'. Available options are 'nagios', 'mrtg', 'simple' and 'cacti'.</p>
</dd>
<dt id="mrtg-VAL"><b>--mrtg=VAL</b></dt>
<dd>
<p>Used only for the MRTG or simple output, for a few specific actions.</p>
</dd>
<dt id="debugoutput-VAL"><b>--debugoutput=VAL</b></dt>
<dd>
<p>Outputs the exact string returned by psql, for use in debugging. The value is one or more letters, which determine if the output is displayed or not, where 'a' = all, 'c' = critical, 'w' = warning, 'o' = ok, and 'u' = unknown. Letters can be combined.</p>
</dd>
<dt id="get_method-VAL"><b>--get_method=VAL</b></dt>
<dd>
<p>Allows specification of the method used to fetch information for the <code>new_version_cp</code>, <code>new_version_pg</code>, <code>new_version_bc</code>, <code>new_version_box</code>, and <code>new_version_tnm</code> checks. The following programs are tried, in order, to grab the information from the web: GET, wget, fetch, curl, lynx, links. To force the use of just one (and thus remove the overhead of trying all the others until one of those works), enter one of the names as the argument to get_method. For example, a BSD box might enter the following line in their <code>.check_postgresrc</code> file:</p>
<pre><code> get_method=fetch</code></pre>
</dd>
<dt id="language-VAL"><b>--language=VAL</b></dt>
<dd>
<p>Set the language to use for all output messages. Normally, this is detected by examining the environment variables LC_ALL, LC_MESSAGES, and LANG, but setting this option will override any such detection.</p>
</dd>
</dl>
<h1 id="ACTIONS">ACTIONS</h1>
<p>The action to be run is selected using the --action flag, or by using a symlink to the main file that contains the name of the action inside of it. For example, to run the action "timesync", you may either issue:</p>
<pre><code> check_postgres.pl --action=timesync</code></pre>
<p>or use a program named:</p>
<pre><code> check_postgres_timesync</code></pre>
<p>All the symlinks are created for you in the current directory if use the option --symlinks:</p>
<pre><code> perl check_postgres.pl --symlinks</code></pre>
<p>If the file name already exists, it will not be overwritten. If the file exists and is a symlink, you can force it to overwrite by using "--action=build_symlinks_force".</p>
<p>Most actions take a <i>--warning</i> and a <i>--critical</i> option, indicating at what point we change from OK to WARNING, and what point we go to CRITICAL. Note that because criticals are always checked first, setting the warning equal to the critical is an effective way to turn warnings off and always give a critical.</p>
<p>The current supported actions are:</p>
<h2 id="archive_ready"><b>archive_ready</b></h2>
<p>(<code>symlink: check_postgres_archive_ready</code>) Checks how many WAL files with extension <i>.ready</i> exist in the <i>pg_xlog/archive_status</i> directory (PostgreSQL 10 and later: <i>pg_wal/archive_status</i>), which is found off of your <b>data_directory</b>. If the <i>--lsfunc</i> option is not used then this action must be run as a superuser, in order to access the contents of the <i>pg_xlog/archive_status</i> directory. The minimum version to use this action is Postgres 8.1. The <i>--warning</i> and <i>--critical</i> options are simply the number of <i>.ready</i> files in the <i>pg_xlog/archive_status</i> directory. Usually, these values should be low, turning on the archive mechanism, we usually want it to archive WAL files as fast as possible.</p>
<p>If the archive command fail, number of WAL in your <i>pg_xlog</i> directory will grow until exhausting all the disk space and force PostgreSQL to stop immediately.</p>
<p>To avoid connecting as a database superuser, a wrapper function around <code>pg_ls_dir()</code> should be defined as a superuser with SECURITY DEFINER, and the <i>--lsfunc</i> option used. This example function, if defined by a superuser, will allow the script to connect as a normal user <i>nagios</i> with <i>--lsfunc=ls_archive_status_dir</i></p>
<pre><code> BEGIN;
CREATE FUNCTION ls_archive_status_dir()
RETURNS SETOF TEXT
AS $$ SELECT pg_ls_dir('pg_xlog/archive_status') $$
LANGUAGE SQL
SECURITY DEFINER;
REVOKE ALL ON FUNCTION ls_archive_status_dir() FROM PUBLIC;
GRANT EXECUTE ON FUNCTION ls_archive_status_dir() to nagios;
COMMIT;</code></pre>
<p>Example 1: Check that the number of ready WAL files is 10 or less on host "pluto", using a wrapper function <code>ls_archive_status_dir</code> to avoid the need for superuser permissions</p>
<pre><code> check_postgres_archive_ready --host=pluto --critical=10 --lsfunc=ls_archive_status_dir</code></pre>
<p>For MRTG output, reports the number of ready WAL files on line 1.</p>
<h2 id="autovac_freeze"><b>autovac_freeze</b></h2>
<p>(<code>symlink: check_postgres_autovac_freeze</code>) Checks how close each database is to the Postgres <b>autovacuum_freeze_max_age</b> setting. This action will only work for databases version 8.2 or higher. The <i>--warning</i> and <i>--critical</i> options should be expressed as percentages. The 'age' of the transactions in each database is compared to the autovacuum_freeze_max_age setting (200 million by default) to generate a rounded percentage. The default values are <b>90%</b> for the warning and <b>95%</b> for the critical. Databases can be filtered by use of the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details.</p>
<p>Example 1: Give a warning when any databases on port 5432 are above 97%</p>
<pre><code> check_postgres_autovac_freeze --port=5432 --warning="97%"</code></pre>
<p>For MRTG output, the highest overall percentage is reported on the first line, and the highest age is reported on the second line. All databases which have the percentage from the first line are reported on the fourth line, separated by a pipe symbol.</p>
<h2 id="backends"><b>backends</b></h2>
<p>(<code>symlink: check_postgres_backends</code>) Checks the current number of connections for one or more databases, and optionally compares it to the maximum allowed, which is determined by the Postgres configuration variable <b>max_connections</b>. The <i>--warning</i> and <i>--critical</i> options can take one of three forms. First, a simple number can be given, which represents the number of connections at which the alert will be given. This choice does not use the <b>max_connections</b> setting. Second, the percentage of available connections can be given. Third, a negative number can be given which represents the number of connections left until <b>max_connections</b> is reached. The default values for <i>--warning</i> and <i>--critical</i> are '90%' and '95%'. You can also filter the databases by use of the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details.</p>
<p>To view only non-idle processes, you can use the <i>--noidle</i> argument. Note that the user you are connecting as must be a superuser for this to work properly.</p>
<p>Example 1: Give a warning when the number of connections on host quirm reaches 120, and a critical if it reaches 150.</p>
<pre><code> check_postgres_backends --host=quirm --warning=120 --critical=150</code></pre>
<p>Example 2: Give a critical when we reach 75% of our max_connections setting on hosts lancre or lancre2.</p>
<pre><code> check_postgres_backends --warning='75%' --critical='75%' --host=lancre,lancre2</code></pre>
<p>Example 3: Give a warning when there are only 10 more connection slots left on host plasmid, and a critical when we have only 5 left.</p>
<pre><code> check_postgres_backends --warning=-10 --critical=-5 --host=plasmid</code></pre>
<p>Example 4: Check all databases except those with "test" in their name, but allow ones that are named "pg_greatest". Connect as port 5432 on the first two hosts, and as port 5433 on the third one. We want to always throw a critical when we reach 30 or more connections.</p>
<pre><code> check_postgres_backends --dbhost=hong,kong --dbhost=fooey --dbport=5432 --dbport=5433 --warning=30 --critical=30 --exclude="~test" --include="pg_greatest,~prod"</code></pre>
<p>For MRTG output, the number of connections is reported on the first line, and the fourth line gives the name of the database, plus the current maximum_connections. If more than one database has been queried, the one with the highest number of connections is output.</p>
<h2 id="bloat"><b>bloat</b></h2>
<p>(<code>symlink: check_postgres_bloat</code>) Checks the amount of bloat in tables and indexes. (Bloat is generally the amount of dead unused space taken up in a table or index. This space is usually reclaimed by use of the VACUUM command.) This action requires that stats collection be enabled on the target databases, and requires that ANALYZE is run frequently. The <i>--include</i> and <i>--exclude</i> options can be used to filter out which tables to look at. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details.</p>
<p>The <i>--warning</i> and <i>--critical</i> options can be specified as sizes, percents, or both. Valid size units are bytes, kilobytes, megabytes, gigabytes, terabytes, exabytes, petabytes, and zettabytes. You can abbreviate all of those with the first letter. Items without units are assumed to be 'bytes'. The default values are '1 GB' and '5 GB'. The value represents the number of "wasted bytes", or the difference between what is actually used by the table and index, and what we compute that it should be.</p>
<p>Note that this action has two hard-coded values to avoid false alarms on smaller relations. Tables must have at least 10 pages, and indexes at least 15, before they can be considered by this test. If you really want to adjust these values, you can look for the variables <i>$MINPAGES</i> and <i>$MINIPAGES</i> at the top of the <code>check_bloat</code> subroutine. These values are ignored if either <i>--exclude</i> or <i>--include</i> is used.</p>
<p>Only the top 10 most bloated relations are shown. You can change this number by using the <i>--perflimit</i> option to set your own limit.</p>
<p>The schema named 'information_schema' is excluded from this test, as the only tables it contains are small and do not change.</p>
<p>Please note that the values computed by this action are not precise, and should be used as a guideline only. Great effort was made to estimate the correct size of a table, but in the end it is only an estimate. The correct index size is even more of a guess than the correct table size, but both should give a rough idea of how bloated things are.</p>
<p>Example 1: Warn if any table on port 5432 is over 100 MB bloated, and critical if over 200 MB</p>
<pre><code> check_postgres_bloat --port=5432 --warning='100 M' --critical='200 M'</code></pre>
<p>Example 2: Give a critical if table 'orders' on host 'sami' has more than 10 megs of bloat</p>
<pre><code> check_postgres_bloat --host=sami --include=orders --critical='10 MB'</code></pre>
<p>Example 3: Give a critical if table 'q4' on database 'sales' is over 50% bloated</p>
<pre><code> check_postgres_bloat --db=sales --include=q4 --critical='50%'</code></pre>
<p>Example 4: Give a critical any table is over 20% bloated <i>and</i> has over 150 MB of bloat:</p>
<pre><code> check_postgres_bloat --port=5432 --critical='20% and 150 M'</code></pre>
<p>Example 5: Give a critical any table is over 40% bloated <i>or</i> has over 500 MB of bloat:</p>
<pre><code> check_postgres_bloat --port=5432 --warning='500 M or 40%'</code></pre>
<p>For MRTG output, the first line gives the highest number of wasted bytes for the tables, and the second line gives the highest number of wasted bytes for the indexes. The fourth line gives the database name, table name, and index name information. If you want to output the bloat ratio instead (how many times larger the relation is compared to how large it should be), just pass in <code>--mrtg=ratio</code>.</p>
<h2 id="checkpoint"><b>checkpoint</b></h2>
<p>(<code>symlink: check_postgres_checkpoint</code>) Determines how long since the last checkpoint has been run. This must run on the same server as the database that is being checked (e.g. the -h flag will not work). This check is meant to run on a "warm standby" server that is actively processing shipped WAL files, and is meant to check that your warm standby is truly 'warm'. The data directory must be set, either by the environment variable <code>PGDATA</code>, or passing the <code>--datadir</code> argument. It returns the number of seconds since the last checkpoint was run, as determined by parsing the call to <code>pg_controldata</code>. Because of this, the pg_controldata executable must be available in the current path. Alternatively, you can specify <code>PGBINDIR</code> as the directory that it lives in. It is also possible to use the special options <i>--assume-prod</i> or <i>--assume-standby-mode</i>, if the mode found is not the one expected, a CRITICAL is emitted.</p>
<p>At least one warning or critical argument must be set.</p>
<p>This action requires the Date::Parse module.</p>
<p>For MRTG or simple output, returns the number of seconds.</p>
<h2 id="cluster_id"><b>cluster_id</b></h2>
<p>(<code>symlink: check_postgres_cluster-id</code>) Checks that the Database System Identifier provided by pg_controldata is the same as last time you checked. This must run on the same server as the database that is being checked (e.g. the -h flag will not work). Either the <i>--warning</i> or the <i>--critical</i> option should be given, but not both. The value of each one is the cluster identifier, an integer value. You can run with the special <code>--critical=0</code> option to find out an existing cluster identifier.</p>
<p>Example 1: Find the initial identifier</p>
<pre><code> check_postgres_cluster_id --critical=0 --datadir=/var//lib/postgresql/9.0/main</code></pre>
<p>Example 2: Make sure the cluster is the same and warn if not, using the result from above.</p>
<pre><code> check_postgres_cluster_id --critical=5633695740047915135</code></pre>
<p>For MRTG output, returns a 1 or 0 indicating success of failure of the identifier to match. A identifier must be provided as the <code>--mrtg</code> argument. The fourth line always gives the current identifier.</p>
<h2 id="commitratio"><b>commitratio</b></h2>
<p>(<code>symlink: check_postgres_commitratio</code>) Checks the commit ratio of all databases and complains when they are too low. There is no need to run this command more than once per database cluster. Databases can be filtered with the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details. They can also be filtered by the owner of the database with the <i>--includeuser</i> and <i>--excludeuser</i> options. See the <a href="#USER-NAME-FILTERING">"USER NAME FILTERING"</a> section for more details.</p>
<p>The warning and critical options should be specified as percentages. There are not defaults for this action: the warning and critical must be specified. The warning value cannot be greater than the critical value. The output returns all databases sorted by commitratio, smallest first.</p>
<p>Example: Warn if any database on host flagg is less than 90% in commitratio, and critical if less then 80%.</p>
<pre><code> check_postgres_database_commitratio --host=flagg --warning='90%' --critical='80%'</code></pre>
<p>For MRTG output, returns the percentage of the database with the smallest commitratio on the first line, and the name of the database on the fourth line.</p>
<h2 id="connection"><b>connection</b></h2>
<p>(<code>symlink: check_postgres_connection</code>) Simply connects, issues a 'SELECT version()', and leaves. Takes no <i>--warning</i> or <i>--critical</i> options.</p>
<p>For MRTG output, simply outputs a 1 (good connection) or a 0 (bad connection) on the first line.</p>
<h2 id="custom_query"><b>custom_query</b></h2>
<p>(<code>symlink: check_postgres_custom_query</code>) Runs a custom query of your choosing, and parses the results. The query itself is passed in through the <code>query</code> argument, and should be kept as simple as possible. If at all possible, wrap it in a view or a function to keep things easier to manage. The query should return one or two columns. It is required that one of the columns be named "result" and is the item that will be checked against your warning and critical values. The second column is for the performance data and any name can be used: this will be the 'value' inside the performance data section.</p>
<p>At least one warning or critical argument must be specified. What these are set to depends on the type of query you are running. There are four types of custom_queries that can be run, specified by the <code>valtype</code> argument. If none is specified, this action defaults to 'integer'. The four types are:</p>
<p><b>integer</b>: Does a simple integer comparison. The first column should be a simple integer, and the warning and critical values should be the same.</p>
<p><b>string</b>: The warning and critical are strings, and are triggered only if the value in the first column matches it exactly. This is case-sensitive.</p>
<p><b>time</b>: The warning and the critical are times, and can have units of seconds, minutes, hours, or days. Each may be written singular or abbreviated to just the first letter. If no units are given, seconds are assumed. The first column should be an integer representing the number of seconds to check.</p>
<p><b>size</b>: The warning and the critical are sizes, and can have units of bytes, kilobytes, megabytes, gigabytes, terabytes, or exabytes. Each may be abbreviated to the first letter. If no units are given, bytes are assumed. The first column should be an integer representing the number of bytes to check.</p>
<p>Normally, an alert is triggered if the values returned are <b>greater than</b> or equal to the critical or warning value. However, an option of <i>--reverse</i> will trigger the alert if the returned value is <b>lower than</b> or equal to the critical or warning value.</p>
<p>Example 1: Warn if any relation over 100 pages is named "rad", put the number of pages inside the performance data section.</p>
<pre><code> check_postgres_custom_query --valtype=string -w "rad" --query=
"SELECT relname AS result, relpages AS pages FROM pg_class WHERE relpages > 100"</code></pre>
<p>Example 2: Give a critical if the "foobar" function returns a number over 5MB:</p>
<pre><code> check_postgres_custom_query --critical='5MB'--valtype=size --query="SELECT foobar() AS result"</code></pre>
<p>Example 2: Warn if the function "snazzo" returns less than 42:</p>
<pre><code> check_postgres_custom_query --critical=42 --query="SELECT snazzo() AS result" --reverse</code></pre>
<p>If you come up with a useful custom_query, consider sending in a patch to this program to make it into a standard action that other people can use.</p>
<p>This action does not support MRTG or simple output yet.</p>
<h2 id="database_size"><b>database_size</b></h2>
<p>(<code>symlink: check_postgres_database_size</code>) Checks the size of all databases and complains when they are too big. There is no need to run this command more than once per database cluster. Databases can be filtered with the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details. They can also be filtered by the owner of the database with the <i>--includeuser</i> and <i>--excludeuser</i> options. See the <a href="#USER-NAME-FILTERING">"USER NAME FILTERING"</a> section for more details.</p>
<p>The warning and critical options can be specified as bytes, kilobytes, megabytes, gigabytes, terabytes, or exabytes. Each may be abbreviated to the first letter as well. If no unit is given, the units are assumed to be bytes. There are not defaults for this action: the warning and critical must be specified. The warning value cannot be greater than the critical value. The output returns all databases sorted by size largest first, showing both raw bytes and a "pretty" version of the size.</p>
<p>Example 1: Warn if any database on host flagg is over 1 TB in size, and critical if over 1.1 TB.</p>
<pre><code> check_postgres_database_size --host=flagg --warning='1 TB' --critical='1.1 t'</code></pre>
<p>Example 2: Give a critical if the database template1 on port 5432 is over 10 MB.</p>
<pre><code> check_postgres_database_size --port=5432 --include=template1 --warning='10MB' --critical='10MB'</code></pre>
<p>Example 3: Give a warning if any database on host 'tardis' owned by the user 'tom' is over 5 GB</p>
<pre><code> check_postgres_database_size --host=tardis --includeuser=tom --warning='5 GB' --critical='10 GB'</code></pre>
<p>For MRTG output, returns the size in bytes of the largest database on the first line, and the name of the database on the fourth line.</p>
<h2 id="dbstats"><b>dbstats</b></h2>
<p>(<code>symlink: check_postgres_dbstats</code>) Reports information from the pg_stat_database view, and outputs it in a Cacti-friendly manner. No other output is supported, as the output is informational and does not lend itself to alerts, such as used with Nagios. If no options are given, all databases are returned, one per line. You can include a specific database by use of the <code>--include</code> option, or you can use the <code>--dbname</code> option.</p>
<p>Eleven items are returned on each line, in the format name:value, separated by a single space. The items are:</p>
<dl>
<dt id="backends1">backends</dt>
<dd>
<p>The number of currently running backends for this database.</p>
</dd>
<dt id="commits">commits</dt>
<dd>
<p>The total number of commits for this database since it was created or reset.</p>
</dd>
<dt id="rollbacks">rollbacks</dt>
<dd>
<p>The total number of rollbacks for this database since it was created or reset.</p>
</dd>
<dt id="read">read</dt>
<dd>
<p>The total number of disk blocks read.</p>
</dd>
<dt id="hit">hit</dt>
<dd>
<p>The total number of buffer hits.</p>
</dd>
<dt id="ret">ret</dt>
<dd>
<p>The total number of rows returned.</p>
</dd>
<dt id="fetch">fetch</dt>
<dd>
<p>The total number of rows fetched.</p>
</dd>
<dt id="ins">ins</dt>
<dd>
<p>The total number of rows inserted.</p>
</dd>
<dt id="upd">upd</dt>
<dd>
<p>The total number of rows updated.</p>
</dd>
<dt id="del">del</dt>
<dd>
<p>The total number of rows deleted.</p>
</dd>
<dt id="dbname">dbname</dt>
<dd>
<p>The name of the database.</p>
</dd>
</dl>
<p>Note that ret, fetch, ins, upd, and del items will always be 0 if Postgres is version 8.2 or lower, as those stats were not available in those versions.</p>
<p>If the dbname argument is given, seven additional items are returned:</p>
<dl>
<dt id="idxscan">idxscan</dt>
<dd>
<p>Total number of user index scans.</p>
</dd>
<dt id="idxtupread">idxtupread</dt>
<dd>
<p>Total number of user index entries returned.</p>
</dd>
<dt id="idxtupfetch">idxtupfetch</dt>
<dd>
<p>Total number of rows fetched by simple user index scans.</p>
</dd>
<dt id="idxblksread">idxblksread</dt>
<dd>
<p>Total number of disk blocks read for all user indexes.</p>
</dd>
<dt id="idxblkshit">idxblkshit</dt>
<dd>
<p>Total number of buffer hits for all user indexes.</p>
</dd>
<dt id="seqscan">seqscan</dt>
<dd>
<p>Total number of sequential scans against all user tables.</p>
</dd>
<dt id="seqtupread">seqtupread</dt>
<dd>
<p>Total number of tuples returned from all user tables.</p>
</dd>
</dl>
<p>Example 1: Grab the stats for a database named "products" on host "willow":</p>
<pre><code> check_postgres_dbstats --dbhost willow --dbname products</code></pre>
<p>The output returned will be like this (all on one line, not wrapped):</p>
<pre><code> backends:82 commits:58374408 rollbacks:1651 read:268435543 hit:2920381758 idxscan:310931294 idxtupread:2777040927
idxtupfetch:1840241349 idxblksread:62860110 idxblkshit:1107812216 seqscan:5085305 seqtupread:5370500520
ret:0 fetch:0 ins:0 upd:0 del:0 dbname:willow</code></pre>
<h2 id="disabled_triggers"><b>disabled_triggers</b></h2>
<p>(<code>symlink: check_postgres_disabled_triggers</code>) Checks on the number of disabled triggers inside the database. The <i>--warning</i> and <i>--critical</i> options are the number of such triggers found, and both default to "1", as in normal usage having disabled triggers is a dangerous event. If the database being checked is 8.3 or higher, the check is for the number of triggers that are in a 'disabled' status (as opposed to being 'always' or 'replica'). The output will show the name of the table and the name of the trigger for each disabled trigger.</p>
<p>Example 1: Make sure that there are no disabled triggers</p>
<pre><code> check_postgres_disabled_triggers</code></pre>
<p>For MRTG output, returns the number of disabled triggers on the first line.</p>
<h2 id="disk_space"><b>disk_space</b></h2>
<p>(<code>symlink: check_postgres_disk_space</code>) Checks on the available physical disk space used by Postgres. This action requires that you have the executable "/bin/df" available to report on disk sizes, and it also needs to be run as a superuser, so it can examine the <b>data_directory</b> setting inside of Postgres. The <i>--warning</i> and <i>--critical</i> options are given in either sizes or percentages or both. If using sizes, the standard unit types are allowed: bytes, kilobytes, gigabytes, megabytes, gigabytes, terabytes, or exabytes. Each may be abbreviated to the first letter only; no units at all indicates 'bytes'. The default values are '90%' and '95%'.</p>
<p>This command checks the following things to determine all of the different physical disks being used by Postgres.</p>
<p><b>data_directory</b> - The disk that the main data directory is on.</p>
<p><b>log directory</b> - The disk that the log files are on.</p>
<p><b>WAL file directory</b> - The disk that the write-ahead logs are on (e.g. symlinked pg_xlog or pg_wal)</p>
<p><b>tablespaces</b> - Each tablespace that is on a separate disk.</p>
<p>The output shows the total size used and available on each disk, as well as the percentage, ordered by highest to lowest percentage used. Each item above maps to a file system: these can be included or excluded. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details.</p>
<p>Example 1: Make sure that no file system is over 90% for the database on port 5432.</p>
<pre><code> check_postgres_disk_space --port=5432 --warning='90%' --critical='90%'</code></pre>
<p>Example 2: Check that all file systems starting with /dev/sda are smaller than 10 GB and 11 GB (warning and critical)</p>
<pre><code> check_postgres_disk_space --port=5432 --warning='10 GB' --critical='11 GB' --include="~^/dev/sda"</code></pre>
<p>Example 4: Make sure that no file system is both over 50% <i>and</i> has over 15 GB</p>
<pre><code> check_postgres_disk_space --critical='50% and 15 GB'</code></pre>
<p>Example 5: Issue a warning if any file system is either over 70% full <i>or</i> has more than 1T</p>
<pre><code> check_postgres_disk_space --warning='1T or 75'</code></pre>
<p>For MRTG output, returns the size in bytes of the file system on the first line, and the name of the file system on the fourth line.</p>
<h2 id="fsm_pages"><b>fsm_pages</b></h2>
<p>(<code>symlink: check_postgres_fsm_pages</code>) Checks how close a cluster is to the Postgres <b>max_fsm_pages</b> setting. This action will only work for databases of 8.2 or higher, and it requires the contrib module <b>pg_freespacemap</b> be installed. The <i>--warning</i> and <i>--critical</i> options should be expressed as percentages. The number of used pages in the free-space-map is determined by looking in the pg_freespacemap_relations view, and running a formula based on the formula used for outputting free-space-map pageslots in the vacuum verbose command. The default values are <b>85%</b> for the warning and <b>95%</b> for the critical.</p>
<p>Example 1: Give a warning when our cluster has used up 76% of the free-space pageslots, with pg_freespacemap installed in database robert</p>
<pre><code> check_postgres_fsm_pages --dbname=robert --warning="76%"</code></pre>
<p>While you need to pass in the name of the database where pg_freespacemap is installed, you only need to run this check once per cluster. Also, checking this information does require obtaining special locks on the free-space-map, so it is recommend you do not run this check with short intervals.</p>
<p>For MRTG output, returns the percent of free-space-map on the first line, and the number of pages currently used on the second line.</p>
<h2 id="fsm_relations"><b>fsm_relations</b></h2>
<p>(<code>symlink: check_postgres_fsm_relations</code>) Checks how close a cluster is to the Postgres <b>max_fsm_relations</b> setting. This action will only work for databases of 8.2 or higher, and it requires the contrib module <b>pg_freespacemap</b> be installed. The <i>--warning</i> and <i>--critical</i> options should be expressed as percentages. The number of used relations in the free-space-map is determined by looking in the pg_freespacemap_relations view. The default values are <b>85%</b> for the warning and <b>95%</b> for the critical.</p>
<p>Example 1: Give a warning when our cluster has used up 80% of the free-space relations, with pg_freespacemap installed in database dylan</p>
<pre><code> check_postgres_fsm_relations --dbname=dylan --warning="75%"</code></pre>
<p>While you need to pass in the name of the database where pg_freespacemap is installed, you only need to run this check once per cluster. Also, checking this information does require obtaining special locks on the free-space-map, so it is recommend you do not run this check with short intervals.</p>
<p>For MRTG output, returns the percent of free-space-map on the first line, the number of relations currently used on the second line.</p>
<h2 id="hitratio"><b>hitratio</b></h2>
<p>(<code>symlink: check_postgres_hitratio</code>) Checks the hit ratio of all databases and complains when they are too low. There is no need to run this command more than once per database cluster. Databases can be filtered with the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details. They can also be filtered by the owner of the database with the <i>--includeuser</i> and <i>--excludeuser</i> options. See the <a href="#USER-NAME-FILTERING">"USER NAME FILTERING"</a> section for more details.</p>
<p>The warning and critical options should be specified as percentages. There are not defaults for this action: the warning and critical must be specified. The warning value cannot be greater than the critical value. The output returns all databases sorted by hitratio, smallest first.</p>
<p>Example: Warn if any database on host flagg is less than 90% in hitratio, and critical if less then 80%.</p>
<pre><code> check_postgres_hitratio --host=flagg --warning='90%' --critical='80%'</code></pre>
<p>For MRTG output, returns the percentage of the database with the smallest hitratio on the first line, and the name of the database on the fourth line.</p>
<h2 id="hot_standby_delay"><b>hot_standby_delay</b></h2>
<p>(<code>symlink: check_hot_standby_delay</code>) Checks the streaming replication lag by computing the delta between the current xlog position of a master server and the replay location of a slave connected to it. The slave server must be in hot_standby (e.g. read only) mode, therefore the minimum version to use this action is Postgres 9.0. The <i>--warning</i> and <i>--critical</i> options are the delta between the xlog locations. Since these values are byte offsets in the WAL they should match the expected transaction volume of your application to prevent false positives or negatives.</p>
<p>The first "--dbname", "--host", and "--port", etc. options are considered the master; the second belongs to the slave.</p>
<p>Byte values should be based on the volume of transactions needed to have the streaming replication disconnect from the master because of too much lag, determined by the Postgres configuration variable <b>wal_keep_segments</b>. For units of time, valid units are 'seconds', 'minutes', 'hours', or 'days'. Each may be written singular or abbreviated to just the first letter. When specifying both, in the form '<i>bytes</i> and <i>time</i>', both conditions must be true for the threshold to be met.</p>
<p>You must provide information on how to reach the databases by providing a comma separated list to the --dbhost and --dbport parameters, such as "--dbport=5432,5543". If not given, the action fails.</p>
<p>Example 1: Warn a database with a local replica on port 5433 is behind on any xlog replay at all</p>
<pre><code> check_hot_standby_delay --dbport=5432,5433 --warning='1'</code></pre>
<p>Example 2: Give a critical if the last transaction replica1 receives is more than 10 minutes ago</p>
<pre><code> check_hot_standby_delay --dbhost=master,replica1 --critical='10 min'</code></pre>
<p>Example 3: Allow replica1 to be 1 WAL segment behind, if the master is momentarily seeing more activity than the streaming replication connection can handle, or 10 minutes behind, if the master is seeing very little activity and not processing any transactions, but not both, which would indicate a lasting problem with the replication connection.</p>
<pre><code> check_hot_standby_delay --dbhost=master,replica1 --warning='1048576 and 2 min' --critical='16777216 and 10 min'</code></pre>
<h2 id="relation_size"><b>relation_size</b></h2>
<h2 id="index_size"><b>index_size</b></h2>
<h2 id="table_size"><b>table_size</b></h2>
<h2 id="indexes_size"><b>indexes_size</b></h2>
<h2 id="total_relation_size"><b>total_relation_size</b></h2>
<p>(symlinks: <code>check_postgres_relation_size</code>, <code>check_postgres_index_size</code>, <code>check_postgres_table_size</code>, <code>check_postgres_indexes_size</code>, and <code>check_postgres_total_relation_size</code>)</p>
<p>The actions <b>relation_size</b> and <b>index_size</b> check for a relation (table, index, materialized view), respectively an index that has grown too big, using the <b>pg_relation_size()</b> function.</p>
<p>The action <b>table_size</b> checks tables and materialized views using <b>pg_table_size()</b>, i.e. including relation forks and TOAST table.</p>
<p>The action <b>indexes_size</b> checks tables and materialized views for the size of the attached indexes using <b>pg_indexes_size()</b>.</p>
<p>The action <b>total_relation_size</b> checks relations using <b>pg_total_relation_size()</b>, i.e. including relation forks, indexes and TOAST table.</p>
<p>Relations can be filtered with the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details. Relations can also be filtered by the user that owns them, by using the <i>--includeuser</i> and <i>--excludeuser</i> options. See the <a href="#USER-NAME-FILTERING">"USER NAME FILTERING"</a> section for more details.</p>
<p>The values for the <i>--warning</i> and <i>--critical</i> options are file sizes, and may have units of bytes, kilobytes, megabytes, gigabytes, terabytes, or exabytes. Each can be abbreviated to the first letter. If no units are given, bytes are assumed. There are no default values: both the warning and the critical option must be given. The return text shows the size of the largest relation found.</p>
<p>If the <i>--showperf</i> option is enabled, <i>all</i> of the relations with their sizes will be given. To prevent this, it is recommended that you set the <i>--perflimit</i> option, which will cause the query to do a <code>ORDER BY size DESC LIMIT (perflimit)</code>.</p>
<p>Example 1: Give a critical if any table is larger than 600MB on host burrick.</p>
<pre><code> check_postgres_table_size --critical='600 MB' --warning='600 MB' --host=burrick</code></pre>
<p>Example 2: Warn if the table products is over 4 GB in size, and give a critical at 4.5 GB.</p>
<pre><code> check_postgres_table_size --host=burrick --warning='4 GB' --critical='4.5 GB' --include=products</code></pre>
<p>Example 3: Warn if any index not owned by postgres goes over 500 MB.</p>
<pre><code> check_postgres_index_size --port=5432 --excludeuser=postgres -w 500MB -c 600MB</code></pre>
<p>For MRTG output, returns the size in bytes of the largest relation, and the name of the database and relation as the fourth line.</p>
<h2 id="last_analyze"><b>last_analyze</b></h2>
<h2 id="last_vacuum"><b>last_vacuum</b></h2>
<h2 id="last_autoanalyze"><b>last_autoanalyze</b></h2>
<h2 id="last_autovacuum"><b>last_autovacuum</b></h2>
<p>(symlinks: <code>check_postgres_last_analyze</code>, <code>check_postgres_last_vacuum</code>, <code>check_postgres_last_autoanalyze</code>, and <code>check_postgres_last_autovacuum</code>) Checks how long it has been since vacuum (or analyze) was last run on each table in one or more databases. Use of these actions requires that the target database is version 8.3 or greater, or that the version is 8.2 and the configuration variable <b>stats_row_level</b> has been enabled. Tables can be filtered with the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details. Tables can also be filtered by their owner by use of the <i>--includeuser</i> and <i>--excludeuser</i> options. See the <a href="#USER-NAME-FILTERING">"USER NAME FILTERING"</a> section for more details.</p>
<p>The units for <i>--warning</i> and <i>--critical</i> are specified as times. Valid units are seconds, minutes, hours, and days; all can be abbreviated to the first letter. If no units are given, 'seconds' are assumed. The default values are '1 day' and '2 days'. Please note that there are cases in which this field does not get automatically populated. If certain tables are giving you problems, make sure that they have dead rows to vacuum, or just exclude them from the test.</p>
<p>The schema named 'information_schema' is excluded from this test, as the only tables it contains are small and do not change.</p>
<p>Note that the non-'auto' versions will also check on the auto versions as well. In other words, using last_vacuum will report on the last vacuum, whether it was a normal vacuum, or one run by the autovacuum daemon.</p>
<p>Example 1: Warn if any table has not been vacuumed in 3 days, and give a critical at a week, for host wormwood</p>
<pre><code> check_postgres_last_vacuum --host=wormwood --warning='3d' --critical='7d'</code></pre>
<p>Example 2: Same as above, but skip tables belonging to the users 'eve' or 'mallory'</p>
<pre><code> check_postgres_last_vacuum --host=wormwood --warning='3d' --critical='7d' --excludeuser=eve,mallory</code></pre>
<p>For MRTG output, returns (on the first line) the LEAST amount of time in seconds since a table was last vacuumed or analyzed. The fourth line returns the name of the database and name of the table.</p>
<h2 id="listener"><b>listener</b></h2>
<p>(<code>symlink: check_postgres_listener</code>) Confirm that someone is listening for one or more specific strings (using the LISTEN/NOTIFY system), by looking at the pg_listener table. Only one of warning or critical is needed. The format is a simple string representing the LISTEN target, or a tilde character followed by a string for a regular expression check. Note that this check will not work on versions of Postgres 9.0 or higher.</p>
<p>Example 1: Give a warning if nobody is listening for the string bucardo_mcp_ping on ports 5555 and 5556</p>
<pre><code> check_postgres_listener --port=5555,5556 --warning=bucardo_mcp_ping</code></pre>
<p>Example 2: Give a critical if there are no active LISTEN requests matching 'grimm' on database oskar</p>
<pre><code> check_postgres_listener --db oskar --critical=~grimm</code></pre>
<p>For MRTG output, returns a 1 or a 0 on the first, indicating success or failure. The name of the notice must be provided via the <i>--mrtg</i> option.</p>
<h2 id="locks"><b>locks</b></h2>
<p>(<code>symlink: check_postgres_locks</code>) Check the total number of locks on one or more databases. There is no need to run this more than once per database cluster. Databases can be filtered with the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details.</p>
<p>The <i>--warning</i> and <i>--critical</i> options can be specified as simple numbers, which represent the total number of locks, or they can be broken down by type of lock. Valid lock names are <code>'total'</code>, <code>'waiting'</code>, or the name of a lock type used by Postgres. These names are case-insensitive and do not need the "lock" part on the end, so <b>exclusive</b> will match 'ExclusiveLock'. The format is name=number, with different items separated by colons or semicolons (or any other symbol).</p>
<p>Example 1: Warn if the number of locks is 100 or more, and critical if 200 or more, on host garrett</p>
<pre><code> check_postgres_locks --host=garrett --warning=100 --critical=200</code></pre>
<p>Example 2: On the host artemus, warn if 200 or more locks exist, and give a critical if over 250 total locks exist, or if over 20 exclusive locks exist, or if over 5 connections are waiting for a lock.</p>
<pre><code> check_postgres_locks --host=artemus --warning=200 --critical="total=250:waiting=5:exclusive=20"</code></pre>
<p>For MRTG output, returns the number of locks on the first line, and the name of the database on the fourth line.</p>
<h2 id="logfile"><b>logfile</b></h2>
<p>(<code>symlink: check_postgres_logfile</code>) Ensures that the logfile is in the expected location and is being logged to. This action issues a command that throws an error on each database it is checking, and ensures that the message shows up in the logs. It scans the various log_* settings inside of Postgres to figure out where the logs should be. If you are using syslog, it does a rough (but not foolproof) scan of <i>/etc/syslog.conf</i>. Alternatively, you can provide the name of the logfile with the <i>--logfile</i> option. This is especially useful if the logs have a custom rotation scheme driven be an external program. The <b>--logfile</b> option supports the following escape characters: <code>%Y %m %d %H</code>, which represent the current year, month, date, and hour respectively. An error is always reported as critical unless the warning option has been passed in as a non-zero value. Other than that specific usage, the <code>--warning</code> and <code>--critical</code> options should <i>not</i> be used.</p>
<p>Example 1: On port 5432, ensure the logfile is being written to the file /home/greg/pg8.2.log</p>
<pre><code> check_postgres_logfile --port=5432 --logfile=/home/greg/pg8.2.log</code></pre>
<p>Example 2: Same as above, but raise a warning, not a critical</p>
<pre><code> check_postgres_logfile --port=5432 --logfile=/home/greg/pg8.2.log -w 1</code></pre>
<p>For MRTG output, returns a 1 or 0 on the first line, indicating success or failure. In case of a failure, the fourth line will provide more detail on the failure encountered.</p>
<h2 id="new_version_bc"><b>new_version_bc</b></h2>
<p>(<code>symlink: check_postgres_new_version_bc</code>) Checks if a newer version of the Bucardo program is available. The current version is obtained by running <code>bucardo_ctl --version</code>. If a major upgrade is available, a warning is returned. If a revision upgrade is available, a critical is returned. (Bucardo is a master to slave, and master to master replication system for Postgres: see https://bucardo.org/ for more information). See also the information on the <code>--get_method</code> option.</p>
<h2 id="new_version_box"><b>new_version_box</b></h2>
<p>(<code>symlink: check_postgres_new_version_box</code>) Checks if a newer version of the boxinfo program is available. The current version is obtained by running <code>boxinfo.pl --version</code>. If a major upgrade is available, a warning is returned. If a revision upgrade is available, a critical is returned. (boxinfo is a program for grabbing important information from a server and putting it into a HTML format: see https://bucardo.org/Boxinfo/ for more information). See also the information on the <code>--get_method</code> option.</p>
<h2 id="new_version_cp"><b>new_version_cp</b></h2>
<p>(<code>symlink: check_postgres_new_version_cp</code>) Checks if a newer version of this program (check_postgres.pl) is available, by grabbing the version from a small text file on the main page of the home page for the project. Returns a warning if the returned version does not match the one you are running. Recommended interval to check is once a day. See also the information on the <code>--get_method</code> option.</p>
<h2 id="new_version_pg"><b>new_version_pg</b></h2>
<p>(<code>symlink: check_postgres_new_version_pg</code>) Checks if a newer revision of Postgres exists for each database connected to. Note that this only checks for revision, e.g. going from 8.3.6 to 8.3.7. Revisions are always 100% binary compatible and involve no dump and restore to upgrade. Revisions are made to address bugs, so upgrading as soon as possible is always recommended. Returns a warning if you do not have the latest revision. It is recommended this check is run at least once a day. See also the information on the <code>--get_method</code> option.</p>
<h2 id="new_version_tnm"><b>new_version_tnm</b></h2>
<p>(<code>symlink: check_postgres_new_version_tnm</code>) Checks if a newer version of the tail_n_mail program is available. The current version is obtained by running <code>tail_n_mail --version</code>. If a major upgrade is available, a warning is returned. If a revision upgrade is available, a critical is returned. (tail_n_mail is a log monitoring tool that can send mail when interesting events appear in your Postgres logs. See: https://bucardo.org/tail_n_mail/ for more information). See also the information on the <code>--get_method</code> option.</p>
<h2 id="pgb_pool_cl_active"><b>pgb_pool_cl_active</b></h2>
<h2 id="pgb_pool_cl_waiting"><b>pgb_pool_cl_waiting</b></h2>
<h2 id="pgb_pool_sv_active"><b>pgb_pool_sv_active</b></h2>
<h2 id="pgb_pool_sv_idle"><b>pgb_pool_sv_idle</b></h2>
<h2 id="pgb_pool_sv_used"><b>pgb_pool_sv_used</b></h2>
<h2 id="pgb_pool_sv_tested"><b>pgb_pool_sv_tested</b></h2>
<h2 id="pgb_pool_sv_login"><b>pgb_pool_sv_login</b></h2>
<h2 id="pgb_pool_maxwait"><b>pgb_pool_maxwait</b></h2>
<p>(symlinks: <code>check_postgres_pgb_pool_cl_active</code>, <code>check_postgres_pgb_pool_cl_waiting</code>, <code>check_postgres_pgb_pool_sv_active</code>, <code>check_postgres_pgb_pool_sv_idle</code>, <code>check_postgres_pgb_pool_sv_used</code>, <code>check_postgres_pgb_pool_sv_tested</code>, <code>check_postgres_pgb_pool_sv_login</code>, and <code>check_postgres_pgb_pool_maxwait</code>)</p>
<p>Examines pgbouncer's pool statistics. Each pool has a set of "client" connections, referring to connections from external clients, and "server" connections, referring to connections to PostgreSQL itself. The related check_postgres actions are prefixed by "cl_" and "sv_", respectively. Active client connections are those connections currently linked with an active server connection. Client connections may also be "waiting", meaning they have not yet been allocated a server connection. Server connections are "active" (linked to a client), "idle" (standing by for a client connection to link with), "used" (just unlinked from a client, and not yet returned to the idle pool), "tested" (currently being tested) and "login" (in the process of logging in). The maxwait value shows how long in seconds the oldest waiting client connection has been waiting.</p>
<h2 id="pgbouncer_backends"><b>pgbouncer_backends</b></h2>
<p>(<code>symlink: check_postgres_pgbouncer_backends</code>) Checks the current number of connections for one or more databases through pgbouncer, and optionally compares it to the maximum allowed, which is determined by the pgbouncer configuration variable <b>max_client_conn</b>. The <i>--warning</i> and <i>--critical</i> options can take one of three forms. First, a simple number can be given, which represents the number of connections at which the alert will be given. This choice does not use the <b>max_connections</b> setting. Second, the percentage of available connections can be given. Third, a negative number can be given which represents the number of connections left until <b>max_connections</b> is reached. The default values for <i>--warning</i> and <i>--critical</i> are '90%' and '95%'. You can also filter the databases by use of the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details.</p>
<p>To view only non-idle processes, you can use the <i>--noidle</i> argument. Note that the user you are connecting as must be a superuser for this to work properly.</p>
<p>Example 1: Give a warning when the number of connections on host quirm reaches 120, and a critical if it reaches 150.</p>
<pre><code> check_postgres_pgbouncer_backends --host=quirm --warning=120 --critical=150 -p 6432 -u pgbouncer</code></pre>
<p>Example 2: Give a critical when we reach 75% of our max_connections setting on hosts lancre or lancre2.</p>
<pre><code> check_postgres_pgbouncer_backends --warning='75%' --critical='75%' --host=lancre,lancre2 -p 6432 -u pgbouncer</code></pre>
<p>Example 3: Give a warning when there are only 10 more connection slots left on host plasmid, and a critical when we have only 5 left.</p>
<pre><code> check_postgres_pgbouncer_backends --warning=-10 --critical=-5 --host=plasmid -p 6432 -u pgbouncer</code></pre>
<p>For MRTG output, the number of connections is reported on the first line, and the fourth line gives the name of the database, plus the current max_client_conn. If more than one database has been queried, the one with the highest number of connections is output.</p>
<h2 id="pgbouncer_checksum"><b>pgbouncer_checksum</b></h2>
<p>(<code>symlink: check_postgres_pgbouncer_checksum</code>) Checks that all the pgBouncer settings are the same as last time you checked. This is done by generating a checksum of a sorted list of setting names and their values. Note that you shouldn't specify the database name, it will automatically default to pgbouncer. Either the <i>--warning</i> or the <i>--critical</i> option should be given, but not both. The value of each one is the checksum, a 32-character hexadecimal value. You can run with the special <code>--critical=0</code> option to find out an existing checksum.</p>
<p>This action requires the Digest::MD5 module.</p>
<p>Example 1: Find the initial checksum for pgbouncer configuration on port 6432 using the default user (usually postgres)</p>
<pre><code> check_postgres_pgbouncer_checksum --port=6432 --critical=0</code></pre>
<p>Example 2: Make sure no settings have changed and warn if so, using the checksum from above.</p>
<pre><code> check_postgres_pgbouncer_checksum --port=6432 --warning=cd2f3b5e129dc2b4f5c0f6d8d2e64231</code></pre>
<p>For MRTG output, returns a 1 or 0 indicating success of failure of the checksum to match. A checksum must be provided as the <code>--mrtg</code> argument. The fourth line always gives the current checksum.</p>
<h2 id="pgagent_jobs"><b>pgagent_jobs</b></h2>
<p>(<code>symlink: check_postgres_pgagent_jobs</code>) Checks that all the pgAgent jobs that have executed in the preceding interval of time have succeeded. This is done by checking for any steps that have a non-zero result.</p>
<p>Either <code>--warning</code> or <code>--critical</code>, or both, may be specified as times, and jobs will be checked for failures withing the specified periods of time before the current time. Valid units are seconds, minutes, hours, and days; all can be abbreviated to the first letter. If no units are given, 'seconds' are assumed.</p>
<p>Example 1: Give a critical when any jobs executed in the last day have failed.</p>
<pre><code> check_postgres_pgagent_jobs --critical=1d</code></pre>
<p>Example 2: Give a warning when any jobs executed in the last week have failed.</p>
<pre><code> check_postgres_pgagent_jobs --warning=7d</code></pre>
<p>Example 3: Give a critical for jobs that have failed in the last 2 hours and a warning for jobs that have failed in the last 4 hours:</p>
<pre><code> check_postgres_pgagent_jobs --critical=2h --warning=4h</code></pre>
<h2 id="prepared_txns"><b>prepared_txns</b></h2>
<p>(<code>symlink: check_postgres_prepared_txns</code>) Check on the age of any existing prepared transactions. Note that most people will NOT use prepared transactions, as they are part of two-part commit and complicated to maintain. They should also not be confused with prepared STATEMENTS, which is what most people think of when they hear prepare. The default value for a warning is 1 second, to detect any use of prepared transactions, which is probably a mistake on most systems. Warning and critical are the number of seconds a prepared transaction has been open before an alert is given.</p>
<p>Example 1: Give a warning on detecting any prepared transactions:</p>
<pre><code> check_postgres_prepared_txns -w 0</code></pre>
<p>Example 2: Give a critical if any prepared transaction has been open longer than 10 seconds, but allow up to 360 seconds for the database 'shrike':</p>
<pre><code> check_postgres_prepared_txns --critical=10 --exclude=shrike
check_postgres_prepared_txns --critical=360 --include=shrike</code></pre>
<p>For MRTG output, returns the number of seconds the oldest transaction has been open as the first line, and which database is came from as the final line.</p>
<h2 id="query_runtime"><b>query_runtime</b></h2>
<p>(<code>symlink: check_postgres_query_runtime</code>) Checks how long a specific query takes to run, by executing a "EXPLAIN ANALYZE" against it. The <i>--warning</i> and <i>--critical</i> options are the maximum amount of time the query should take. Valid units are seconds, minutes, and hours; any can be abbreviated to the first letter. If no units are given, 'seconds' are assumed. Both the warning and the critical option must be given. The name of the view or function to be run must be passed in to the <i>--queryname</i> option. It must consist of a single word (or schema.word), with optional parens at the end.</p>
<p>Example 1: Give a critical if the function named "speedtest" fails to run in 10 seconds or less.</p>
<pre><code> check_postgres_query_runtime --queryname='speedtest()' --critical=10 --warning=10</code></pre>
<p>For MRTG output, reports the time in seconds for the query to complete on the first line. The fourth line lists the database.</p>
<h2 id="query_time"><b>query_time</b></h2>
<p>(<code>symlink: check_postgres_query_time</code>) Checks the length of running queries on one or more databases. There is no need to run this more than once on the same database cluster. Note that this already excludes queries that are "idle in transaction". Databases can be filtered by using the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details. You can also filter on the user running the query with the <i>--includeuser</i> and <i>--excludeuser</i> options. See the <a href="#USER-NAME-FILTERING">"USER NAME FILTERING"</a> section for more details.</p>
<p>The values for the <i>--warning</i> and <i>--critical</i> options are amounts of time, and at least one must be provided (no defaults). Valid units are 'seconds', 'minutes', 'hours', or 'days'. Each may be written singular or abbreviated to just the first letter. If no units are given, the unit is assumed to be seconds.</p>
<p>This action requires Postgres 8.1 or better.</p>
<p>Example 1: Give a warning if any query has been running longer than 3 minutes, and a critical if longer than 5 minutes.</p>
<pre><code> check_postgres_query_time --port=5432 --warning='3 minutes' --critical='5 minutes'</code></pre>
<p>Example 2: Using default values (2 and 5 minutes), check all databases except those starting with 'template'.</p>
<pre><code> check_postgres_query_time --port=5432 --exclude=~^template</code></pre>
<p>Example 3: Warn if user 'don' has a query running over 20 seconds</p>
<pre><code> check_postgres_query_time --port=5432 --includeuser=don --warning=20s</code></pre>
<p>For MRTG output, returns the length in seconds of the longest running query on the first line. The fourth line gives the name of the database.</p>
<h2 id="replicate_row"><b>replicate_row</b></h2>
<p>(<code>symlink: check_postgres_replicate_row</code>) Checks that master-slave replication is working to one or more slaves.</p>
<p>The first "--dbname", "--host", and "--port", etc. options are considered the master; subsequent uses are the slaves. The values or the <i>--warning</i> and <i>--critical</i> options are units of time, and at least one must be provided (no defaults). Valid units are 'seconds', 'minutes', 'hours', or 'days'. Each may be written singular or abbreviated to just the first letter. If no units are given, the units are assumed to be seconds.</p>
<p>This check updates a single row on the master, and then measures how long it takes to be applied to the slaves. To do this, you need to pick a table that is being replicated, then find a row that can be changed, and is not going to be changed by any other process. A specific column of this row will be changed from one value to another. All of this is fed to the <code>repinfo</code> option, and should contain the following options, separated by commas: table name, primary key, key id, column, first value, second value.</p>
<p>Example 1: Slony is replicating a table named 'orders' from host 'alpha' to host 'beta', in the database 'sales'. The primary key of the table is named id, and we are going to test the row with an id of 3 (which is historical and never changed). There is a column named 'salesrep' that we are going to toggle from a value of 'slon' to 'nols' to check on the replication. We want to throw a warning if the replication does not happen within 10 seconds.</p>
<pre><code> check_postgres_replicate_row --host=alpha --dbname=sales --host=beta
--dbname=sales --warning=10 --repinfo=orders,id,3,salesrep,slon,nols</code></pre>
<p>Example 2: Bucardo is replicating a table named 'receipt' from host 'green' to hosts 'red', 'blue', and 'yellow'. The database for both sides is 'public'. The slave databases are running on port 5455. The primary key is named 'receipt_id', the row we want to use has a value of 9, and the column we want to change for the test is called 'zone'. We'll toggle between 'north' and 'south' for the value of this column, and throw a critical if the change is not on all three slaves within 5 seconds.</p>
<pre><code> check_postgres_replicate_row --host=green --port=5455 --host=red,blue,yellow
--critical=5 --repinfo=receipt,receipt_id,9,zone,north,south</code></pre>
<p>For MRTG output, returns on the first line the time in seconds the replication takes to finish. The maximum time is set to 4 minutes 30 seconds: if no replication has taken place in that long a time, an error is thrown.</p>
<h2 id="replication_slots"><b>replication_slots</b></h2>
<p>(<code>symlink: check_postgres_replication_slots</code>) Check the quantity of WAL retained for any replication slots in the target database cluster. This is handy for monitoring environments where all WAL archiving and replication is taking place over replication slots.</p>
<p>Warning and critical are total bytes retained for the slot. E.g:</p>
<pre><code> check_postgres_replication_slots --port=5432 --host=yellow -warning=32M -critical=64M</code></pre>
<p>Specific named slots can be monitored using --include/--exclude</p>
<h2 id="same_schema"><b>same_schema</b></h2>
<p>(<code>symlink: check_postgres_same_schema</code>) Verifies that two or more databases are identical as far as their schema (but not the data within). This is particularly handy for making sure your slaves have not been modified or corrupted in any way when using master to slave replication. Unlike most other actions, this has no warning or critical criteria - the databases are either in sync, or are not. If they are different, a detailed list of the differences is presented.</p>
<p>You may want to exclude or filter out certain differences. The way to do this is to add strings to the <code>--filter</code> option. To exclude a type of object, use "noname", where 'name' is the type of object, for example, "noschema". To exclude objects of a certain type by a regular expression against their name, use "noname=regex". See the examples below for a better understanding.</p>
<p>The types of objects that can be filtered include:</p>
<dl>
<dt id="user">user</dt>
<dd>
</dd>
<dt id="schema">schema</dt>
<dd>
</dd>
<dt id="table">table</dt>
<dd>
</dd>
<dt id="view">view</dt>
<dd>
</dd>
<dt id="index">index</dt>
<dd>
</dd>
<dt id="sequence">sequence</dt>
<dd>
</dd>
<dt id="constraint">constraint</dt>
<dd>
</dd>
<dt id="trigger">trigger</dt>
<dd>
</dd>
<dt id="function">function</dt>
<dd>
</dd>
</dl>
<p>The filter option "noposition" prevents verification of the position of columns within a table.</p>
<p>The filter option "nofuncbody" prevents comparison of the bodies of all functions.</p>
<p>The filter option "noperm" prevents comparison of object permissions.</p>
<p>To provide the second database, just append the differences to the first one by a call to the appropriate connection argument. For example, to compare databases on hosts alpha and bravo, use "--dbhost=alpha,bravo". Also see the examples below.</p>
<p>If only a single host is given, it is assumed we are doing a "time-based" report. The first time this is run a snapshot of all the items in the database is saved to a local file. When you run it again, that snapshot is read in and becomes "database #2" and is compared to the current database.</p>
<p>To replace the old stored file with the new version, use the --replace argument.</p>
<p>If you need to write the stored file to a specific directory, use the --audit-file-dir argument.</p>
<p>To avoid false positives on value based checks caused by replication lag on asynchronous replicas, use the <i>--assume-async</i> option.</p>
<p>To enable snapshots at various points in time, you can use the "--suffix" argument to make the filenames unique to each run. See the examples below.</p>
<p>Example 1: Verify that two databases on hosts star and line are the same:</p>
<pre><code> check_postgres_same_schema --dbhost=star,line</code></pre>
<p>Example 2: Same as before, but exclude any triggers with "slony" in their name</p>
<pre><code> check_postgres_same_schema --dbhost=star,line --filter="notrigger=slony"</code></pre>
<p>Example 3: Same as before, but also exclude all indexes</p>
<pre><code> check_postgres_same_schema --dbhost=star,line --filter="notrigger=slony noindexes"</code></pre>
<p>Example 4: Check differences for the database "battlestar" on different ports</p>
<pre><code> check_postgres_same_schema --dbname=battlestar --dbport=5432,5544</code></pre>
<p>Example 5: Create a daily and weekly snapshot file</p>
<pre><code> check_postgres_same_schema --dbname=cylon --suffix=daily
check_postgres_same_schema --dbname=cylon --suffix=weekly</code></pre>
<p>Example 6: Run a historical comparison, then replace the file</p>
<pre><code> check_postgres_same_schema --dbname=cylon --suffix=daily --replace</code></pre>
<p>Example 7: Verify that two databases on hosts star and line are the same, excluding value data (i.e. sequence last_val):</p>
<pre><code> check_postgres_same_schema --dbhost=star,line --assume-async </code></pre>
<h2 id="sequence1"><b>sequence</b></h2>
<p>(<code>symlink: check_postgres_sequence</code>) Checks how much room is left on all sequences in the database. This is measured as the percent of total possible values that have been used for each sequence. The <i>--warning</i> and <i>--critical</i> options should be expressed as percentages. The default values are <b>85%</b> for the warning and <b>95%</b> for the critical. You may use --include and --exclude to control which sequences are to be checked. Note that this check does account for unusual <b>minvalue</b> and <b>increment by</b> values. By default it does not care if the sequence is set to cycle or not, and by passing <i>--skipcycled</i> sequenced set to cycle are reported with 0% usage.</p>
<p>The output for Nagios gives the name of the sequence, the percentage used, and the number of 'calls' left, indicating how many more times nextval can be called on that sequence before running into the maximum value.</p>
<p>The output for MRTG returns the highest percentage across all sequences on the first line, and the name of each sequence with that percentage on the fourth line, separated by a "|" (pipe) if there are more than one sequence at that percentage.</p>
<p>Example 1: Give a warning if any sequences are approaching 95% full.</p>
<pre><code> check_postgres_sequence --dbport=5432 --warning=95%</code></pre>
<p>Example 2: Check that the sequence named "orders_id_seq" is not more than half full.</p>
<pre><code> check_postgres_sequence --dbport=5432 --critical=50% --include=orders_id_seq</code></pre>
<h2 id="settings_checksum"><b>settings_checksum</b></h2>
<p>(<code>symlink: check_postgres_settings_checksum</code>) Checks that all the Postgres settings are the same as last time you checked. This is done by generating a checksum of a sorted list of setting names and their values. Note that different users in the same database may have different checksums, due to ALTER USER usage, and due to the fact that superusers see more settings than ordinary users. Either the <i>--warning</i> or the <i>--critical</i> option should be given, but not both. The value of each one is the checksum, a 32-character hexadecimal value. You can run with the special <code>--critical=0</code> option to find out an existing checksum.</p>
<p>This action requires the Digest::MD5 module.</p>
<p>Example 1: Find the initial checksum for the database on port 5555 using the default user (usually postgres)</p>
<pre><code> check_postgres_settings_checksum --port=5555 --critical=0</code></pre>
<p>Example 2: Make sure no settings have changed and warn if so, using the checksum from above.</p>
<pre><code> check_postgres_settings_checksum --port=5555 --warning=cd2f3b5e129dc2b4f5c0f6d8d2e64231</code></pre>
<p>For MRTG output, returns a 1 or 0 indicating success of failure of the checksum to match. A checksum must be provided as the <code>--mrtg</code> argument. The fourth line always gives the current checksum.</p>
<h2 id="slony_status"><b>slony_status</b></h2>
<p>(<code>symlink: check_postgres_slony_status</code>) Checks in the status of a Slony cluster by looking at the results of Slony's sl_status view. This is returned as the number of seconds of "lag time". The <i>--warning</i> and <i>--critical</i> options should be expressed as times. The default values are <b>60 seconds</b> for the warning and <b>300 seconds</b> for the critical.</p>
<p>The optional argument <i>--schema</i> indicated the schema that Slony is installed under. If it is not given, the schema will be determined automatically each time this check is run.</p>
<p>Example 1: Give a warning if any Slony is lagged by more than 20 seconds</p>
<pre><code> check_postgres_slony_status --warning 20</code></pre>
<p>Example 2: Give a critical if Slony, installed under the schema "_slony", is over 10 minutes lagged</p>
<pre><code> check_postgres_slony_status --schema=_slony --critical=600</code></pre>
<h2 id="timesync"><b>timesync</b></h2>
<p>(<code>symlink: check_postgres_timesync</code>) Compares the local system time with the time reported by one or more databases. The <i>--warning</i> and <i>--critical</i> options represent the number of seconds between the two systems before an alert is given. If neither is specified, the default values are used, which are '2' and '5'. The warning value cannot be greater than the critical value. Due to the non-exact nature of this test, values of '0' or '1' are not recommended.</p>
<p>The string returned shows the time difference as well as the time on each side written out.</p>
<p>Example 1: Check that databases on hosts ankh, morpork, and klatch are no more than 3 seconds off from the local time:</p>
<pre><code> check_postgres_timesync --host=ankh,morpork,klatch --critical=3</code></pre>
<p>For MRTG output, returns one the first line the number of seconds difference between the local time and the database time. The fourth line returns the name of the database.</p>
<h2 id="txn_idle"><b>txn_idle</b></h2>
<p>(<code>symlink: check_postgres_txn_idle</code>) Checks the number and duration of "idle in transaction" queries on one or more databases. There is no need to run this more than once on the same database cluster. Databases can be filtered by using the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section below for more details.</p>
<p>The <i>--warning</i> and <i>--critical</i> options are given as units of time, signed integers, or integers for units of time, and at least one must be provided (there are no defaults). Valid units are 'seconds', 'minutes', 'hours', or 'days'. Each may be written singular or abbreviated to just the first letter. If no units are given and the numbers are unsigned, the units are assumed to be seconds.</p>
<p>This action requires Postgres 8.3 or better.</p>
<p>As of PostgreSQL 10, you can just GRANT <i>pg_read_all_stats</i> to an unprivileged user account. In all earlier versions, superuser privileges are required to see the queries of all users in the system; UNKNOWN is returned if queries cannot be checked. To only include queries by the connecting user, use <i>--includeuser</i>.</p>
<p>Example 1: Give a warning if any connection has been idle in transaction for more than 15 seconds:</p>
<pre><code> check_postgres_txn_idle --port=5432 --warning='15 seconds'</code></pre>
<p>Example 2: Give a warning if there are 50 or more transactions</p>
<pre><code> check_postgres_txn_idle --port=5432 --warning='+50'</code></pre>
<p>Example 3: Give a critical if 5 or more connections have been idle in transaction for more than 10 seconds:</p>
<pre><code> check_postgres_txn_idle --port=5432 --critical='5 for 10 seconds'</code></pre>
<p>For MRTG output, returns the time in seconds the longest idle transaction has been running. The fourth line returns the name of the database and other information about the longest transaction.</p>
<h2 id="txn_time"><b>txn_time</b></h2>
<p>(<code>symlink: check_postgres_txn_time</code>) Checks the length of open transactions on one or more databases. There is no need to run this command more than once per database cluster. Databases can be filtered by use of the <i>--include</i> and <i>--exclude</i> options. See the <a href="#BASIC-FILTERING">"BASIC FILTERING"</a> section for more details. The owner of the transaction can also be filtered, by use of the <i>--includeuser</i> and <i>--excludeuser</i> options. See the <a href="#USER-NAME-FILTERING">"USER NAME FILTERING"</a> section for more details.</p>
<p>The values or the <i>--warning</i> and <i>--critical</i> options are units of time, and at least one must be provided (no default). Valid units are 'seconds', 'minutes', 'hours', or 'days'. Each may be written singular or abbreviated to just the first letter. If no units are given, the units are assumed to be seconds.</p>
<p>This action requires Postgres 8.3 or better.</p>
<p>Example 1: Give a critical if any transaction has been open for more than 10 minutes:</p>
<pre><code> check_postgres_txn_time --port=5432 --critical='10 minutes'</code></pre>
<p>Example 1: Warn if user 'warehouse' has a transaction open over 30 seconds</p>
<pre><code> check_postgres_txn_time --port-5432 --warning=30s --includeuser=warehouse</code></pre>
<p>For MRTG output, returns the maximum time in seconds a transaction has been open on the first line. The fourth line gives the name of the database.</p>
<h2 id="txn_wraparound"><b>txn_wraparound</b></h2>
<p>(<code>symlink: check_postgres_txn_wraparound</code>) Checks how close to transaction wraparound one or more databases are getting. The <i>--warning</i> and <i>--critical</i> options indicate the number of transactions done, and must be a positive integer. If either option is not given, the default values of 1.3 and 1.4 billion are used. There is no need to run this command more than once per database cluster. For a more detailed discussion of what this number represents and what to do about it, please visit the page <a href="https://www.postgresql.org/docs/current/static/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND">https://www.postgresql.org/docs/current/static/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND</a></p>
<p>The warning and critical values can have underscores in the number for legibility, as Perl does.</p>
<p>Example 1: Check the default values for the localhost database</p>
<pre><code> check_postgres_txn_wraparound --host=localhost</code></pre>
<p>Example 2: Check port 6000 and give a critical when 1.7 billion transactions are hit:</p>
<pre><code> check_postgres_txn_wraparound --port=6000 --critical=1_700_000_000</code></pre>
<p>For MRTG output, returns the highest number of transactions for all databases on line one, while line 4 indicates which database it is.</p>
<h2 id="version"><b>version</b></h2>
<p>(<code>symlink: check_postgres_version</code>) Checks that the required version of Postgres is running. The <i>--warning</i> and <i>--critical</i> options (only one is required) must be of the format <b>X.Y</b> or <b>X.Y.Z</b> where <b>X</b> is the major version number, <b>Y</b> is the minor version number, and <b>Z</b> is the revision.</p>
<p>Example 1: Give a warning if the database on port 5678 is not version 8.4.10:</p>
<pre><code> check_postgres_version --port=5678 -w=8.4.10</code></pre>
<p>Example 2: Give a warning if any databases on hosts valley,grain, or sunshine is not 8.3:</p>
<pre><code> check_postgres_version -H valley,grain,sunshine --critical=8.3</code></pre>
<p>For MRTG output, reports a 1 or a 0 indicating success or failure on the first line. The fourth line indicates the current version. The version must be provided via the <code>--mrtg</code> option.</p>
<h2 id="wal_files"><b>wal_files</b></h2>
<p>(<code>symlink: check_postgres_wal_files</code>) Checks how many WAL files exist in the <i>pg_xlog</i> directory (PostgreSQL 10 and later" <i>pg_wal</i>), which is found off of your <b>data_directory</b>, sometimes as a symlink to another physical disk for performance reasons. If the <i>--lsfunc</i> option is not used then this action must be run as a superuser, in order to access the contents of the <i>pg_xlog</i> directory. The minimum version to use this action is Postgres 8.1. The <i>--warning</i> and <i>--critical</i> options are simply the number of files in the <i>pg_xlog</i> directory. What number to set this to will vary, but a general guideline is to put a number slightly higher than what is normally there, to catch problems early.</p>
<p>Normally, WAL files are closed and then re-used, but a long-running open transaction, or a faulty <b>archive_command</b> script, may cause Postgres to create too many files. Ultimately, this will cause the disk they are on to run out of space, at which point Postgres will shut down.</p>
<p>To avoid connecting as a database superuser, a wrapper function around <code>pg_ls_dir()</code> should be defined as a superuser with SECURITY DEFINER, and the <i>--lsfunc</i> option used. This example function, if defined by a superuser, will allow the script to connect as a normal user <i>nagios</i> with <i>--lsfunc=ls_xlog_dir</i></p>
<pre><code> BEGIN;
CREATE FUNCTION ls_xlog_dir()
RETURNS SETOF TEXT
AS $$ SELECT pg_ls_dir('pg_xlog') $$
LANGUAGE SQL
SECURITY DEFINER;
REVOKE ALL ON FUNCTION ls_xlog_dir() FROM PUBLIC;
GRANT EXECUTE ON FUNCTION ls_xlog_dir() to nagios;
COMMIT;</code></pre>
<p>Example 1: Check that the number of ready WAL files is 10 or less on host "pluto", using a wrapper function <code>ls_xlog_dir</code> to avoid the need for superuser permissions</p>
<pre><code> check_postgres_archive_ready --host=pluto --critical=10 --lsfunc=ls_xlog_dir</code></pre>
<p>For MRTG output, reports the number of WAL files on line 1.</p>
<h2 id="rebuild_symlinks"><b>rebuild_symlinks</b></h2>
<h2 id="rebuild_symlinks_force"><b>rebuild_symlinks_force</b></h2>
<p>This action requires no other arguments, and does not connect to any databases, but simply creates symlinks in the current directory for each action, in the form <b>check_postgres_<action_name></b>. If the file already exists, it will not be overwritten. If the action is rebuild_symlinks_force, then symlinks will be overwritten. The option --symlinks is a shorter way of saying --action=rebuild_symlinks</p>
<h1 id="BASIC-FILTERING">BASIC FILTERING</h1>
<p>The options <i>--include</i> and <i>--exclude</i> can be combined to limit which things are checked, depending on the action. The name of the database can be filtered when using the following actions: backends, database_size, locks, query_time, txn_idle, and txn_time. The name of a relation can be filtered when using the following actions: bloat, index_size, table_size, relation_size, last_vacuum, last_autovacuum, last_analyze, and last_autoanalyze. The name of a setting can be filtered when using the settings_checksum action. The name of a file system can be filtered when using the disk_space action.</p>
<p>If only an include option is given, then ONLY those entries that match will be checked. However, if given both exclude and include, the exclusion is done first, and the inclusion after, to reinstate things that may have been excluded. Both <i>--include</i> and <i>--exclude</i> can be given multiple times, and/or as comma-separated lists. A leading tilde will match the following word as a regular expression.</p>
<p>To match a schema, end the search term with a single period. Leading tildes can be used for schemas as well.</p>
<p>Be careful when using filtering: an inclusion rule on the backends, for example, may report no problems not only because the matching database had no backends, but because you misspelled the name of the database!</p>
<p>Examples:</p>
<p>Only checks items named pg_class:</p>
<pre><code> --include=pg_class</code></pre>
<p>Only checks items containing the letters 'pg_':</p>
<pre><code> --include=~pg_</code></pre>
<p>Only check items beginning with 'pg_':</p>
<pre><code> --include=~^pg_</code></pre>
<p>Exclude the item named 'test':</p>
<pre><code> --exclude=test</code></pre>
<p>Exclude all items containing the letters 'test:</p>
<pre><code> --exclude=~test</code></pre>
<p>Exclude all items in the schema 'pg_catalog':</p>
<pre><code> --exclude='pg_catalog.'</code></pre>
<p>Exclude all items containing the letters 'ace', but allow the item 'faceoff':</p>
<pre><code> --exclude=~ace --include=faceoff</code></pre>
<p>Exclude all items which start with the letters 'pg_', which contain the letters 'slon', or which are named 'sql_settings' or 'green'. Specifically check items with the letters 'prod' in their names, and always check the item named 'pg_relname':</p>
<pre><code> --exclude=~^pg_,~slon,sql_settings --exclude=green --include=~prod,pg_relname</code></pre>
<h1 id="USER-NAME-FILTERING">USER NAME FILTERING</h1>
<p>The options <i>--includeuser</i> and <i>--excludeuser</i> can be used on some actions to only examine database objects owned by (or not owned by) one or more users. An <i>--includeuser</i> option always trumps an <i>--excludeuser</i> option. You can give each option more than once for multiple users, or you can give a comma-separated list. The actions that currently use these options are:</p>
<dl>
<dt id="database_size1">database_size</dt>
<dd>
</dd>
<dt id="last_analyze1">last_analyze</dt>
<dd>
</dd>
<dt id="last_autoanalyze1">last_autoanalyze</dt>
<dd>
</dd>
<dt id="last_vacuum1">last_vacuum</dt>
<dd>
</dd>
<dt id="last_autovacuum1">last_autovacuum</dt>
<dd>
</dd>
<dt id="query_time1">query_time</dt>
<dd>
</dd>
<dt id="relation_size1">relation_size</dt>
<dd>
</dd>
<dt id="txn_time1">txn_time</dt>
<dd>
</dd>
</dl>
<p>Examples:</p>
<p>Only check items owned by the user named greg:</p>
<pre><code> --includeuser=greg</code></pre>
<p>Only check items owned by either watson or crick:</p>
<pre><code> --includeuser=watson,crick</code></pre>
<p>Only check items owned by crick,franklin, watson, or wilkins:</p>
<pre><code> --includeuser=watson --includeuser=franklin --includeuser=crick,wilkins</code></pre>
<p>Check all items except for those belonging to the user scott:</p>
<pre><code> --excludeuser=scott</code></pre>
<h1 id="TEST-MODE">TEST MODE</h1>
<p>To help in setting things up, this program can be run in a "test mode" by specifying the <i>--test</i> option. This will perform some basic tests to make sure that the databases can be contacted, and that certain per-action prerequisites are met, such as whether the user is a superuser, if the version of Postgres is new enough, and if stats_row_level is enabled.</p>
<h1 id="FILES">FILES</h1>
<p>In addition to command-line configurations, you can put any options inside of a file. The file <i>.check_postgresrc</i> in the current directory will be used if found. If not found, then the file <i>~/.check_postgresrc</i> will be used. Finally, the file /etc/check_postgresrc will be used if available. The format of the file is option = value, one per line. Any line starting with a '#' will be skipped. Any values loaded from a check_postgresrc file will be overwritten by command-line options. All check_postgresrc files can be ignored by supplying a <code>--no-checkpostgresrc</code> argument.</p>
<h1 id="ENVIRONMENT-VARIABLES">ENVIRONMENT VARIABLES</h1>
<p>The environment variable <i>$ENV{HOME}</i> is used to look for a <i>.check_postgresrc</i> file. The environment variable <i>$ENV{PGBINDIR}</i> is used to look for PostgreSQL binaries.</p>
<h1 id="TIPS-AND-TRICKS">TIPS AND TRICKS</h1>
<p>Since this program uses the <b>psql</b> program, make sure it is accessible to the user running the script. If run as a cronjob, this often means modifying the <b>PATH</b> environment variable.</p>
<p>If you are using Nagios in embedded Perl mode, use the <code>--action</code> argument instead of symlinks, so that the plugin only gets compiled one time.</p>
<h1 id="DEPENDENCIES">DEPENDENCIES</h1>
<p>Access to a working version of psql, and the following very standard Perl modules:</p>
<dl>
<dt id="Cwd"><b>Cwd</b></dt>
<dd>
</dd>
<dt id="Getopt::Long"><b>Getopt::Long</b></dt>
<dd>
</dd>
<dt id="File::Basename"><b>File::Basename</b></dt>
<dd>
</dd>
<dt id="File::Temp"><b>File::Temp</b></dt>
<dd>
</dd>
<dt id="Time::HiRes-if-opt-showtime-is-set-to-true-which-is-the-default"><b>Time::HiRes</b> (if <code>$opt{showtime}</code> is set to true, which is the default)</dt>
<dd>
</dd>
</dl>
<p>The <a href="#settings_checksum">"settings_checksum"</a> action requires the <b>Digest::MD5</b> module.</p>
<p>The <a href="#checkpoint">"checkpoint"</a> action requires the <b>Date::Parse</b> module.</p>
<p>Some actions require access to external programs. If psql is not explicitly specified, the command <b><code>which</code></b> is used to find it. The program <b><code>/bin/df</code></b> is needed by the <a href="#disk_space">"disk_space"</a> action.</p>
<h1 id="DEVELOPMENT">DEVELOPMENT</h1>
<p>Development happens using the git system. You can clone the latest version by doing:</p>
<pre><code> https://github.com/bucardo/check_postgres
git clone git://bucardo.org/check_postgres.git</pre>
<h1 id="MAILING-LIST">MAILING LIST</h1>
<p>Three mailing lists are available. For discussions about the program, bug reports, feature requests, and commit notices, send email to check_postgres@bucardo.org</p>
<p>https://mail.endcrypt.com/mailman/listinfo/check_postgres</p>
<p>A low-volume list for announcement of new versions and important notices is the 'check_postgres-announce' list:</p>
<p>https://mail.endcrypt.com/mailman/listinfo/check_postgres-announce</p>
<p>Source code changes (via git-commit) are sent to the 'check_postgres-commit' list:</p>
<p>https://mail.endcrypt.com/mailman/listinfo/check_postgres-commit</p>
<h1 id="HISTORY">HISTORY</h1>
<p>Items not specifically attributed are by GSM (Greg Sabino Mullane).</p>
<dl>
<dt id="Version-2.24.0-Released-May-30-2018"><b>Version 2.24.0</b> Released May 30, 2018</dt>
<dd>
<pre><code> Support new_version_pg for PG10
(Michael Pirogov)
Option to skip CYCLE sequences in action sequence
(Christoph Moench-Tegeder)
Output per-database perfdata for pgbouncer pool checks
(George Hansper)
German message translations
(Holger Jacobs)
Consider only client backends in query_time and friends
(David Christensen)</code></pre>
</dd>
<dt id="Version-2.23.0-Released-October-31-2017"><b>Version 2.23.0</b> Released October 31, 2017</dt>
<dd>
<pre><code> Support PostgreSQL 10.
(David Christensen, Christoph Berg)
Change table_size to use pg_table_size() on 9.0+, i.e. include the TOAST
table size in the numbers reported. Add new actions indexes_size and
total_relation_size, using the respective pg_indexes_size() and
pg_total_relation_size() functions. All size checks will now also check
materialized views where applicable.
(Christoph Berg)
Connection errors are now always critical, not unknown.
(Christoph Berg)
New action replication_slots checking if logical or physical replication
slots have accumulated too much data
(Glyn Astill)
Multiple same_schema improvements
(Glyn Astill)
Add Spanish message translations
(Luis Vazquez)
Allow a wrapper function to run wal_files and archive_ready actions as
non-superuser
(Joshua Elsasser)
Add some defensive casting to the bloat query
(Greg Sabino Mullane)
Invoke psql with option -X
(Peter Eisentraut)
Update postgresql.org URLs to use https.
(Magnus Hagander)
check_txn_idle: Don't fail when query contains 'disabled' word
(Marco Nenciarini)
check_txn_idle: Use state_change instead of query_start.
(Sebastian Webber)
check_hot_standby_delay: Correct extra space in perfdata
(Adrien Nayrat)
Remove \r from psql output as it can confuse some regexes
(Greg Sabino Mullane)
Sort failed jobs in check_pgagent_jobs for stable output.
(Christoph Berg)</code></pre>
</dd>
<dt id="Version-2.22.0-June-30-2015"><b>Version 2.22.0</b> June 30, 2015</dt>
<dd>
<pre><code> Add xact timestamp support to hot_standby_delay.
Allow the hot_standby_delay check to accept xlog byte position or
timestamp lag intervals as thresholds, or even both at the same time.
(Josh Williams)
Query all sequences per DB in parallel for action=sequence.
(Christoph Berg)
Fix bloat check to use correct SQL depending on the server version.
(Adrian Vondendriesch)
Show actual long-running query in query_time output
(Peter Eisentraut)
Add explicit ORDER BY to the slony_status check to get the most lagged server.
(Jeff Frost)
Improved multi-slave support in replicate_row.
(Andrew Yochum)
Change the way tables are quoted in replicate_row.
(Glyn Astill)
Don't swallow space before the -c flag when reporting errors
(Jeff Janes)
Fix and extend hot_standby_delay documentation
(Michael Renner)
Declare POD encoding to be utf8.
(Christoph Berg)</code></pre>
</dd>
<dt id="Version-2.21.0-September-24-2013"><b>Version 2.21.0</b> September 24, 2013</dt>
<dd>
<pre><code> Fix issue with SQL steps in check_pgagent_jobs for sql steps which perform deletes
(Rob Emery via github pull)
Install man page in section 1.
(Peter Eisentraut, bug 53, github issue 26)
Order lock types in check_locks output to make the ordering predictable;
setting SKIP_NETWORK_TESTS will skip the new_version tests; other minor test
suite fixes.
(Christoph Berg)
Fix same_schema check on 9.3 by ignoring relminmxid differences in pg_class
(Christoph Berg)</code></pre>
</dd>
<dt id="Version-2.20.1-June-24-2013"><b>Version 2.20.1</b> June 24, 2013</dt>
<dd>
<pre><code> Make connection check failures return CRITICAL not UNKNOWN
(Dominic Hargreaves)
Fix --reverse option when using string comparisons in custom queries
(Nathaniel Waisbrot)
Compute correct 'totalwastedbytes' in the bloat query
(Michael Renner)
Do not use pg_stats "inherited" column in bloat query, if the
database is 8.4 or older. (Greg Sabino Mullane, per bug 121)
Remove host reordering in hot_standby_delay check
(Josh Williams, with help from Jacobo Blasco)
Better output for the "simple" flag
(Greg Sabino Mullane)
Force same_schema to ignore the 'relallvisible' column
(Greg Sabino Mullane)</code></pre>
</dd>
<dt id="Version-2.20.0-March-13-2013"><b>Version 2.20.0</b> March 13, 2013</dt>
<dd>
<pre><code> Add check for pgagent jobs (David E. Wheeler)
Force STDOUT to use utf8 for proper output
(Greg Sabino Mullane; reported by Emmanuel Lesouef)
Fixes for Postgres 9.2: new pg_stat_activity view,
and use pg_tablespace_location, (Josh Williams)
Allow for spaces in item lists when doing same_schema.
Allow txn_idle to work again for < 8.3 servers by switching to query_time.
Fix the check_bloat SQL to take inherited tables into account,
and assume 2k for non-analyzed columns. (Geert Pante)
Cache sequence information to speed up same_schema runs.
Fix --excludeuser in check_txn_idle (Mika Eloranta)
Fix user clause handling in check_txn_idle (Michael van Bracht)
Adjust docs to show colon as a better separator inside args for locks
(Charles Sprickman)
Fix undefined $SQL2 error in check_txn_idle [github issue 16] (Patric Bechtel)
Prevent "uninitialized value" warnings when showing the port (Henrik Ahlgren)
Do not assume everyone has a HOME [github issue 23]</code></pre>
</dd>
<dt id="Version-2.19.0-January-17-2012"><b>Version 2.19.0</b> January 17, 2012</dt>
<dd>
<pre><code> Add the --assume-prod option (Cédric Villemain)
Add the cluster_id check (Cédric Villemain)
Improve settings_checksum and checkpoint tests (Cédric Villemain)
Do not do an inner join to pg_user when checking database size
(Greg Sabino Mullane; reported by Emmanuel Lesouef)
Use the full path when getting sequence information for same_schema.
(Greg Sabino Mullane; reported by Cindy Wise)
Fix the formula for calculating xlog positions (Euler Taveira de Oliveira)
Better ordering of output for bloat check - make indexes as important
as tables (Greg Sabino Mullane; reported by Jens Wilke)
Show the dbservice if it was used at top of same_schema output
(Mike Blackwell)
Better installation paths (Greg Sabino Mullane, per bug 53)</code></pre>
</dd>
<dt id="Version-2.18.0-October-2-2011"><b>Version 2.18.0</b> October 2, 2011</dt>
<dd>
<pre><code> Redo the same_schema action. Use new --filter argument for all filtering.
Allow comparisons between any number of databases.
Remove the dbname2, dbport2, etc. arguments.
Allow comparison of the same db over time.
Swap db1 and db2 if the slave is 1 for the hot standby check (David E. Wheeler)
Allow multiple --schema arguments for the slony_status action (GSM and Jehan-Guillaume de Rorthais)
Fix ORDER BY in the last vacuum/analyze action (Nicolas Thauvin)
Fix check_hot_standby_delay perfdata output (Nicolas Thauvin)
Look in the correct place for the .ready files with the archive_ready action (Nicolas Thauvin)
New action: commitratio (Guillaume Lelarge)
New action: hitratio (Guillaume Lelarge)
Make sure --action overrides the symlink naming trick.
Set defaults for archive_ready and wal_files (Thomas Guettler, GSM)
Better output for wal_files and archive_ready (GSM)
Fix warning when client_port set to empty string (bug #79)
Account for "empty row" in -x output (i.e. source of functions).
Fix some incorrectly named data fields (Andy Lester)
Expand the number of pgbouncer actions (Ruslan Kabalin)
Give detailed information and refactor txn_idle, txn_time, and query_time
(Per request from bug #61)
Set maxalign to 8 in the bloat check if box identified as '64-bit'
(Michel Sijmons, bug #66)
Support non-standard version strings in the bloat check.
(Michel Sijmons and Gurjeet Singh, bug #66)
Do not show excluded databases in some output (Ruslan Kabalin)
Allow "and", "or" inside arguments (David E. Wheeler)
Add the "new_version_box" action.
Fix psql version regex (Peter Eisentraut, bug #69)
Add the --assume-standby-mode option (Ruslan Kabalin)
Note that txn_idle and query_time require 8.3 (Thomas Guettler)
Standardize and clean up all perfdata output (bug #52)
Exclude "idle in transaction" from the query_time check (bug #43)
Fix the perflimit for the bloat action (bug #50)
Clean up the custom_query action a bit.
Fix space in perfdata for hot_standby_delay action (Nicolas Thauvin)
Handle undef percents in check_fsm_relations (Andy Lester)
Fix typo in dbstats action (Stas Vitkovsky)
Fix MRTG for last vacuum and last_analyze actions.</code></pre>
</dd>
<dt id="Version-2.17.0-no-public-release"><b>Version 2.17.0</b> no public release</dt>
<dd>
</dd>
<dt id="Version-2.16.0-January-20-2011"><b>Version 2.16.0</b> January 20, 2011</dt>
<dd>
<pre><code> Add new action 'hot_standby_delay' (Nicolas Thauvin)
Add cache-busting for the version-grabbing utilities.
Fix problem with going to next method for new_version_pg
(Greg Sabino Mullane, reported by Hywel Mallett in bug #65)
Allow /usr/local/etc as an alternative location for the
check_postgresrc file (Hywel Mallett)
Do not use tgisconstraint in same_schema if Postgres >= 9
(Guillaume Lelarge)</code></pre>
</dd>
<dt id="Version-2.15.4-January-3-2011"><b>Version 2.15.4</b> January 3, 2011</dt>
<dd>
<pre><code> Fix warning when using symlinks
(Greg Sabino Mullane, reported by Peter Eisentraut in bug #63)</code></pre>
</dd>
<dt id="Version-2.15.3-December-30-2010"><b>Version 2.15.3</b> December 30, 2010</dt>
<dd>
<pre><code> Show OK for no matching txn_idle entries.</code></pre>
</dd>
<dt id="Version-2.15.2-December-28-2010"><b>Version 2.15.2</b> December 28, 2010</dt>
<dd>
<pre><code> Better formatting of sizes in the bloat action output.
Remove duplicate perfs in bloat action output.</code></pre>
</dd>
<dt id="Version-2.15.1-December-27-2010"><b>Version 2.15.1</b> December 27, 2010</dt>
<dd>
<pre><code> Fix problem when examining items in pg_settings (Greg Sabino Mullane)
For connection test, return critical, not unknown, on FATAL errors
(Greg Sabino Mullane, reported by Peter Eisentraut in bug #62)</code></pre>
</dd>
<dt id="Version-2.15.0-November-8-2010"><b>Version 2.15.0</b> November 8, 2010</dt>
<dd>
<pre><code> Add --quiet argument to suppress output on OK Nagios results
Add index comparison for same_schema (Norman Yamada and Greg Sabino Mullane)
Use $ENV{PGSERVICE} instead of "service=" to prevent problems (Guillaume Lelarge)
Add --man option to show the entire manual. (Andy Lester)
Redo the internal run_command() sub to use -x and hashes instead of regexes.
Fix error in custom logic (Andreas Mager)
Add the "pgbouncer_checksum" action (Guillaume Lelarge)
Fix regex to work on WIN32 for check_fsm_relations and check_fsm_pages (Luke Koops)
Don't apply a LIMIT when using --exclude on the bloat action (Marti Raudsepp)
Change the output of query_time to show pid,user,port, and address (Giles Westwood)
Fix to show database properly when using slony_status (Guillaume Lelarge)
Allow warning items for same_schema to be comma-separated (Guillaume Lelarge)
Constraint definitions across Postgres versions match better in same_schema.
Work against "EnterpriseDB" databases (Sivakumar Krishnamurthy and Greg Sabino Mullane)
Separate perfdata with spaces (Jehan-Guillaume (ioguix) de Rorthais)
Add new action "archive_ready" (Jehan-Guillaume (ioguix) de Rorthais)</code></pre>
</dd>
<dt id="Version-2.14.3-March-1-2010"><b>Version 2.14.3</b> (March 1, 2010)</dt>
<dd>
<pre><code> Allow slony_status action to handle more than one slave.
Use commas to separate function args in same_schema output (Robert Treat)</code></pre>
</dd>
<dt id="Version-2.14.2-February-18-2010"><b>Version 2.14.2</b> (February 18, 2010)</dt>
<dd>
<pre><code> Change autovac_freeze default warn/critical back to 90%/95% (Robert Treat)
Put all items one-per-line for relation size actions if --verbose=1</code></pre>
</dd>
<dt id="Version-2.14.1-February-17-2010"><b>Version 2.14.1</b> (February 17, 2010)</dt>
<dd>
<pre><code> Don't use $^T in logfile check, as script may be long-running
Change the error string for the logfile action for easier exclusion
by programs like tail_n_mail</code></pre>
</dd>
<dt id="Version-2.14.0-February-11-2010"><b>Version 2.14.0</b> (February 11, 2010)</dt>
<dd>
<pre><code> Added the 'slony_status' action.
Changed the logfile sleep from 0.5 to 1, as 0.5 gets rounded to 0 on some boxes!</code></pre>
</dd>
<dt id="Version-2.13.2-February-4-2010"><b>Version 2.13.2</b> (February 4, 2010)</dt>
<dd>
<pre><code> Allow timeout option to be used for logtime 'sleep' time.</code></pre>
</dd>
<dt id="Version-2.13.2-February-4-20101"><b>Version 2.13.2</b> (February 4, 2010)</dt>
<dd>
<pre><code> Show offending database for query_time action.
Apply perflimit to main output for sequence action.
Add 'noowner' option to same_schema action.
Raise sleep timeout for logfile check to 15 seconds.</code></pre>
</dd>
<dt id="Version-2.13.1-February-2-2010"><b>Version 2.13.1</b> (February 2, 2010)</dt>
<dd>
<pre><code> Fix bug preventing column constraint differences from 2 > 1 for same_schema from being shown.
Allow aliases 'dbname1', 'dbhost1', 'dbport1',etc.
Added "nolanguage" as a filter for the same_schema option.
Don't track "generic" table constraints (e.. $1, $2) using same_schema</code></pre>
</dd>
<dt id="Version-2.13.0-January-29-2010"><b>Version 2.13.0</b> (January 29, 2010)</dt>
<dd>
<pre><code> Allow "nofunctions" as a filter for the same_schema option.
Added "noperm" as a filter for the same_schema option.
Ignore dropped columns when considered positions for same_schema (Guillaume Lelarge)</code></pre>
</dd>
<dt id="Version-2.12.1-December-3-2009"><b>Version 2.12.1</b> (December 3, 2009)</dt>
<dd>
<pre><code> Change autovac_freeze default warn/critical from 90%/95% to 105%/120% (Marti Raudsepp)</code></pre>
</dd>
<dt id="Version-2.12.0-December-3-2009"><b>Version 2.12.0</b> (December 3, 2009)</dt>
<dd>
<pre><code> Allow the temporary directory to be specified via the "tempdir" argument,
for systems that need it (e.g. /tmp is not owned by root).
Fix so old versions of Postgres (< 8.0) use the correct default database (Giles Westwood)
For "same_schema" trigger mismatches, show the attached table.
Add the new_version_bc check for Bucardo version checking.
Add database name to perf output for last_vacuum|analyze (Guillaume Lelarge)
Fix for bloat action against old versions of Postgres without the 'block_size' param.</code></pre>
</dd>
<dt id="Version-2.11.1-August-27-2009"><b>Version 2.11.1</b> (August 27, 2009)</dt>
<dd>
<pre><code> Proper Nagios output for last_vacuum|analyze actions. (Cédric Villemain)
Proper Nagios output for locks action. (Cédric Villemain)
Proper Nagios output for txn_wraparound action. (Cédric Villemain)
Fix for constraints with embedded newlines for same_schema.
Allow --exclude for all items when using same_schema.</code></pre>
</dd>
<dt id="Version-2.11.0-August-23-2009"><b>Version 2.11.0</b> (August 23, 2009)</dt>
<dd>
<pre><code> Add Nagios perf output to the wal_files check (Cédric Villemain)
Add support for .check_postgresrc, per request from Albe Laurenz.
Allow list of web fetch methods to be changed with the --get_method option.
Add support for the --language argument, which overrides any ENV.
Add the --no-check_postgresrc flag.
Ensure check_postgresrc options are completely overridden by command-line options.
Fix incorrect warning > critical logic in replicate_rows (Glyn Astill)</code></pre>
</dd>
<dt id="Version-2.10.0-August-3-2009"><b>Version 2.10.0</b> (August 3, 2009)</dt>
<dd>
<pre><code> For same_schema, compare view definitions, and compare languages.
Make script into a global executable via the Makefile.PL file.
Better output when comparing two databases.
Proper Nagios output syntax for autovac_freeze and backends checks (Cédric Villemain)</code></pre>
</dd>
<dt id="Version-2.9.5-July-24-2009"><b>Version 2.9.5</b> (July 24, 2009)</dt>
<dd>
<pre><code> Don't use a LIMIT in check_bloat if --include is used. Per complaint from Jeff Frost.</code></pre>
</dd>
<dt id="Version-2.9.4-July-21-2009"><b>Version 2.9.4</b> (July 21, 2009)</dt>
<dd>
<pre><code> More French translations (Guillaume Lelarge)</code></pre>
</dd>
<dt id="Version-2.9.3-July-14-2009"><b>Version 2.9.3</b> (July 14, 2009)</dt>
<dd>
<pre><code> Quote dbname in perf output for the backends check. (Davide Abrigo)
Add 'fetch' as an alternative method for new_version checks, as this
comes by default with FreeBSD. (Hywel Mallett)</code></pre>
</dd>
<dt id="Version-2.9.2-July-12-2009"><b>Version 2.9.2</b> (July 12, 2009)</dt>
<dd>
<pre><code> Allow dots and dashes in database name for the backends check (Davide Abrigo)
Check and display the database for each match in the bloat check (Cédric Villemain)
Handle 'too many connections' FATAL error in the backends check with a critical,
rather than a generic error (Greg, idea by Jürgen Schulz-Brüssel)
Do not allow perflimit to interfere with exclusion rules in the vacuum and
analyze tests. (Greg, bug reported by Jeff Frost)</code></pre>
</dd>
<dt id="Version-2.9.1-June-12-2009"><b>Version 2.9.1</b> (June 12, 2009)</dt>
<dd>
<pre><code> Fix for multiple databases with the check_bloat action (Mark Kirkwood)
Fixes and improvements to the same_schema action (Jeff Boes)
Write tests for same_schema, other minor test fixes (Jeff Boes)</code></pre>
</dd>
<dt id="Version-2.9.0-May-28-2009"><b>Version 2.9.0</b> (May 28, 2009)</dt>
<dd>
<pre><code> Added the same_schema action (Greg)</code></pre>
</dd>
<dt id="Version-2.8.1-May-15-2009"><b>Version 2.8.1</b> (May 15, 2009)</dt>
<dd>
<pre><code> Added timeout via statement_timeout in addition to perl alarm (Greg)</code></pre>
</dd>
<dt id="Version-2.8.0-May-4-2009"><b>Version 2.8.0</b> (May 4, 2009)</dt>
<dd>
<pre><code> Added internationalization support (Greg)
Added the 'disabled_triggers' check (Greg)
Added the 'prepared_txns' check (Greg)
Added the 'new_version_cp' and 'new_version_pg' checks (Greg)
French translations (Guillaume Lelarge)
Make the backends search return ok if no matches due to inclusion rules,
per report by Guillaume Lelarge (Greg)
Added comprehensive unit tests (Greg, Jeff Boes, Selena Deckelmann)
Make fsm_pages and fsm_relations handle 8.4 servers smoothly. (Greg)
Fix missing 'upd' field in show_dbstats (Andras Fabian)
Allow ENV{PGCONTROLDATA} and ENV{PGBINDIR}. (Greg)
Add various Perl module infrastructure (e.g. Makefile.PL) (Greg)
Fix incorrect regex in txn_wraparound (Greg)
For txn_wraparound: consistent ordering and fix duplicates in perf output (Andras Fabian)
Add in missing exabyte regex check (Selena Deckelmann)
Set stats to zero if we bail early due to USERWHERECLAUSE (Andras Fabian)
Add additional items to dbstats output (Andras Fabian)
Remove --schema option from the fsm_ checks. (Greg Mullane and Robert Treat)
Handle case when ENV{PGUSER} is set. (Andy Lester)
Many various fixes. (Jeff Boes)
Fix --dbservice: check version and use ENV{PGSERVICE} for old versions (Cédric Villemain)</code></pre>
</dd>
<dt id="Version-2.7.3-February-10-2009"><b>Version 2.7.3</b> (February 10, 2009)</dt>
<dd>
<pre><code> Make the sequence action check if sequence being used for a int4 column and
react appropriately. (Michael Glaesemann)</code></pre>
</dd>
<dt id="Version-2.7.2-February-9-2009"><b>Version 2.7.2</b> (February 9, 2009)</dt>
<dd>
<pre><code> Fix to prevent multiple groupings if db arguments given.</code></pre>
</dd>
<dt id="Version-2.7.1-February-6-2009"><b>Version 2.7.1</b> (February 6, 2009)</dt>
<dd>
<pre><code> Allow the -p argument for port to work again.</code></pre>
</dd>
<dt id="Version-2.7.0-February-4-2009"><b>Version 2.7.0</b> (February 4, 2009)</dt>
<dd>
<pre><code> Do not require a connection argument, but use defaults and ENV variables when
possible: PGHOST, PGPORT, PGUSER, PGDATABASE.</code></pre>
</dd>
<dt id="Version-2.6.1-February-4-2009"><b>Version 2.6.1</b> (February 4, 2009)</dt>
<dd>
<pre><code> Only require Date::Parse to be loaded if using the checkpoint action.</code></pre>
</dd>
<dt id="Version-2.6.0-January-26-2009"><b>Version 2.6.0</b> (January 26, 2009)</dt>
<dd>
<pre><code> Add the 'checkpoint' action.</code></pre>
</dd>
<dt id="Version-2.5.4-January-7-2009"><b>Version 2.5.4</b> (January 7, 2009)</dt>
<dd>
<pre><code> Better checking of $opt{dbservice} structure (Cédric Villemain)
Fix time display in timesync action output (Selena Deckelmann)
Fix documentation typos (Josh Tolley)</code></pre>
</dd>
<dt id="Version-2.5.3-December-17-2008"><b>Version 2.5.3</b> (December 17, 2008)</dt>
<dd>
<pre><code> Minor fix to regex in verify_version (Lee Jensen)</code></pre>
</dd>
<dt id="Version-2.5.2-December-16-2008"><b>Version 2.5.2</b> (December 16, 2008)</dt>
<dd>
<pre><code> Minor documentation tweak.</code></pre>
</dd>
<dt id="Version-2.5.1-December-11-2008"><b>Version 2.5.1</b> (December 11, 2008)</dt>
<dd>
<pre><code> Add support for --noidle flag to prevent backends action from counting idle processes.
Patch by Selena Deckelmann.
Fix small undefined warning when not using --dbservice.</code></pre>
</dd>
<dt id="Version-2.5.0-December-4-2008"><b>Version 2.5.0</b> (December 4, 2008)</dt>
<dd>
<pre><code> Add support for the pg_Service.conf file with the --dbservice option.</code></pre>
</dd>
<dt id="Version-2.4.3-November-7-2008"><b>Version 2.4.3</b> (November 7, 2008)</dt>
<dd>
<pre><code> Fix options for replicate_row action, per report from Jason Gordon.</code></pre>
</dd>
<dt id="Version-2.4.2-November-6-2008"><b>Version 2.4.2</b> (November 6, 2008)</dt>
<dd>
<pre><code> Wrap File::Temp::cleanup() calls in eval, in case File::Temp is an older version.
Patch by Chris Butler.</code></pre>
</dd>
<dt id="Version-2.4.1-November-5-2008"><b>Version 2.4.1</b> (November 5, 2008)</dt>
<dd>
<pre><code> Cast numbers to numeric to support sequences ranges > bigint in check_sequence action.
Thanks to Scott Marlowe for reporting this.</code></pre>
</dd>
<dt id="Version-2.4.0-October-26-2008"><b>Version 2.4.0</b> (October 26, 2008)</dt>
<dd>
<pre><code> Add Cacti support with the dbstats action.
Pretty up the time output for last vacuum and analyze actions.
Show the percentage of backends on the check_backends action.</code></pre>
</dd>
<dt id="Version-2.3.10-October-23-2008"><b>Version 2.3.10</b> (October 23, 2008)</dt>
<dd>
<pre><code> Fix minor warning in action check_bloat with multiple databases.
Allow warning to be greater than critical when using the --reverse option.
Support the --perflimit option for the check_sequence action.</code></pre>
</dd>
<dt id="Version-2.3.9-October-23-2008"><b>Version 2.3.9</b> (October 23, 2008)</dt>
<dd>
<pre><code> Minor tweak to way we store the default port.</code></pre>
</dd>
<dt id="Version-2.3.8-October-21-2008"><b>Version 2.3.8</b> (October 21, 2008)</dt>
<dd>
<pre><code> Allow the default port to be changed easily.
Allow transform of simple output by MB, GB, etc.</code></pre>
</dd>
<dt id="Version-2.3.7-October-14-2008"><b>Version 2.3.7</b> (October 14, 2008)</dt>
<dd>
<pre><code> Allow multiple databases in 'sequence' action. Reported by Christoph Zwerschke.</code></pre>
</dd>
<dt id="Version-2.3.6-October-13-2008"><b>Version 2.3.6</b> (October 13, 2008)</dt>
<dd>
<pre><code> Add missing $schema to check_fsm_pages. (Robert Treat)</code></pre>
</dd>
<dt id="Version-2.3.5-October-9-2008"><b>Version 2.3.5</b> (October 9, 2008)</dt>
<dd>
<pre><code> Change option 'checktype' to 'valtype' to prevent collisions with -c[ritical]
Better handling of errors.</code></pre>
</dd>
<dt id="Version-2.3.4-October-9-2008"><b>Version 2.3.4</b> (October 9, 2008)</dt>
<dd>
<pre><code> Do explicit cleanups of the temp directory, per problems reported by sb@nnx.com.</code></pre>
</dd>
<dt id="Version-2.3.3-October-8-2008"><b>Version 2.3.3</b> (October 8, 2008)</dt>
<dd>
<pre><code> Account for cases where some rounding queries give -0 instead of 0.
Thanks to Glyn Astill for helping to track this down.</code></pre>
</dd>
<dt id="Version-2.3.2-October-8-2008"><b>Version 2.3.2</b> (October 8, 2008)</dt>
<dd>
<pre><code> Always quote identifiers in check_replicate_row action.</code></pre>
</dd>
<dt id="Version-2.3.1-October-7-2008"><b>Version 2.3.1</b> (October 7, 2008)</dt>
<dd>
<pre><code> Give a better error if one of the databases cannot be reached.</code></pre>
</dd>
<dt id="Version-2.3.0-October-4-2008"><b>Version 2.3.0</b> (October 4, 2008)</dt>
<dd>
<pre><code> Add the "sequence" action, thanks to Gavin M. Roy for the idea.
Fix minor problem with autovac_freeze action when using MRTG output.
Allow output argument to be case-insensitive.
Documentation fixes.</code></pre>
</dd>
<dt id="Version-2.2.4-October-3-2008"><b>Version 2.2.4</b> (October 3, 2008)</dt>
<dd>
<pre><code> Fix some minor typos</code></pre>
</dd>
<dt id="Version-2.2.3-October-1-2008"><b>Version 2.2.3</b> (October 1, 2008)</dt>
<dd>
<pre><code> Expand range of allowed names for --repinfo argument (Glyn Astill)
Documentation tweaks.</code></pre>
</dd>
<dt id="Version-2.2.2-September-30-2008"><b>Version 2.2.2</b> (September 30, 2008)</dt>
<dd>
<pre><code> Fixes for minor output and scoping problems.</code></pre>
</dd>
<dt id="Version-2.2.1-September-28-2008"><b>Version 2.2.1</b> (September 28, 2008)</dt>
<dd>
<pre><code> Add MRTG output to fsm_pages and fsm_relations.
Force error messages to one-line for proper Nagios output.
Check for invalid prereqs on failed command. From conversations with Euler Taveira de Oliveira.
Tweak the fsm_pages formula a little.</code></pre>
</dd>
<dt id="Version-2.2.0-September-25-2008"><b>Version 2.2.0</b> (September 25, 2008)</dt>
<dd>
<pre><code> Add fsm_pages and fsm_relations actions. (Robert Treat)</code></pre>
</dd>
<dt id="Version-2.1.4-September-22-2008"><b>Version 2.1.4</b> (September 22, 2008)</dt>
<dd>
<pre><code> Fix for race condition in txn_time action.
Add --debugoutput option.</code></pre>
</dd>
<dt id="Version-2.1.3-September-22-2008"><b>Version 2.1.3</b> (September 22, 2008)</dt>
<dd>
<pre><code> Allow alternate arguments "dbhost" for "host" and "dbport" for "port".
Output a zero as default value for second line of MRTG output.</code></pre>
</dd>
<dt id="Version-2.1.2-July-28-2008"><b>Version 2.1.2</b> (July 28, 2008)</dt>
<dd>
<pre><code> Fix sorting error in the "disk_space" action for non-Nagios output.
Allow --simple as a shortcut for --output=simple.</code></pre>
</dd>
<dt id="Version-2.1.1-July-22-2008"><b>Version 2.1.1</b> (July 22, 2008)</dt>
<dd>
<pre><code> Don't check databases with datallowconn false for the "autovac_freeze" action.</code></pre>
</dd>
<dt id="Version-2.1.0-July-18-2008"><b>Version 2.1.0</b> (July 18, 2008)</dt>
<dd>
<pre><code> Add the "autovac_freeze" action, thanks to Robert Treat for the idea and design.
Put an ORDER BY on the "txn_wraparound" action.</code></pre>
</dd>
<dt id="Version-2.0.1-July-16-2008"><b>Version 2.0.1</b> (July 16, 2008)</dt>
<dd>
<pre><code> Optimizations to speed up the "bloat" action quite a bit.
Fix "version" action to not always output in mrtg mode.</code></pre>
</dd>
<dt id="Version-2.0.0-July-15-2008"><b>Version 2.0.0</b> (July 15, 2008)</dt>
<dd>
<pre><code> Add support for MRTG and "simple" output options.
Many small improvements to nearly all actions.</code></pre>
</dd>
<dt id="Version-1.9.1-June-24-2008"><b>Version 1.9.1</b> (June 24, 2008)</dt>
<dd>
<pre><code> Fix an error in the bloat SQL in 1.9.0
Allow percentage arguments to be over 99%
Allow percentages in the bloat --warning and --critical (thanks to Robert Treat for the idea)</code></pre>
</dd>
<dt id="Version-1.9.0-June-22-2008"><b>Version 1.9.0</b> (June 22, 2008)</dt>
<dd>
<pre><code> Don't include information_schema in certain checks. (Jeff Frost)
Allow --include and --exclude to use schemas by using a trailing period.</code></pre>
</dd>
<dt id="Version-1.8.5-June-22-2008"><b>Version 1.8.5</b> (June 22, 2008)</dt>
<dd>
<pre><code> Output schema name before table name where appropriate.
Thanks to Jeff Frost.</code></pre>
</dd>
<dt id="Version-1.8.4-June-19-2008"><b>Version 1.8.4</b> (June 19, 2008)</dt>
<dd>
<pre><code> Better detection of problems in --replicate_row.</code></pre>
</dd>
<dt id="Version-1.8.3-June-18-2008"><b>Version 1.8.3</b> (June 18, 2008)</dt>
<dd>
<pre><code> Fix 'backends' action: there may be no rows in pg_stat_activity, so run a second
query if needed to find the max_connections setting.
Thanks to Jeff Frost for the bug report.</code></pre>
</dd>
<dt id="Version-1.8.2-June-10-2008"><b>Version 1.8.2</b> (June 10, 2008)</dt>
<dd>
<pre><code> Changes to allow working under Nagios' embedded Perl mode. (Ioannis Tambouras)</code></pre>
</dd>
<dt id="Version-1.8.1-June-9-2008"><b>Version 1.8.1</b> (June 9, 2008)</dt>
<dd>
<pre><code> Allow 'bloat' action to work on Postgres version 8.0.
Allow for different commands to be run for each action depending on the server version.
Give better warnings when running actions not available on older Postgres servers.</code></pre>
</dd>
<dt id="Version-1.8.0-June-3-2008"><b>Version 1.8.0</b> (June 3, 2008)</dt>
<dd>
<pre><code> Add the --reverse option to the custom_query action.</code></pre>
</dd>
<dt id="Version-1.7.1-June-2-2008"><b>Version 1.7.1</b> (June 2, 2008)</dt>
<dd>
<pre><code> Fix 'query_time' action: account for race condition in which zero rows appear in pg_stat_activity.
Thanks to Dustin Black for the bug report.</code></pre>
</dd>
<dt id="Version-1.7.0-May-11-2008"><b>Version 1.7.0</b> (May 11, 2008)</dt>
<dd>
<pre><code> Add --replicate_row action</code></pre>
</dd>
<dt id="Version-1.6.1-May-11-2008"><b>Version 1.6.1</b> (May 11, 2008)</dt>
<dd>
<pre><code> Add --symlinks option as a shortcut to --action=rebuild_symlinks</code></pre>
</dd>
<dt id="Version-1.6.0-May-11-2008"><b>Version 1.6.0</b> (May 11, 2008)</dt>
<dd>
<pre><code> Add the custom_query action.</code></pre>
</dd>
<dt id="Version-1.5.2-May-2-2008"><b>Version 1.5.2</b> (May 2, 2008)</dt>
<dd>
<pre><code> Fix problem with too eager creation of custom pgpass file.</code></pre>
</dd>
<dt id="Version-1.5.1-April-17-2008"><b>Version 1.5.1</b> (April 17, 2008)</dt>
<dd>
<pre><code> Add example Nagios configuration settings (Brian A. Seklecki)</code></pre>
</dd>
<dt id="Version-1.5.0-April-16-2008"><b>Version 1.5.0</b> (April 16, 2008)</dt>
<dd>
<pre><code> Add the --includeuser and --excludeuser options. Documentation cleanup.</code></pre>
</dd>
<dt id="Version-1.4.3-April-16-2008"><b>Version 1.4.3</b> (April 16, 2008)</dt>
<dd>
<pre><code> Add in the 'output' concept for future support of non-Nagios programs.</code></pre>
</dd>
<dt id="Version-1.4.2-April-8-2008"><b>Version 1.4.2</b> (April 8, 2008)</dt>
<dd>
<pre><code> Fix bug preventing --dbpass argument from working (Robert Treat).</code></pre>
</dd>
<dt id="Version-1.4.1-April-4-2008"><b>Version 1.4.1</b> (April 4, 2008)</dt>
<dd>
<pre><code> Minor documentation fixes.</code></pre>
</dd>
<dt id="Version-1.4.0-April-2-2008"><b>Version 1.4.0</b> (April 2, 2008)</dt>
<dd>
<pre><code> Have 'wal_files' action use pg_ls_dir (idea by Robert Treat).
For last_vacuum and last_analyze, respect autovacuum effects, add separate
autovacuum checks (ideas by Robert Treat).</code></pre>
</dd>
<dt id="Version-1.3.1-April-2-2008"><b>Version 1.3.1</b> (April 2, 2008)</dt>
<dd>
<pre><code> Have txn_idle use query_start, not xact_start.</code></pre>
</dd>
<dt id="Version-1.3.0-March-23-2008"><b>Version 1.3.0</b> (March 23, 2008)</dt>
<dd>
<pre><code> Add in txn_idle and txn_time actions.</code></pre>
</dd>
<dt id="Version-1.2.0-February-21-2008"><b>Version 1.2.0</b> (February 21, 2008)</dt>
<dd>
<pre><code> Add the 'wal_files' action, which counts the number of WAL files
in your pg_xlog directory.
Fix some typos in the docs.
Explicitly allow -v as an argument.
Allow for a null syslog_facility in the 'logfile' action.</code></pre>
</dd>
<dt id="Version-1.1.2-February-5-2008"><b>Version 1.1.2</b> (February 5, 2008)</dt>
<dd>
<pre><code> Fix error preventing --action=rebuild_symlinks from working.</code></pre>
</dd>
<dt id="Version-1.1.1-February-3-2008"><b>Version 1.1.1</b> (February 3, 2008)</dt>
<dd>
<pre><code> Switch vacuum and analyze date output to use 'DD', not 'D'. (Glyn Astill)</code></pre>
</dd>
<dt id="Version-1.1.0-December-16-2008"><b>Version 1.1.0</b> (December 16, 2008)</dt>
<dd>
<pre><code> Fixes, enhancements, and performance tracking.
Add performance data tracking via --showperf and --perflimit
Lots of refactoring and cleanup of how actions handle arguments.
Do basic checks to figure out syslog file for 'logfile' action.
Allow for exact matching of beta versions with 'version' action.
Redo the default arguments to only populate when neither 'warning' nor 'critical' is provided.
Allow just warning OR critical to be given for the 'timesync' action.
Remove 'redirect_stderr' requirement from 'logfile' due to 8.3 changes.
Actions 'last_vacuum' and 'last_analyze' are 8.2 only (Robert Treat)</code></pre>
</dd>
<dt id="Version-1.0.16-December-7-2007"><b>Version 1.0.16</b> (December 7, 2007)</dt>
<dd>
<pre><code> First public release, December 2007</code></pre>
</dd>
</dl>
<h1 id="BUGS-AND-LIMITATIONS">BUGS AND LIMITATIONS</h1>
<p>The index bloat size optimization is rough.</p>
<p>Some actions may not work on older versions of Postgres (before 8.0).</p>
<p>Please report any problems to check_postgres@bucardo.org</p>
<h1 id="AUTHOR">AUTHOR</h1>
<p>Greg Sabino Mullane <greg@endpoint.com></p>
<h1 id="NAGIOS-EXAMPLES">NAGIOS EXAMPLES</h1>
<p>Some example Nagios configuration settings using this script:</p>
<pre><code> define command {
command_name check_postgres_size
command_line $USER2$/check_postgres.pl -H $HOSTADDRESS$ -u pgsql -db postgres --action database_size -w $ARG1$ -c $ARG2$
}
define command {
command_name check_postgres_locks
command_line $USER2$/check_postgres.pl -H $HOSTADDRESS$ -u pgsql -db postgres --action locks -w $ARG1$ -c $ARG2$
}
define service {
use generic-other
host_name dbhost.gtld
service_description dbhost PostgreSQL Service Database Usage Size
check_command check_postgres_size!256000000!512000000
}
define service {
use generic-other
host_name dbhost.gtld
service_description dbhost PostgreSQL Service Database Locks
check_command check_postgres_locks!2!3
}</code></pre>
<h1 id="LICENSE-AND-COPYRIGHT">LICENSE AND COPYRIGHT</h1>
<p>Copyright (c) 2007-2017 Greg Sabino Mullane <greg@endpoint.com>.</p>
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
<pre><code> 1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.</code></pre>
<p>THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
</body>
</html>
|