/usr/lib/news/innreport_inn.pm is in inn2 2.6.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | ##########################################################################
# INN module for innreport (3.*).
#
# $Id: innreport_inn.pm 9920 2015-07-12 13:48:04Z iulius $
#
# Sample file tested with INN 2.5, 2.4, 2.3, 2.2, 1.7.2 and 1.5.1.
#
# (c) 1997-2001 by Fabien Tassin <fta@sofaraway.org>.
# See innreport for more information.
#
# Version 3.1.0.
#
##########################################################################
# TODO: add the map file.
package innreport_inn;
use strict;
my $MIN = 1E10;
my $MAX = -1;
my %ctlinnd = ('a', 'addhist', 'D', 'allow',
'b', 'begin', 'c', 'cancel',
'u', 'changegroup', 'd', 'checkfile',
'e', 'drop', 'f', 'flush',
'g', 'flushlogs', 'h', 'go',
'i', 'hangup', 's', 'mode',
'j', 'name', 'k', 'newgroup',
'l', 'param', 'm', 'pause',
'v', 'readers', 't', 'refile',
'C', 'reject', 'o', 'reload',
'n', 'renumber', 'z', 'reserve',
'p', 'rmgroup', 'A', 'send',
'q', 'shutdown', 'B', 'signal',
'r', 'throttle', 'w', 'trace',
'x', 'xabort', 'y', 'xexec',
'E', 'logmode', 'F', 'feedinfo',
'T', 'filter', 'P', 'perl',);
my %timer_names = (idle => 'idle',
hishave => 'history lookup',
hisgrep => 'history grep',
hiswrite => 'history write',
hissync => 'history sync',
nntpread => 'nntp read',
artparse => 'article parse',
artclean => 'article cleanup',
artwrite => 'article write',
artcncl => 'article cancel',
artlog => 'article logging',
sitesend => 'site send',
overv => 'overview write',
perl => 'perl filter',
python => 'python filter',
datamove => 'data move'
);
my %innfeed_timer_names = (
'idle' => 'idle',
'blstats' => 'backlog stats',
'stsfile' => 'status file',
'newart' => 'article new',
'prepart' => 'article prepare',
'readart' => 'article read',
'read' => 'data read',
'write' => 'data write',
'cb' => 'callbacks',
);
my %nnrpd_timer_names = (
'idle' => 'idle',
'newnews' => 'newnews',
);
our %batcher_articles;
our %batcher_bytes;
our %batcher_elapsed;
our %batcher_offered;
our %cnfsstat;
our %cnfsstat_cycles;
our %cnfsstat_rate;
our %cnfsstat_samples;
our %cnfsstat_size;
our %cnfsstat_time;
our %cnfsstat_used;
our %controlchan_doit;
our %controlchan_ihave_site;
our %controlchan_new;
our %controlchan_ok;
our %controlchan_other;
our %controlchan_rm;
our %controlchan_sendme_site;
our %controlchan_skippgp;
our %controlchan_who;
our %inn_badart;
our %innd_accepted;
our %innd_accepted_sum;
our %innd_bad_command;
our %innd_bad_ihave;
our %innd_bad_msgid;
our %innd_bad_newsgroup;
our %innd_bad_sendme;
our %innd_blocked;
our %innd_cache;
our %innd_changegroup;
our %innd_connect;
our %innd_connect_sum;
our %innd_control;
our %innd_duplicated_size;
our %innd_duplicated_size_sum;
our %innd_filter_perl;
our %innd_filter_python;
our %innd_his;
our %innd_huge;
our %innd_max_conn;
our %innd_misc;
our %innd_misc_stat;
our %innd_newgroup;
our %innd_no_colon_space;
our %innd_no_permission;
our %innd_offered;
our %innd_offered_size;
our %innd_offered_size_sum;
our %innd_offered_sum;
our %innd_others;
our %innd_posted_future;
our %innd_refused;
our %innd_refused_sum;
our %innd_rejected;
our %innd_rejected_size;
our %innd_rejected_size_sum;
our %innd_rejected_sum;
our %innd_rmgroup;
our %innd_seconds;
our %innd_seconds_sum;
our %innd_stored_size;
our %innd_stored_size_sum;
our %innd_strange_strings;
our %innd_time_max;
our %innd_time_min;
our %innd_time_num;
our %innd_time_time;
our $innd_time_times;
our %innd_too_many_connects_per_minute;
our %inn_duplicate;
our %innfeed_accepted;
our %innfeed_accepted_size;
our %innfeed_connect;
our %innfeed_missing;
our %innfeed_offered;
our %innfeed_refused;
our %innfeed_rejected;
our %innfeed_rejected_size;
our %innfeed_seconds;
our %innfeed_shrunk;
our %innfeed_spooled;
our %innfeed_time_max;
our %innfeed_time_min;
our %innfeed_time_num;
our %innfeed_time_time;
our $innfeed_time_times;
our %inn_flow;
our %inn_flow_labels;
our %inn_flow_size;
our $inn_flow_size_total;
our %inn_flow_time;
our $inn_flow_total;
our %inn_linecount;
our %inn_site_path;
our %inn_tooold;
our %inn_unapproved;
our %inn_unapproved_g;
our %inn_uw_dist;
our %inn_uw_dist_s;
our %inn_uw_ng;
our %inn_uw_ng_s;
our %inn_uw_site;
our %innxmit_accepted;
our %innxmit_accepted_size;
our %innxmit_afail_host;
our %innxmit_badart;
our %innxmit_cfail_host;
our %innxmit_crefused;
our %innxmit_duplicate;
our %innxmit_expire;
our %innxmit_hiload;
our %innxmit_ihfail;
our %innxmit_linecount;
our %innxmit_missing;
our %innxmit_nospace;
our %innxmit_offered;
our %innxmit_others;
our %innxmit_refused;
our %innxmit_rejected;
our %innxmit_rejected_size;
our %innxmit_site;
our %innxmit_times;
our %innxmit_tooold;
our %innxmit_unapproved;
our %innxmit_unapproved_g;
our %innxmit_uw_dist;
our %innxmit_uw_dist_s;
our %innxmit_uw_ng;
our %innxmit_uw_ng_s;
our %innxmit_uw_site;
our %nnrpd_articles;
our %nnrpd_auth;
our %nnrpd_bytes;
our %nnrpd_connect;
our %nnrpd_curious;
our %nnrpd_dom_articles;
our %nnrpd_dom_bytes;
our %nnrpd_dom_connect;
our %nnrpd_dom_groups;
our %nnrpd_dom_no_permission;
our %nnrpd_dom_post_error;
our %nnrpd_dom_post_ok;
our %nnrpd_dom_post_rej;
our %nnrpd_dom_reset_peer;
our %nnrpd_dom_timeout;
our %nnrpd_dom_times;
our %nnrpd_dom_unrecognized;
our %nnrpd_gethostbyaddr;
our %nnrpd_group;
our %nnrpd_groups;
our %nnrpd_hierarchy;
our %nnrpd_no_permission;
our %nnrpd_post_error;
our %nnrpd_post_ok;
our %nnrpd_post_rej;
our %nnrpd_reset_peer;
our %nnrpd_resource_elapsed;
our %nnrpd_resource_idle;
our %nnrpd_resource_system;
our %nnrpd_resource_user;
our %nnrpd_sys_times;
our %nnrpd_time_max;
our %nnrpd_time_min;
our %nnrpd_time_num;
our %nnrpd_timeout;
our %nnrpd_times;
our %nnrpd_time_time;
our $nnrpd_time_times;
our %nnrpd_unrecogn_cmd;
our %nnrpd_unrecognized;
our %nnrpd_usr_times;
our %nntplink_accepted;
our %nntplink_auth;
our %nntplink_bpipe;
our %nntplink_connects;
our %nntplink_eof;
our %nntplink_expire;
our %nntplink_fail;
our %nntplink_failed;
our %nntplink_fake_connects;
our %nntplink_hiload;
our %nntplink_ihfail;
our %nntplink_nospace;
our %nntplink_offered;
our %nntplink_rejected;
our %nntplink_selecterr;
our %nntplink_site;
our %nntplink_sockerr;
our %nntplink_times;
our %nocem_badsigs;
our %nocem_goodsigs;
our $nocem_lastid;
our $nocem_newids;
our %nocem_newids;
our $nocem_totalbad;
our $nocem_totalgood;
our $nocem_totalids;
our %nocem_totalids;
our %rnews_bogus_date;
our %rnews_bogus_dist;
our %rnews_bogus_ng;
our $rnews_duplicate;
our %rnews_host;
our $rnews_linecount;
our %rnews_misc;
our $rnews_no_colon_space;
our %rnews_rejected;
our $rnews_too_old;
our %rnews_unapproved;
our $server;
# init innd timer
foreach (values %timer_names) {
$innd_time_min{$_} = $MIN;
$innd_time_max{$_} = $MAX;
$innd_time_time{$_} = 0; # to avoid a warning... Perl < 5.004
$innd_time_num{$_} = 0; # ...
}
$innd_time_times = 0; # ...
# init innfeed timer
foreach (values %innfeed_timer_names) {
$innfeed_time_min{$_} = $MIN;
$innfeed_time_max{$_} = $MAX;
$innfeed_time_time{$_} = 0; # to avoid a warning... Perl < 5.004
$innfeed_time_num{$_} = 0; # ...
}
$innfeed_time_times = 0; # ...
# init nnrpd timer
foreach (values %nnrpd_timer_names) {
$nnrpd_time_min{$_} = $MIN;
$nnrpd_time_max{$_} = $MAX;
$nnrpd_time_time{$_} = 0; # to avoid a warning... Perl < 5.004
$nnrpd_time_num{$_} = 0; # ...
}
$nnrpd_time_times = 0; # ...
# collect: Used to collect the data.
sub collect($$$$$$) {
my ($day, $hour, $prog, $res, $left, $CASE_SENSITIVE) = @_;
return 1 if $left =~ /Reading config from (\S+)$/o;
########
## inn (from the "news" log file - not from "news.notice")
##
if ($prog eq "inn") {
# accepted article
if ($res =~ m/[\+j]/o) {
$hour =~ s/:.*$//o;
$inn_flow{"$day $hour"}++;
$inn_flow_total++;
# Memorize the size. This can only be done with INN >= 1.5xx and
# DO_LOG_SIZE = DO.
# server <msg-id> size [feeds]
# or
# server <msg-id> (filename) size [feeds]
my ($s) = $left =~ /^\S+ \S+ (?:\(\S+\) )?(\d+)(?: |$)/o;
if ($s) {
$inn_flow_size{"$day $hour"} += $s;
$inn_flow_size_total += $s;
}
return 1;
}
# 437 Duplicate article
if ($left =~ /(\S+) <[^>]+> (?:437|439) Duplicate(?: article)?$/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$inn_badart{$server}++;
$inn_duplicate{$server}++;
return 1;
}
# 437 Unapproved for
if ($left =~ /(\S+) <[^>]+> (?:437|439) Unapproved for \"([^\"]+)\"$/o) {
my ($server, $group) = ($1, $2);
$server = lc $server unless $CASE_SENSITIVE;
$inn_badart{$server}++;
$inn_unapproved{$server}++;
$inn_unapproved_g{$group}++;
return 1;
}
# 437 Too old -- ...
if ($left =~ /(\S+) <[^>]+> (?:437|439) Too old -- /o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$inn_badart{$server}++;
$inn_tooold{$server}++;
return 1;
}
# 437 Unwanted site ... in path
if ($left =~ /(\S+) <[^>]+> (?:437|439) Unwanted site (\S+) in path$/o) {
my ($server, $site) = ($1, $2);
$server = lc $server unless $CASE_SENSITIVE;
$inn_badart{$server}++;
$inn_uw_site{$server}++;
$inn_site_path{$site}++;
return 1;
}
# 437 Unwanted newsgroup "..."
if ($left =~ /(\S+) <[^>]+> (?:437|439) Unwanted newsgroup \"(\S+)\"$/o) {
my ($server, $group) = ($1, $2);
($group) = split(/,/, $group);
$server = lc $server unless $CASE_SENSITIVE;
$inn_badart{$server}++;
$inn_uw_ng_s{$server}++;
$inn_uw_ng{$group}++;
return 1;
}
# 437 Unwanted distribution "..."
if ($left =~ /(\S+) <[^>]+> (?:437|439) Unwanted distribution \"(\S+)\"$/o) {
my ($server, $dist) = ($1, $2);
$server = lc $server unless $CASE_SENSITIVE;
$inn_badart{$server}++;
$inn_uw_dist_s{$server}++;
$inn_uw_dist{$dist}++;
return 1;
}
# 437 Linecount x != y +- z
if ($left =~ /(\S+) <[^>]+> (?:437|439) Linecount/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$inn_badart{$server}++;
$inn_linecount{$server}++;
return 1;
}
# 437 No colon-space in "xxxx" header
if ($left =~ /(\S+) <[^>]+> (?:437|439) No colon-space in \"[^\"]+\" header/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$inn_badart{$server}++;
$innd_others{$server}++;
$innd_no_colon_space{$server}++;
return 1;
}
# 437 Article injected or posted in the future -- "xxxxx"
if ($left =~ /(\S+) <[^>]+> (?:437|439) Article injected or posted in the future -- \"[^\"]+\"/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innd_posted_future{$server}++;
$innd_others{$server}++;
$inn_badart{$server}++;
return 1;
}
# Article accepted but includes "....."
if ($left =~ /(\S+) <[^>]+> Article accepted but includes/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innd_strange_strings{$server}++;
$innd_others{$server}++;
$inn_badart{$server}++;
return 1;
}
# Cancelling <...>
if ($left =~ /(\S+) <[^>]+> Cancelling/o) {
return 1;
}
# all others are just counted as "Other"
if ($left =~ /(\S+) /o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$inn_badart{$server}++;
$innd_others{$server}++;
return 1;
}
}
########
## innd
if ($prog eq "innd") {
## Note for innd logs:
## there's a lot of entries detected but still not used
## (because of a lack of interest).
# think it's a dotquad
return 1 if $left =~ /^think it\'s a dotquad$/o;
if ($left =~ /^SERVER /o) {
# SERVER perl filtering enabled
return 1 if $left =~ /^SERVER perl filtering enabled$/o;
# SERVER perl filtering disabled
return 1 if $left =~ /^SERVER perl filtering disabled$/o;
# SERVER Python filtering enabled
return 1 if $left =~ /^SERVER Python filtering enabled$/o;
# SERVER Python filtering disabled
return 1 if $left =~ /^SERVER Python filtering disabled$/o;
# SERVER cancelled +id
return 1 if $left =~ /^SERVER cancelled /o;
}
# Python filter
return 1 if $left =~ /^defined python methods$/o;
return 1 if $left =~ /^reloading pyfilter$/o;
return 1 if $left =~ /^reloaded pyfilter OK$/o;
return 1 if $left =~ /^python interpreter initialized OK$/o;
return 1 if $left =~ /^python method \w+ not found$/o;
return 1 if $left =~ /^python: First load, so I can do initialization stuff\.$/o;
return 1 if $left =~ /^python: filter_before_reload executing\.\.\.$/o;
return 1 if $left =~ /^python: I\'m just reloading, so skip the formalities\.$/o;
return 1 if $left =~ /^python: spamfilter successfully hooked into INN$/o;
return 1 if $left =~ /^python: state change from \w+ to \w+ - /o;
return 1 if $left =~ /^python: filter_close running, bye!$/o;
# rejecting[perl]
if ($left =~ /^rejecting\[perl\] <[^>]+> \d+ (.*)/o) {
$innd_filter_perl{$1}++;
return 1;
}
# rejecting[python]
if ($left =~ /^rejecting\[python\] <[^>]+> \d+ (.*)/o) {
$innd_filter_python{$1}++;
return 1;
}
# closed lost
return 1 if $left =~ /^\S+ closed lost \d+/o;
# new control command
if ($left =~ /^ctlinnd command (\w)(:.*)?/o) {
my $command = $1;
my $cmd = $ctlinnd{$command};
$cmd = $command unless $cmd;
return 1 if $cmd eq 'flush'; # to avoid a double count
$innd_control{"$cmd"}++;
return 1;
}
# old control command (by letter)
if ($left =~ /^(\w)$/o) {
my $command = $1;
my $cmd = $ctlinnd{$command};
$cmd = $command unless $cmd;
return 1 if $cmd eq 'flush'; # to avoid a double count
$innd_control{"$cmd"}++;
return 1;
}
# old control command (letter + reason)
if ($left =~ /^(\w):.*$/o) {
my $command = $1;
my $cmd = $ctlinnd{$command};
$cmd = $command unless $cmd;
return 1 if $cmd eq 'flush'; # to avoid a double count
$innd_control{"$cmd"}++;
return 1;
}
# opened
return 1 if $left =~ /\S+ opened \S+:\d+:file$/o;
# buffered
return 1 if $left =~ /\S+ buffered$/o;
# spawned
return 1 if $left =~ /\S+ spawned \S+:\d+:proc:\d+$/o;
return 1 if $left =~ /\S+ spawned \S+:\d+:file$/o;
# running
return 1 if $left =~ /\S+ running$/o;
# sleeping
if ($left =~ /(\S+):\d+:proc:\d+ sleeping$/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innd_blocked{$server}++;
return 1;
}
# blocked sleeping
if ($left =~ /(\S+):\d+:proc:\d+ blocked sleeping/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innd_blocked{$server}++;
return 1;
}
if ($left =~ /(\S+):\d+ blocked sleeping/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innd_blocked{$server}++;
return 1;
}
# restarted
return 1 if $left =~ m/^\S+ restarted$/o;
# starting
return 1 if $left =~ m/^\S+ starting$/o;
# readclose
return 1 if $left =~ m/^\S+:\d+ readclose+$/o;
# rejected 502
if ($left =~ m/^(\S+) rejected 502$/) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innd_no_permission{$server}++;
return 1;
}
# rejected 505
if ($left =~ m/^(\S+) rejected 505$/) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innd_too_many_connects_per_minute{$server}++;
return 1;
}
# connected
#
# Record <server>:<channel> instead of just <server> as otherwise we may
# miss some persistent connection newsfeeds that in any given innreport
# reporting period may not record any connect entries. We'll accumulate
# these into totals at the end of processing.
if ($left =~ /^(\S+) connected (\d+)/o) {
my $server = "$1:$2";
$server = lc $server unless $CASE_SENSITIVE;
$innd_connect{$server}++;
return 1;
}
# logstatus (information written in inn_status.html)
return 1 if ($left =~ /\S+ status seconds \d+ accepted \d+ refused \d+ rejected \d+ duplicate \d+ accepted size \d+ duplicate size \d+(?: rejected size \d+)?$/o);
# closed/checkpoint (with times)
#
# Add all checkpoints. They contain stats generated since the last
# checkpoint.
# On a closed, a checkpoint is generated by innd. It is therefore
# useless to take into account a line corresponding to a closed status.
if ($left =~ /(\S+:\d+) (checkpoint|closed) seconds (\d+) accepted (\d+) refused (\d+) rejected (\d+) duplicate (\d+) accepted size (\d+) duplicate size (\d+)(?: rejected size (\d+))?$/o) {
my ($server, $status, $seconds, $accepted, $refused, $rejected, $duplicate, $accptsize, $dupsize, $rjctsize) =
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);
$server = lc $server unless $CASE_SENSITIVE;
if ($status eq 'checkpoint') {
$innd_seconds{$server} += $seconds;
$innd_accepted{$server} += $accepted;
$innd_refused{$server} += $refused;
$innd_rejected{$server} += $rejected;
$innd_stored_size{$server} += $accptsize;
$innd_duplicated_size{$server} += $dupsize;
$innd_rejected_size{$server} += ($rjctsize || 0);
}
return 1;
}
# closed (without times (?))
return 1 if $left =~ m/\S+ closed$/o;
# closed (for a cancel feed - MODE CANCEL)
return 1 if $left =~ m/localhost:\d+ closed seconds \d+ cancels \d+$/o;
# flush
if ($left =~ /(\S+) flush$/o) {
$innd_control{"flush"}++;
return 1;
}
# flush-file
if ($left =~ /flush_file/) {
$innd_control{"flush_file"}++;
return 1;
}
# too many connections from site
if ($left =~ /too many connections from (\S+)/o) {
$innd_max_conn{$1}++;
return 1;
}
# overview exit 0 elapsed 23 pid 28461
return 1 if $left =~ m/\S+ exit \d+ .*$/o;
# internal rejecting huge article
if ($left =~ /(\S+) internal rejecting huge article/o) {
my $server = $1;
$server =~ s/:\d+$//o;
$server = lc $server unless $CASE_SENSITIVE;
$innd_huge{$server}++;
return 1;
}
# internal closing free channel
if ($left =~ /(\S+) internal closing free channel/o) {
$innd_misc{"Free channel"}++;
return 1;
}
# internal (other)
return 1 if $left =~ /\S+ internal/o;
# wakeup
return 1 if $left =~ /\S+ wakeup$/o;
# throttle
if ($left =~ /(\S+) throttled? /) {
$innd_control{"throttle"}++;
return 1;
}
# profile timer
# ME time X nnnn X(X) [...]
# The exact timers change from various versions of INN, so try to deal
# with this in a general fashion.
if ($left =~ m/^\S+\s+ # ME
time\s(\d+)\s+ # time
((?:\S+\s\d+\(\d+\)\s*)+) # timer values
$/ox) {
$innd_time_times += $1;
my $timers = $2;
while ($timers =~ /(\S+) (\d+)\((\d+)\)\s*/g) {
my $name = $timer_names{$1} || $1;
$innd_time_time{$name} += $2;
if ($3) {
my $average = $2 / $3;
$innd_time_num{$name} += $3;
my $min = $innd_time_min{$name};
$innd_time_min{$name} = $average
if (!defined($min) || $min > $average);
my $max = $innd_time_max{$name};
$innd_time_max{$name} = $average
if (!defined($max) || $max < $average);
}
}
return 1;
}
# ME time xx idle xx(xx) [ bug ? a part of timer ?]
return 1 if $left =~ m/^ME time \d+ idle \d+\(\d+\)\s*$/o;
# ME HISstats x hitpos x hitneg x missed x dne
#
# from innd/his.c:
# HIShitpos: the entry existed in the cache and in history.
# HIShitneg: the entry existed in the cache but not in history.
# HISmisses: the entry was not in the cache, but was in the history file.
# HISdne: the entry was not in cache or history.
if ($left =~ m/^ME\ HISstats # ME HISstats
\ (\d+)\s+hitpos # hitpos
\ (\d+)\s+hitneg # hitneg
\ (\d+)\s+missed # missed
\ (\d+)\s+dne # dne
$/ox) {
$innd_his{'Positive hits'} += $1;
$innd_his{'Negative hits'} += $2;
$innd_his{'Cache misses'} += $3;
$innd_his{'Do not exist'} += $4;
return 1;
}
# SERVER history cache final: 388656 lookups, 1360 hits
if ($left =~ m/^SERVER history cache final: (\d+) lookups, (\d+) hits$/) {
$innd_cache{'Lookups'} += $1;
$innd_cache{'Hits'} += $2;
return 1;
}
# bad_hosts (appears after a "cant gesthostbyname" from a feed)
return 1 if $left =~ m/\S+ bad_hosts /o;
# cant read
return 1 if $left =~ m/\S+ cant read/o;
# cant write
return 1 if $left =~ m/\S+ cant write/o;
# cant flush
return 1 if $left =~ m/\S+ cant flush/o;
# spoolwake
return 1 if $left =~ m/\S+ spoolwake$/o;
# spooling
return 1 if $left =~ m/\S+ spooling/o;
# DEBUG
return 1 if $left =~ m/^DEBUG /o;
# NCmode
return 1 if $left =~ m/\S+ NCmode /o;
# outgoing
return 1 if $left =~ m/\S+ outgoing/o;
# inactive
return 1 if $left =~ m/\S+ inactive/o;
# timeout
return 1 if $left =~ m/\S+ timeout/o;
# lcsetup
return 1 if $left =~ m/\S+ lcsetup/o;
# rcsetup
return 1 if $left =~ m/\S+ rcsetup/o;
# flush_all
return 1 if $left =~ m/\S+ flush_all/o;
# buffered
return 1 if $left =~ m/\S+ buffered$/o;
# descriptors
return 1 if $left =~ m/\S+ descriptors/o;
# ccsetup
return 1 if $left =~ m/\S+ ccsetup/o;
# renumbering
return 1 if $left =~ m/\S+ renumbering/o;
# renumber
return 1 if $left =~ m/\S+ renumber /o;
# ihave from me
if ($left =~ m/\S+ ihave_from_me /o) {
$controlchan_ihave_site{'ME'}++;
return 1;
}
# sendme from me
if ($left =~ m/\S+ sendme_from_me /o) {
$controlchan_sendme_site{'ME'}++;
return 1;
}
# newgroup
if ($left =~ m/\S+ newgroup (\S+) as (\S)/o) {
$innd_newgroup{$1} = $2;
return 1;
}
# rmgroup
if ($left =~ m/\S+ rmgroup (\S+)$/o) {
$innd_rmgroup{$1}++;
return 1;
}
# changegroup
if ($left =~ m/\S+ change_group (\S+) to (\S)/o) {
$innd_changegroup{$1} = $2;
return 1;
}
# paused
if ($left =~ m/(\S+) paused /o) {
$innd_control{"paused"}++;
return 1;
}
# throttled
return 1 if $left =~ m/\S+ throttled/o;
# reload
if ($left =~ m/(\S+) reload/o) {
$innd_control{"reload"}++;
return 1;
}
# shutdown
if ($left =~ m/(\S+) shutdown/o) {
$innd_control{"shutdown"}++;
return 1;
}
# re-executed
return 1 if $left =~ m/^SERVER execv /o;
# SERVER servermode paused
return 1 if ($left =~ /(\S+) servermode paused$/o);
# SERVER servermode running
return 1 if ($left =~ /(\S+) servermode running$/o);
# SERVER flushlogs paused
if ($left =~ /(\S+) flushlogs /) {
$innd_control{"flushlogs"}++;
return 1;
}
# think it's a dotquad
return 1 if $left =~ /think it\'s a dotquad: /o;
# bad_ihave
if ($left =~ /(\S+) bad_ihave /) {
my $server = $1;
$server =~ s/:\d+$//o;
$server = lc $server unless $CASE_SENSITIVE;
$innd_bad_ihave{$server}++;
return 1;
}
# bad_messageid
if ($left =~ /(\S+) bad_messageid/o) {
my $server = $1;
$server =~ s/:\d+$//o;
$server = lc $server unless $CASE_SENSITIVE;
$innd_bad_msgid{$server}++;
return 1;
}
# bad_sendme
if ($left =~ /(\S+) bad_sendme /o) {
my $server = $1;
$server =~ s/:\d+$//o;
$server = lc $server unless $CASE_SENSITIVE;
$innd_bad_sendme{$server}++;
return 1;
}
# bad_command
if ($left =~ /(\S+) bad_command /o) {
my $server = $1;
$server =~ s/:\d+$//o;
$server = lc $server unless $CASE_SENSITIVE;
$innd_bad_command{$server}++;
return 1;
}
# bad_newsgroup
if ($left =~ /(\S+) bad_newsgroup /o) {
my $server = $1;
$server =~ s/:\d+$//o;
$innd_bad_newsgroup{$server}++;
$server = lc $server unless $CASE_SENSITIVE;
return 1;
}
if ($left =~ m/ cant /o) {
# cant select Bad file number
if ($left =~ / cant select Bad file number/o) {
$innd_misc{"Bad file number"}++;
return 1;
}
# cant gethostbyname
if ($left =~ / cant gethostbyname/o) {
$innd_misc{"gethostbyname error"}++;
return 1;
}
# cant accept RCreader
if ($left =~ / cant accept RCreader /o) {
$innd_misc{"RCreader"}++;
return 1;
}
# cant sendto CCreader
if ($left =~ / cant sendto CCreader /o) {
$innd_misc{"CCreader"}++;
return 1;
}
# cant (other) skipped - not particularly interesting
return 1;
}
# bad_newsfeeds no feeding sites
return 1 if $left =~ /\S+ bad_newsfeeds no feeding sites/o;
# CNFS: cycbuff rollover - possibly interesting
return 1 if $left =~ /CNFS(?:-sm)?: cycbuff \S+ rollover to cycle/o;
# CNFS: CNFSflushallheads: flushing - possibly interesting
return 1 if $left =~ /CNFS(?:-sm)?: CNFSflushallheads: flushing /o;
# CNFS: metacycbuff rollover with SEQUENTIAL
return 1 if $left =~ /CNFS(?:-sm)?: metacycbuff \S+ cycbuff is moved to /o;
# Cleanfeed status reports
return 1 if $left =~ /^filter: status/o;
return 1 if $left =~ /^filter: Reloading bad files/o;
return 1 if $left =~ /^filter: Saved EMP database/o;
return 1 if $left =~ /^filter: Restored EMP database/o;
}
########
## innfeed
if ($prog eq "innfeed") {
# connected
if ($left =~ /(\S+):\d+ connected$/) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innfeed_connect{$server}++;
return 1;
}
# closed periodic
return 1 if $left =~ m/\S+:\d+ closed periodic$/o;
# periodic close
return 1 if $left =~ m/\S+:\d+ periodic close$/o;
# checkpoint (child)
return 1 if $left =~ m/\S+:\d+ checkpoint seconds \d+ offered \d+ accepted \d+ refused \d+ rejected \d+/o;
# final (child)
return 1 if $left =~ m/\S+:\d+ final seconds \d+ offered \d+ accepted \d+ refused \d+ rejected \d+/o;
# global (real)
return 1 if $left =~ m/\S+ global seconds \d+ offered \d+ accepted \d+ refused \d+ rejected \d+ missing \d+/o;
# checkpoint (real) (new format)
if ($left =~ /(\S+) checkpoint seconds (\d+) offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) missing (\d+) accsize (\d+) rejsize (\d+) spooled (\d+)/o) {
my ($server, $seconds, $offered, $accepted, $refused, $rejected,
$missing, $accepted_size, $rejected_size, $spooled) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);
$server = lc $server unless $CASE_SENSITIVE;
$innfeed_seconds{$server} += $seconds;
$innfeed_offered{$server} += $offered;
$innfeed_accepted{$server} += $accepted;
$innfeed_refused{$server} += $refused;
$innfeed_rejected{$server} += $rejected;
$innfeed_missing{$server} += $missing;
$innfeed_spooled{$server} += $spooled;
$innfeed_accepted_size{$server} += $accepted_size;
$innfeed_rejected_size{$server} += $rejected_size;
return 1;
} elsif ($left =~ /(\S+) checkpoint seconds (\d+) offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) missing (\d+) spooled (\d+)/o) {
my ($server, $seconds, $offered, $accepted, $refused, $rejected,
$missing, $spooled) = ($1, $2, $3, $4, $5, $6, $7, $8);
$server = lc $server unless $CASE_SENSITIVE;
$innfeed_seconds{$server} += $seconds;
$innfeed_offered{$server} += $offered;
$innfeed_accepted{$server} += $accepted;
$innfeed_refused{$server} += $refused;
$innfeed_rejected{$server} += $rejected;
$innfeed_missing{$server} += $missing;
$innfeed_spooled{$server} += $spooled;
return 1;
}
# checkpoint (only seconds & spooled)
if ($left =~ /(\S+) checkpoint seconds (\d+) spooled (\d+)/o) {
my ($server, $seconds, $spooled) = ($1, $2, $3);
$server = lc $server unless $CASE_SENSITIVE;
# Initialize a value for that key (otherwise, it does not appear in the
# report, and the total line is wrong).
$innfeed_offered{$server} += 0;
$innfeed_seconds{$server} += $seconds;
$innfeed_spooled{$server} += $spooled;
return 1;
}
# final
return 1 if $left =~ m/\S+ final seconds/o;
# ME file xxxx shrunk from yyyy to zzz
if ($left =~ /^ME file (.*)\.output shrunk from (\d+) to (\d+)$/) {
my ($file, $s1, $s2) = ($1, $2, $3);
$file =~ s|^.*/([^/]+)$|$1|; # keep only the server name
$innfeed_shrunk{$file} += $s1 - $s2;
return 1;
}
# profile timer
# ME time X nnnn X(X) [...]
return 1 if $left =~ m/backlogstats/;
if ($left =~ m/^\S+\s+ # ME
time\s(\d+)\s+ # time
((?:\S+\s\d+\(\d+\)\s*)+) # timer values
$/ox) {
$innfeed_time_times += $1;
my $timers = $2;
while ($timers =~ /(\S+) (\d+)\((\d+)\)\s*/g) {
my $name = $innfeed_timer_names{$1} || $1;
$innfeed_time_time{$name} += $2;
if ($3) {
$innfeed_time_num{$name} += $3;
my $average = $2 / $3;
my $min = $innfeed_time_min{$name};
$innfeed_time_min{$name} = $average
if (!defined($min) || $min > $average);
my $max = $innfeed_time_max{$name};
$innfeed_time_max{$name} = $average
if (!defined($max) || $max < $average);
}
}
return 1;
}
# xxx grabbing external tape file
return 1 if $left =~ m/ grabbing external tape file/o;
# hostChkCxns - maxConnections was
return 1 if $left =~ m/hostChkCxns - maxConnections was /o;
# cxnsleep
return 1 if $left =~ m/\S+ cxnsleep .*$/o;
# idle
return 1 if $left =~ m/\S+ idle tearing down connection$/o;
# remote
return 1 if $left =~ m/\S+ remote .*$/o;
# spooling
return 1 if $left =~ m/\S+ spooling no active connections$/o;
# ME articles total
return 1 if $left =~ m/(?:SERVER|ME) articles total \d+ bytes \d+/o;
# ME articles active
return 1 if $left =~ m/(?:SERVER|ME) articles active \d+ bytes \d+/o;
# connect : Connection refused
return 1 if $left =~ m/connect : Connection refused/o;
# connect : Network is unreachable
return 1 if $left =~ m/connect : Network is unreachable/o;
# connect : Address family not supported by protocol
return 1 if $left =~ m/connect : Address family not supported by protocol/o;
# connect : No route to host
return 1 if $left =~ m/connect : No route to host/o;
# connection vanishing
return 1 if $left =~ m/connection vanishing/o;
# can't resolve hostname
return 1 if $left =~ m/can\'t resolve hostname/o;
# new hand-prepared backlog file
return 1 if $left =~ m/new hand-prepared backlog file/o;
# flush re-connect failed
return 1 if $left =~ m/flush re-connect failed/o;
# internal QUIT while write pending
return 1 if $left =~ m/internal QUIT while write pending/o;
# ME source lost . Exiting
return 1 if $left =~ m/(?:SERVER|ME) source lost . Exiting/o;
# ME starting innfeed (+version & date)
return 1 if $left =~ m/(?:SERVER|ME) starting (?:innfeed|at)/o;
# ME finishing at (date)
return 1 if $left =~ m/(?:SERVER|ME) finishing at /o;
# mode no-CHECK entered
return 1 if $left =~ m/mode no-CHECK entered/o;
# mode no-CHECK exited
return 1 if $left =~ m/mode no-CHECK exited/o;
# closed
return 1 if $left =~ m/^(\S+) closed$/o;
# global (+ seconds offered accepted refused rejected missing)
return 1 if $left =~ m/^(\S+) global/o;
# idle connection still has articles
return 1 if $left =~ m/^(\S+) idle connection still has articles$/o;
# missing article for IHAVE-body
return 1 if $left =~ m/^(\S+) missing article for IHAVE-body$/o;
# cannot continue
return 1 if $left =~ m/^cannot continue/o;
if ($left =~ /^(?:SERVER|ME)/o) {
# ME dropping articles into ...
return 1 if $left =~ / dropping articles into /o;
# ME dropped ...
return 1 if $left =~ / dropped /o;
# ME internal bad data in checkpoint file
return 1 if $left =~ m/ internal bad data in checkpoint/o;
# ME two filenames for same article
return 1 if $left =~ m/ two filenames for same article/o;
# ME unconfigured peer
return 1 if $left =~ m/ unconfigured peer/o;
# exceeding maximum article size
return 1 if $left =~ m/ exceeding maximum article byte/o;
# no space left on device errors
return 1 if $left =~ m/ ioerr fclose/o;
return 1 if $left =~ m/ lock failed for host/o;
return 1 if $left =~ m/ lock file pid-write/o;
return 1 if $left =~ m/ locked cannot setup peer/o;
return 1 if $left =~ m/ received shutdown signal/o;
# unconfigured peer
return 1 if $left =~ m/ unconfigured peer/o;
# ME lock
return 1 if $left =~ m/ lock/o;
# ME exception: getsockopt (0): Socket operation on non-socket
return 1 if $left =~ m/ exception: getsockopt /o;
# ME config aborting fopen (...) Permission denied
return 1 if $left =~ m/ config aborting fopen /o;
# ME cant chmod innfeed.pid....
return 1 if $left =~ m/ cant chmod \S+\/innfeed.pid/o;
return 1 if $left =~ m/ tape open failed /o;
return 1 if $left =~ m/ oserr open checkpoint file:/o;
# ME finishing (quickly)
return 1 if $left =~ m/\(quickly\) /o;
# ME config: value of streaming is not a boolean
return 1 if $left =~ m/config: value of \S+ is not/o;
# innfeed rolling funnel file
return 1 if $left =~ m/ preparing to roll /o;
return 1 if $left =~ m/ reached EOF in /o;
return 1 if $left =~ m/ opened /o;
# when optional parameters are not present in innfeed.conf
return 1 if $left =~ m/ config: adding default value for key /o;
}
# hostChkCxn - now: x.xx, prev: x.xx, abs: xx, curr: x
return 1 if $left =~ m/ hostChkCxn - now/o;
# loading path_to_config_file/innfeed.conf
return 1 if $left =~ m/loading /o;
# Finally, to avoid problems with strange error lines, ignore them.
#return 1 if ($left =~ /ME /);
}
########
## innxmit
if ($prog eq "innxmit") {
# 437 Duplicate article
if ($left =~ /(\S+) rejected [^\s]+ \(.*?\) (?:437|439) Duplicate article$/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_badart{$server}++;
$innxmit_duplicate{$server}++;
return 1;
}
# 437 Unapproved for
if ($left =~ /(\S+) rejected [^\s]+ \(.*\) (?:437|439) Unapproved for \"(.*?)\"$/o) {
my ($server, $group) = ($1, $2);
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_badart{$server}++;
$innxmit_unapproved{$server}++;
$innxmit_unapproved_g{$group}++;
return 1;
}
# 437 Too old -- ...
if ($left =~ /(\S+) rejected [^\s]+ \(.*\) (?:437|439) Too old -- \".*?\"$/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_badart{$server}++;
$innxmit_tooold{$server}++;
return 1;
}
# 437 Unwanted site ... in path
if ($left =~
/(\S+) rejected [^\s]+ \(.*?\) (?:437|439) Unwanted site (\S+) in path$/o) {
my ($server, $site) = ($1, $2);
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_badart{$server}++;
$innxmit_uw_site{$server}++;
# $innxmit_site_path{$site}++;
return 1;
}
# 437 Unwanted newsgroup "..."
if ($left =~
/(\S+) rejected [^\s]+ \(.*?\) (?:437|439) Unwanted newsgroup \"(\S+)\"$/o) {
my ($server, $group) = ($1, $2);
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_badart{$server}++;
$innxmit_uw_ng_s{$server}++;
$innxmit_uw_ng{$group}++;
return 1;
}
# 437 Unwanted distribution "..."
if ($left =~
/(\S+) rejected [^\s]+ \(.*?\) (?:437|439) Unwanted distribution \"(\S+)\"$/o) {
my ($server, $dist) = ($1, $2);
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_badart{$server}++;
$innxmit_uw_dist_s{$server}++;
$innxmit_uw_dist{$dist}++;
return 1;
}
# xx rejected foo.bar/12345 (foo/bar/12345) 437 Unwanted distribution "..."
if ($left =~ /^(\S+) rejected .* (?:437|439) Unwanted distribution \"(\S+)\"$/o) {
my ($server, $dist) = ($1, $2);
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_badart{$server}++;
$innxmit_uw_dist_s{$server}++;
$innxmit_uw_dist{$dist}++;
return 1;
}
# 437 Linecount x != y +- z
if ($left =~ /(\S+) rejected [^\s]+ \(.*?\) (?:437|439) Linecount/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_badart{$server}++;
$innxmit_linecount{$server}++;
return 1;
}
# 437 Newsgroup name illegal -- "xxx"
if ($left =~ /(\S+) rejected .* (?:437|439) Newsgroup name illegal -- "[^\"]*"$/) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_others{$server}++;
$innxmit_badart{$server}++;
return 1;
}
# Streaming retries
return 1 if ($left =~ /\d+ Streaming retries$/o);
# ihave failed
if ($left =~ /(\S+) ihave failed/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_ihfail{$server} = 1;
if ($left = /436 \S+ NNTP \S+ out of space/o) {
$innxmit_nospace{$server}++;
return 1;
}
if ($left = /400 \S+ space/o) {
$innxmit_nospace{$server}++;
return 1;
}
if ($left = /400 Bad file/o) {
$innxmit_crefused{$server}++;
return 1;
}
if ($left = /480 Transfer permission denied/o) {
$innxmit_crefused{$server}++;
return 1;
}
}
# stats (new format)
if ($left =~
/(\S+) stats offered (\d+) accepted (\d+) refused (\d+) rejected (\d+) missing (\d+) accsize (\d+) rejsize (\d+)$/o) {
my ($server, $offered, $accepted, $refused, $rejected, $missing, $accbytes, $rejbytes) =
($1, $2, $3, $4, $5, $6, $7, $8);
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_offered{$server} += $offered;
$innxmit_offered{$server} -= $innxmit_ihfail{$server}
if ($innxmit_ihfail{$server});
$innxmit_accepted{$server} += $accepted;
$innxmit_refused{$server} += $refused;
$innxmit_rejected{$server} += $rejected;
$innxmit_missing{$server} += $missing;
$innxmit_accepted_size{$server} += $accbytes;
$innxmit_rejected_size{$server} += $rejbytes;
$innxmit_site{$server}++;
$innxmit_ihfail{$server} = 0;
return 1;
}
# stats
if ($left =~
/(\S+) stats offered (\d+) accepted (\d+) refused (\d+) rejected (\d+)$/o) {
my ($server, $offered, $accepted, $refused, $rejected) =
($1, $2, $3, $4, $5);
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_offered{$server} += $offered;
$innxmit_offered{$server} -= $innxmit_ihfail{$server}
if ($innxmit_ihfail{$server});
$innxmit_accepted{$server} += $accepted;
$innxmit_refused{$server} += $refused;
$innxmit_rejected{$server} += $rejected;
$innxmit_site{$server}++;
$innxmit_ihfail{$server} = 0;
return 1;
}
# times
if ($left =~ /(\S+) times user (.+) system (\S+) elapsed (\S+)$/o) {
my ($server, $user, $system, $elapsed) = ($1, $2, $3, $4);
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_times{$server} += $elapsed;
return 1;
}
# connect & no space
if ($left =~ /(\S+) connect \S+ 400 No space/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_nospace{$server}++;
$innxmit_site{$server}++;
return 1;
}
# connect & NNTP no space
if ($left =~ /(\S+) connect \S+ 400 \S+ out of space/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_nospace{$server}++;
$innxmit_site{$server}++;
return 1;
}
# connect & loadav
if ($left =~ /(\S+) connect \S+ 400 loadav/o) {
my $server = $1;
if ($left =~ /expir/i) {
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_expire{$server}++;
$innxmit_site{$server}++;
return 1;
}
}
# connect 400 (other)
if ($left =~ /(\S+) connect \S+ 400/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_crefused{$server}++;
$innxmit_site{$server}++;
return 1;
}
# connect failed
if ($left =~ /(\S+) connect failed/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_cfail_host{$server}++;
$innxmit_site{$server}++;
return 1;
}
# authenticate failed
if ($left =~ /(\S+) authenticate failed/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_afail_host{$server}++;
$innxmit_site{$server}++;
return 1;
}
# xxx ihave failed 400 loadav [innwatch:hiload] yyy gt zzz
if ($left =~ /^(\S+) ihave failed 400 loadav/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$innxmit_hiload{$server}++;
return 1;
}
# ihave failed
return 1 if ($left =~ /\S+ ihave failed/o);
# requeued (....) 436 No space
return 1 if ($left =~ /\S+ requeued \S+ 436 No space/o);
# requeued (....) 400 No space
return 1 if ($left =~ /\S+ requeued \S+ 400 No space/o);
# requeued (....) 436 Can't write history
return 1 if ($left =~ /\S+ requeued \S+ 436 Can\'t write history/o);
# unexpected response code
return 1 if ($left =~ /unexpected response code /o);
}
########
## nntplink
if ($prog eq "nntplink") {
$left =~ s/^(\S+):/$1/;
# EOF
if ($left =~ /(\S+) EOF /o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_site{$server}++;
$nntplink_eof{$server}++;
return 1;
}
# Broken pipe
if ($left =~ /(\S+) Broken pipe$/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_site{$server}++;
$nntplink_bpipe{$server}++;
return 1;
}
# already running - won't die
return 1 if $left =~ /\S+ nntplink.* already running /o;
# connection timed out
if ($left =~ /(\S+) connection timed out/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_site{$server}++;
$nntplink_bpipe{$server}++;
return 1;
}
# greeted us with 400 No space
if ($left =~ /(\S+) greeted us with 400 No space/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_site{$server}++;
$nntplink_nospace{$server}++;
return 1;
}
# greeted us with 400 loadav
if ($left =~ /(\S+) greeted us with 400 loadav/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_site{$server}++;
$nntplink_hiload{$server}++;
return 1;
}
# greeted us with 400 (other)
if ($left =~ /(\S+) greeted us with 400/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_site{$server}++;
if ($left =~ /expir/i) {
$nntplink_expire{$server}++;
} else {
$nntplink_fail{$server}++;
}
return 1;
}
# greeted us with 502
if ($left =~ /(\S+) greeted us with 502/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_site{$server}++;
$nntplink_auth{$server}++;
return 1;
}
# sent authinfo
if ($left =~ /(\S+) sent authinfo/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_site{$server}++;
$nntplink_auth{$server}++;
return 1;
}
# socket()
if ($left =~ /(\S+) socket\(\): /o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_site{$server}++;
$nntplink_sockerr{$server}++;
return 1;
}
# select()
if ($left =~ /(\S+) select\(\) /o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_site{$server}++;
$nntplink_selecterr{$server}++;
return 1;
}
# sent IHAVE
if ($left =~ /(\S+) sent IHAVE/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_ihfail{$server}++;
if (($left =~ / 436 /) && ($left =~ / out of space /)) {
$nntplink_fake_connects{$server}++;
$nntplink_nospace{$server}++;
}
return 1;
}
# article .... failed(saved): 436 No space
if ($left =~ /(\S+) .* failed\(saved\): 436 No space$/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_nospace{$server}++;
return 1;
}
# article .. 400 No space left on device writing article file -- throttling
if ($left =~ /(\S+) .* 400 No space left on device writing article file -- throttling$/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_nospace{$server}++;
return 1;
}
# stats
if ($left =~ /(\S+) stats (\d+) offered (\d+) accepted (\d+) rejected (\d+) failed (\d+) connects$/o) {
my ($server, $offered, $accepted, $rejected, $failed, $connects) =
($1, $2, $3, $4, $5, $6);
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_offered{$server} += $offered - $nntplink_ihfail{$server}++;
$nntplink_accepted{$server} += $accepted;
$nntplink_rejected{$server} += $rejected;
$nntplink_failed{$server} += $failed;
$nntplink_connects{$server} += $connects;
$nntplink_ihfail{$server} = 0;
if ($nntplink_fake_connects{$server}) {
$nntplink_site{$server} += $nntplink_fake_connects{$server};
$nntplink_fake_connects{$server} = 0;
} else {
$nntplink_site{$server}++;
}
return 1;
}
# xmit
if ($left =~ /(\S+) xmit user (.+) system (\S+) elapsed (\S+)$/o) {
my ($server, $user, $system, $elapsed) = ($1, $2, $3, $4);
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_times{$server} += $elapsed;
return 1;
}
# xfer
return 1 if $left =~ /\S+ xfer/o;
# Links down .. x hours
if ($left =~ /(\S+) Links* down \S+ \d+/o) {
# Collected but not used
# my $server = $1;
# $server = lc $server unless $CASE_SENSITIVE;
# $nntplink_down{$server} += $hours;
return 1;
}
# 503 Timeout
if ($left =~ /^(\S+) \S+ \S+ \S+ 503 Timeout/o) {
# Collected but not used
# my $server = $1;
# $server = lc $server unless $CASE_SENSITIVE;
# $nntplink_timeout{$server}++;
return 1;
}
# read() error while reading reply
if ($left =~ /^(\S+): read\(\) error while reading reply/o) {
my $server = $1;
$server = lc $server unless $CASE_SENSITIVE;
$nntplink_failed{$server}++;
return 1;
}
# Password file xxxx not found
return 1 if $left =~ /^\S+ Password file \S+ not found/;
# No such
return 1 if $left =~ /^\S+ \S+ \S+ No such/;
# already running
return 1 if $left =~ /^\S+ \S+ already running/;
# error reading version from datafile
return 1 if $left =~ /error reading version from datafile/;
}
########
## nnrpd
if ($prog =~ /^nnrpd(?:-ssl)?$/)
{
# Fix a small bug of nnrpd (inn 1.4*)
$left =~ s/^ /\? /o;
# Another bug (in INN 1.5b1)
return 1 if $left =~ /^\020\002m$/o; # ^P^Bm
# bad_history at num for <ref>
return 1 if $left =~ /bad_history at \d+ for /o;
# timeout short
return 1 if $left =~ /\S+ timeout short$/o;
# < or > + (blablabla)
return 1 if $left =~ /^\S+ [\<\>] /o;
# cant opendir ... I/O error
return 1 if $left =~ /\S+ cant opendir \S+ I\/O error$/o;
# perl filtering enabled
return 1 if $left =~ /perl filtering enabled$/o;
# Python filtering enabled
return 1 if $left =~ /Python filtering enabled$/o;
return 1 if $left =~ /^python interpreter initialized OK$/o;
return 1 if $left =~ /^python method \S+ not found$/o;
return 1 if $left =~ /^python authenticate method succeeded, return code \d+, error string /o;
return 1 if $left =~ /^python access method succeeded$/o;
return 1 if $left =~ /^python dynamic method \(\w+ access\) succeeded, refuse string: /o;
return 1 if $left =~ /^python: .+ module successfully hooked into nnrpd$/o;
return 1 if $left =~ /^python: nnrpd .+ class instance created$/o;
return 1 if $left =~ /^python: n_a authenticate\(\) invoked: hostname \S+, ipaddress \S+, interface \S+, user /o;
return 1 if $left =~ /^python: n_a access\(\) invoked: hostname \S+, ipaddress \S+, interface \S+, user /o;
return 1 if $left =~ /^python: n_a dynamic\(\) invoked against type \S+, hostname \S+, ipaddress \S+, interface \S+, user /o;
return 1 if $left =~ /^python: authentication by username succeeded$/o;
return 1 if $left =~ /^python: authentication by username failed$/o;
return 1 if $left =~ /^python: authentication access by IP address succeeded$/o;
return 1 if $left =~ /^python: authentication access by IP address failed$/o;
return 1 if $left =~ /^python: dynamic access module successfully hooked into nnrpd$/o;
return 1 if $left =~ /^python: dynamic authorization access for read access granted$/o;
return 1 if $left =~ /^python: dynamic authorization access type is not known: /o;
# during scanlogs
return 1 if $left =~ /^\S+ rejected Flushing log and syslog files$/o;
return 1 if $left =~ /^\S+ rejected Snapshot log and syslog files$/o;
# other logs that should not be reported as errors
return 1 if $left =~ /^\S+ auth also-log: /o;
return 1 if $left =~ /^\S+ res also-log: /o;
return 1 if $left =~ /^\S+ rejected by rule /o;
# connect
if ($left =~ /(\S+) (\([0-9a-fA-F:.]*\) )?connect(?: - port \d+)?$/o) {
my $cust = $1;
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_dom_connect{$dom}++;
$nnrpd_connect{$cust}++;
return 1;
}
# group
if ($left =~ /(\S+) group (\S+) (\d+)$/o) {
my ($cust, $group, $num) = ($1, $2, $3);
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
if ($num) {
$nnrpd_group{$group} += $num;
$nnrpd_groups{$cust}++;
$nnrpd_dom_groups{$dom}++;
my ($hierarchy) = $group =~ /^([^\.]+).*$/o;
$nnrpd_hierarchy{$hierarchy} += $num;
}
return 1;
}
# post/ihave failed
if ($left =~ /(\S+) (post|ihave) failed (.*)$/o) {
my ($cust, $error) = ($1, $3);
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_dom_post_error{$dom}++;
$nnrpd_post_error{$cust}++;
return 1;
}
# post ok
return 1 if $left =~ /\S+ post ok/o;
# ihave ok
return 1 if $left =~ /\S+ ihave ok/o;
# posts
if ($left =~ /(\S+) posts received (\d+) rejected (\d+)$/o) {
my ($cust, $received, $rejected) = ($1, $2, $3);
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_dom_post_ok{$dom} += $received;
$nnrpd_dom_post_rej{$dom} += $rejected;
$nnrpd_post_ok{$cust} += $received;
$nnrpd_post_rej{$cust} += $rejected;
return 1;
}
# noperm post without permission
if ($left =~ /(\S+) noperm post without permission/o) {
my $cust = $1;
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_dom_post_rej{$dom} ++;
$nnrpd_post_rej{$cust} ++;
return 1;
}
# no_permission
if ($left =~ /(\S+) no_(permission|access)$/o) {
my $cust = $1;
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_no_permission{$cust}++;
$nnrpd_dom_no_permission{$dom}++;
return 1;
}
# bad_auth
if ($left =~ /(\S+) bad_auth$/o) {
my $cust = $1;
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_dom_no_permission{$dom}++;
$nnrpd_no_permission{$cust}++;
return 1;
}
# Authentication failure
# User not known to the underlying authentication module
return 1 if $left =~ / ckpasswd: pam_authenticate failed: /o;
return 1 if $left =~ / ckpasswd: user .+ unknown$/o;
# AUTHINFO (a username is a bytes string)
if (($left =~ /\S+ user (.+)$/o) &&
($left !~ /\S+ times user .+ system \S+ idle \S+ elapsed \S+$/o)) {
my $user = $1;
$nnrpd_auth{$user}++;
return 1;
}
# unrecognized + command
if ($left =~ /(\S+) unrecognized (.*)$/o) {
my ($cust, $error) = ($1, $2);
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$error = "_null command_" if ($error !~ /\S/);
$error =~ s/^(xmotd) .*$/$1/i if ($error =~ /^xmotd .*$/i);
$nnrpd_dom_unrecognized{$dom}++;
$nnrpd_unrecognized{$cust}++;
$nnrpd_unrecogn_cmd{$error}++;
return 1;
}
# exit (also called when using STARTTLS)
if ($left =~ /(\S+) (?:exit|exit for STARTTLS|exit for AUTHINFO SASL) articles (\d+) groups (\d+)$/o) {
my ($cust, $articles, $groups) = ($1, $2, $3);
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
if ($cust eq '?') {
$nnrpd_connect{$cust}++;
$nnrpd_dom_connect{$dom}++;
}
$nnrpd_articles{$cust} += $articles;
$nnrpd_dom_articles{$dom} += $articles;
return 1;
}
# times
if ($left =~ /(\S+) times user (.+) system (\S+) idle (\S+) elapsed (\S+)$/o) {
my ($cust, $user, $system, $idle, $elapsed) = ($1, $2, $3, $4, $5);
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_times{$cust} += $elapsed;
$nnrpd_resource_user{$cust} += $user;
$nnrpd_resource_system{$cust} += $system;
$nnrpd_resource_idle{$cust} += $idle;
$nnrpd_resource_elapsed{$cust} += $elapsed;
$nnrpd_dom_times{$dom} += $elapsed;
return 1;
}
# artstats
if ($left =~ /(\S+) artstats get (\d+) time (\d+) size (\d+)$/o) {
my ($cust, $articles, $time, $bytes) = ($1, $2, $3, $4);
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_bytes{$cust} += $bytes;
$nnrpd_dom_bytes{$dom} += $bytes;
return 1;
}
# timeout
if ($left =~ /(\S+) timeout$/o) {
my $cust = $1;
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_dom_timeout{$dom}++;
$nnrpd_timeout{$cust}++;
return 1;
}
# timeout in post
if ($left =~ /(\S+) timeout in post$/o) {
my $cust = $1;
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_dom_timeout{$dom}++;
$nnrpd_timeout{$cust}++;
return 1;
}
# can't read: Connection timed out
if ($left =~ /(\S+) can\'t read: Connection timed out$/o) {
my $cust = $1;
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_dom_timeout{$dom}++;
$nnrpd_timeout{$cust}++;
return 1;
}
# can't read: Operation timed out
if ($left =~ /(\S+) can\'t read: Operation timed out$/o) {
my $cust = $1;
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_dom_timeout{$dom}++;
$nnrpd_timeout{$cust}++;
return 1;
}
# can't read: Connection reset by peer
if ($left =~ /(\S+) can\'t read: Connection reset by peer$/o) {
my $cust = $1;
$cust = lc $cust unless $CASE_SENSITIVE;
my $dom = &host2dom($cust);
$nnrpd_dom_reset_peer{$dom}++;
$nnrpd_reset_peer{$cust}++;
return 1;
}
# can't read: Network is unreachable
return 1 if $left =~ /(\S+) can\'t read: Network is unreachable$/o;
# gethostbyaddr: xxx.yyy.zzz != a.b.c.d
if ($left =~ /^gethostbyaddr: (.*)$/o) {
my $msg = $1;
$nnrpd_gethostbyaddr{$msg}++;
return 1;
}
# can't gethostbyaddr
if ($left =~ /\? can\'t gethostbyaddr (\S+) .*$/o) {
my $ip = $1;
$nnrpd_gethostbyaddr{$ip}++;
return 1;
}
# can't getpeername
if ($left =~ /\? can\'t getpeername/o) {
# $nnrpd_getpeername++;
$nnrpd_gethostbyaddr{"? (can't getpeername)"}++;
return 1;
}
# can't getsockname
return 1 if $left =~ /^\S+ can\'t getsockname$/o;
# reverse lookup failed
return 1 if $left =~ /^\? reverse lookup for \S+ failed: .* -- using IP address for access$/o;
# profile timer
# ME time X nnnn X(X) [...]
# The exact timers change from various versions of INN, so try to deal
# with this in a general fashion.
if ($left =~ m/^\S+\s+ # ME
time\s(\d+)\s+ # time
((?:\S+\s\d+\(\d+\)\s*)+) # timer values
$/ox) {
$nnrpd_time_times += $1;
my $timers = $2;
while ($timers =~ /(\S+) (\d+)\((\d+)\)\s*/g) {
my $name = $nnrpd_timer_names{$1} || $1;
$nnrpd_time_time{$name} += $2;
if ($3) {
my $average = $2 / $3;
$nnrpd_time_num{$name} += $3;
my $min = $nnrpd_time_min{$name};
$nnrpd_time_min{$name} = $average
if (!defined($min) || $min > $average);
my $max = $nnrpd_time_max{$name};
$nnrpd_time_max{$name} = $average
if (!defined($max) || $max < $average);
}
}
return 1;
}
# ME dropping articles into ...
return 1 if $left =~ /ME dropping articles into /o;
# newnews (interesting but ignored till now)
return 1 if $left =~ /^\S+ newnews /o;
# cant fopen (ignored too)
return 1 if $left =~ /^\S+ cant fopen /o;
# can't read: No route to host
return 1 if $left =~ /can\'t read: No route to host/o;
# can't read: Broken pipe
return 1 if $left =~ /can\'t read: Broken pipe/o;
# eof in post
return 1 if $left =~ /^\S+ EOF in post$/o;
# ioctl: ...
return 1 if $left =~ /^ioctl: /o;
# other stats
return 1 if $left =~ /^\S+ overstats count \d+ hit \d+ miss \d+ time \d+ size \d+ dbz \d+ seek \d+ get \d+ artcheck \d+$/o;
# starttls
return 1 if $left =~ /^starttls: \S+ with cipher \S+ \(\d+\/\d+ bits\) no authentication$/o;
}
########
## overchan
if ($prog eq "overchan") {
# times
if ($left =~ /timings (\d+) arts (\d+) of (\d+) ms$/o) {
my ($articles, $work_time, $run_time) = ($1, $2, $3);
# ??? What to do with numbers
return 1;
}
}
########
## batcher
if ($prog eq "batcher") {
# times
if ($left =~ /(\S+) times user (.+) system (\S+) elapsed (\S+)$/o) {
my ($server, $user, $system, $elapsed) = ($1, $2, $3, $4);
$server = lc $server unless $CASE_SENSITIVE;
# $batcher_user{$server} += $user;
# $batcher_system{$server} += $system;
$batcher_elapsed{$server} += $elapsed;
return 1;
}
# stats
if ($left =~ /(\S+) stats batches (\d+) articles (\d+) bytes (\d+)$/o) {
my ($server, $batches, $articles, $bytes) = ($1, $2, $3, $4);
$server = lc $server unless $CASE_SENSITIVE;
$batcher_offered{$server} += $batches;
$batcher_articles{$server} += $articles;
$batcher_bytes{$server} += $bytes;
return 1;
}
}
########
## rnews
if ($prog eq "rnews") {
# rejected connection
if ($left =~ /rejected connection (.*)$/o) {
$rnews_rejected{$1}++;
return 1;
}
# cant open_remote
if ($left =~ /(cant open_remote .*)$/o) {
$rnews_rejected{$1}++;
return 1;
}
# rejected 437 Unwanted newsgroup
if ($left =~ /rejected (?:437|439) Unwanted newsgroup \"(.*)\"$/o) {
$rnews_bogus_ng{$1}++;
return 1;
}
# rejected 437 Unapproved for "xx"
if ($left =~ /rejected (?:437|439) Unapproved for \"(.*)\"$/o) {
$rnews_unapproved{$1}++;
return 1;
}
# rejected 437 Unwanted distribution
if ($left =~ /rejected (?:437|439) Unwanted distribution (.*)$/o) {
$rnews_bogus_dist{$1}++;
return 1;
}
# rejected 437 Bad "Date"
if ($left =~ /rejected (?:437|439) Bad \"Date\" (.*)$/o) {
$rnews_bogus_date{$1}++;
return 1;
}
# rejected 437 Bad "Injection-Date"
if ($left =~ /rejected (?:437|439) Bad \"Injection-Date\" (.*)$/o) {
$rnews_bogus_date{$1}++;
return 1;
}
# rejected 437 Article injected or posted in the future
if ($left =~ /rejected (?:437|439) Article injected or posted in the future -- \"(.*)\"$/o) {
$rnews_bogus_date{"(future) $1"}++;
return 1;
}
# rejected 437 Too old -- "..."
if ($left =~ /rejected (?:437|439) Too old -- (.*)$/o) {
$rnews_too_old++;
return 1;
}
# rejected 437 Linecount...
if ($left =~ /rejected (?:437|439) Linecount \d+ \!= \d+/o) {
$rnews_linecount++;
return 1;
}
# rejected 437 Duplicate
if ($left =~ /rejected (?:437|439) Duplicate$/o) {
$rnews_duplicate++;
return 1;
}
# rejected 437 Duplicate article
if ($left =~ /rejected (?:437|439) Duplicate article/o) {
$rnews_duplicate++;
return 1;
}
# rejected 437 No colon-space ...
if ($left =~ /rejected (?:437|439) No colon-space in \"(.*)\" header$/o) {
$rnews_no_colon_space++;
return 1;
}
# duplicate <msg-id> path..
if ($left =~ /^duplicate /o) {
$rnews_duplicate++;
return 1;
}
# offered <msg-id> feed
if ($left =~ /^offered \S+ (\S+)/o) {
my $host = $1;
$host = lc $host unless $CASE_SENSITIVE;
# Small hack used to join article spooled when innd is throttle.
# In this situation, the hostname is a 8 hex digits string
# To avoid confusions with real feeds, the first character is forced
# to be a '3' or a '4' (will work between 9/7/1995 and 13/7/2012).
$host = "Local postings" if $host =~ /^[34][0-9a-f]{7}$/;
$rnews_host{$host}++;
return 1;
}
# rejected 437 ECP rejected
return 1 if $left =~ m/rejected (?:437|439) ECP rejected/o;
# rejected 437 "Subject" header too long
return 1 if $left =~ m/header too long/o;
# rejected 437 Too long line in header 1163 bytes
return 1 if $left =~ m/rejected (?:437|439) Too long line in header/o;
# rejected 437 Too many newsgroups (meow)
return 1 if $left =~ m/rejected (?:437|439) Too many newsgroups/o;
# rejected 437 Space before colon in "<a" header
return 1 if $left =~ m/rejected (?:437|439) Space before colon in/o;
# rejected 437 EMP (phl)
return 1 if $left =~ m/rejected (?:437|439) EMP/o;
# rejected 437 Scoring filter (8)
return 1 if $left =~ m/rejected (?:437|439) Scoring filter/o;
# bad_article missing Message-ID
return 1 if $left =~ m/bad_article missing Message-ID/o;
# cant unspool saving to xxx
return 1 if $left =~ m/cant unspool saving to/o;
}
###########
## ncmspool
if ($prog eq "ncmspool") {
# <article> good signature from foo@bar.com
if ($left =~ /good signature from (.*)/o) {
$nocem_goodsigs{$1}++;
$nocem_totalgood++;
$nocem_lastid = $1;
return 1;
}
# <article> bad signature from foo@bar.com
if ($left =~ /bad signature from (.*)/o) {
$nocem_badsigs{$1}++;
$nocem_goodsigs{$1} = 0 unless ($nocem_goodsigs{$1});
$nocem_totalbad++;
$nocem_lastid = $1;
return 1;
}
# <article> contained 123 new 456 total ids
if ($left =~ /contained (\d+) new (\d+) total ids/o) {
$nocem_newids += $1;
$nocem_newids{$nocem_lastid} += $1;
$nocem_totalids += $2;
$nocem_totalids{$nocem_lastid} += $2;
return 1;
}
return 1;
}
########
## nocem
if ($prog eq "nocem") {
if ($left =~ /processed notice .* by (.*) \((\d+) ids,/o) {
$nocem_goodsigs{$1}++;
$nocem_totalgood++;
$nocem_lastid = $1;
$nocem_newids += $2;
$nocem_newids{$nocem_lastid} += $2;
$nocem_totalids += $2;
$nocem_totalids{$nocem_lastid} += $2;
return 1;
}
if ($left =~ /Article <[^>]*>: (.*) \(ID [[:xdigit:]]*\) not in keyring/o) {
$nocem_badsigs{$1}++;
$nocem_goodsigs{$1} = 0 unless ($nocem_goodsigs{$1});
$nocem_totalbad++;
$nocem_lastid = $1;
return 1;
}
if ($left =~ /Article <[^>]*>: bad signature from (.*)/o) {
$nocem_badsigs{$1}++;
$nocem_goodsigs{$1} = 0 unless ($nocem_goodsigs{$1});
$nocem_totalbad++;
$nocem_lastid = $1;
return 1;
}
if ($left =~ /Article <[^>]*>: malformed signature/o) {
$nocem_badsigs{'N/A'}++;
$nocem_goodsigs{'N/A'} = 0 unless ($nocem_goodsigs{'N/A'});
$nocem_totalbad++;
$nocem_lastid = 'N/A';
return 1;
}
return 1;
}
###########
## controlchan
if ($prog eq "controlchan") {
# loaded /x/y/z/foo.pl
return 1 if $left =~ m/^loaded /;
# starting
return 1 if $left =~ m/^starting/;
# skipping rmgroup x@y (pgpverify failed) in <foo@bar>
if ($left =~ m/^skipping \S+ (\S+) \(pgpverify failed\) in /) {
$controlchan_skippgp{$1}++;
$controlchan_who{$1}++;
return 1;
}
if ($left =~ m/^control_(sendme|ihave), [^,]+, (\S+), doit,/o) {
if ($1 eq "sendme") {
$controlchan_sendme_site{$2}++;
} else {
$controlchan_ihave_site{$2}++;
}
return 1;
}
# control_XXgroup, foo.bar [moderated] who who token, [pattern], [pattern], encoding, peer, action, 1
#
# Various other random junk can end up in the moderated field, like y,
# unmoderated, m, etc. depending on what the control message says. It
# can even have multiple words, which we still don't handle.
if ($left =~ m/^control_(\S+), # type of msg
\s(?:\S+)? # newsgroup name
(\s\S+)? # optional
\s(\S+) # e-mail
\s\S+ # e-mail
\s\S+, # storage token
\s(?:\S+)?, # exclusion pattern
\s(?:\S+)?, # drop pattern
\s\S+, # local encoding
\s\S+, # server
\s([^=,]+(?:=\S+)?), # action
\s*(.*) # 1 if message approved and first logged in the file
/x) {
if ($1 eq 'newgroup') {
$controlchan_new{$3}++;
} elsif ($1 eq 'rmgroup') {
$controlchan_rm{$3}++;
} else {
$controlchan_other{$3}++ if $5 >= 0;
}
$controlchan_who{$3}++;
$controlchan_ok{$3} += $5 if $5 > 0;
my $action = $4;
my $email = $3;
$action =~ s/=.*//;
$controlchan_doit{$email}++ if $action eq 'doit';
return 1;
}
# checkgroups processed or not (with no change or not)
return 1 if $left =~ /^checkgroups by \S+/o;
}
###########
## cnfsstat
if ($prog eq "cnfsstat") {
# Class ALT for groups matching "alt.*" article size min/max: 0/1048576
# Buffer T3, len: 1953 Mbytes, used: 483.75 Mbytes (24.8%) 0 cycles
if ($left =~ m|^Class\ (\S+)\ for\ groups\ matching\ \S+
(\ article\ size\ min/max:\ \d+/\d+)?
\ Buffer\ (\S+),
\ len:\ ([\d.]+)\s+Mbytes,
\ used:\ ([\d.]+)\ Mbytes\ \(\s*[\d.]+%\)
\s+(\d+)\ cycles\s*
$|ox) {
my ($class, $buffer, $size, $used, $cycles) = ($1, $3, $4, $5, $6);
my ($h, $m, $s) = $hour =~ m/^(\d+):(\d+):(\d+)$/;
my $time = $h * 3600 + $m * 60 + $s;
$size *= 1024 * 1024;
$used *= 1024 * 1024;
$cnfsstat{$buffer} = $class;
# If the size changed, invalidate all of our running fill rate stats.
if (!exists($cnfsstat_size{$buffer}) || $size != $cnfsstat_size{$buffer}) {
delete $cnfsstat_rate{$buffer};
delete $cnfsstat_samples{$buffer};
delete $cnfsstat_time{$buffer};
$cnfsstat_size{$buffer} = $size;
}
elsif ($cnfsstat_time{$buffer}) {
# We want to gather the rate at which cycbuffs fill. Store a
# running total of bytes/second and a total number of samples.
# Ideally we'd want a weighted average of those samples by the
# length of the sample period, but we'll ignore that and assume
# cnfsstat runs at a roughly consistent interval.
my ($period, $added);
$period = $time - $cnfsstat_time{$buffer};
$period = 86400 - $cnfsstat_time{$buffer} + $time if $period <= 0;
$added = $used - $cnfsstat_used{$buffer};
if ($cycles > $cnfsstat_cycles{$buffer}) {
$added += $size * ($cycles - $cnfsstat_cycles{$buffer});
}
if ($added > 0) {
$cnfsstat_rate{$buffer} += $added / $period;
$cnfsstat_samples{$buffer}++;
}
}
$cnfsstat_used{$buffer} = $used;
$cnfsstat_cycles{$buffer} = $cycles;
$cnfsstat_time{$buffer} = $time;
return 1;
}
}
# Ignore following programs :
return 1 if ($prog eq "uxfxn");
return 1 if ($prog eq "beverage");
return 1 if ($prog eq "newsx");
return 1 if ($prog eq "demmf");
return 1 if ($prog eq "nnnn");
return 1 if ($prog eq "slurp");
return 0;
}
#################################
# Adjust some values..
sub adjust($$) {
my ($first_date, $last_date) = @_;
my $nnrpd_doit = 0;
my $curious;
{
my $serv;
if (%nnrpd_connect) {
my @keys = keys (%nnrpd_connect);
my $c = @keys;
foreach my $serv (@keys) {
if ($nnrpd_no_permission{$serv}) {
my $dom = &host2dom($serv);
$nnrpd_dom_connect{$dom} -= $nnrpd_connect{$serv}
if defined $nnrpd_dom_connect{$dom};
$nnrpd_dom_times{$dom} -= $nnrpd_times{$serv}
if defined $nnrpd_dom_times{$dom};
# The message "bad_auth" can occur more than once per session.
# Subtracting nnrpd_no_permission from nnrpd_connect is
# broken and can yield negative values for nnrpd_connect.
$nnrpd_connect{$serv} -= $nnrpd_no_permission{$serv};
# Perl considers negative values to be true. Previously the
# hash entry was deleted only if the value was exactly 0.
delete $nnrpd_connect{$serv} unless $nnrpd_connect{$serv} > 0;
delete $nnrpd_groups{$serv} unless $nnrpd_groups{$serv};
delete $nnrpd_times{$serv} unless $nnrpd_times{$serv};
delete $nnrpd_usr_times{$serv} unless $nnrpd_usr_times{$serv};
delete $nnrpd_sys_times{$serv} unless $nnrpd_sys_times{$serv};
delete $nnrpd_dom_connect{$dom} unless $nnrpd_dom_connect{$dom} > 0;
delete $nnrpd_dom_groups{$dom} unless $nnrpd_dom_groups{$dom};
delete $nnrpd_dom_times{$dom} unless $nnrpd_dom_times{$dom};
$c--;
}
$nnrpd_doit++
if $nnrpd_groups{$serv} || $nnrpd_post_ok{$serv};
}
undef %nnrpd_connect unless $c;
}
foreach my $serv (keys (%nnrpd_groups)) {
$curious = "ok" unless $nnrpd_groups{$serv} || $nnrpd_post_ok{$serv} ||
$nnrpd_articles{$serv};
}
}
# Fill some hashes
{
my ($key, $hostname, $channel);
# Since the checkpoint counts include entries for all server
# connections, check to see if any checkpoint server entries are not also
# in %innd_connect. Add any missing servers (persistant servers with no
# connected log lines) to %innd_connect so that incoming totals will be
# properly computed.
foreach $server (keys (%innd_accepted)) {
if (! defined($innd_connect{$server})) {
$innd_connect{$server} = 0;
}
}
foreach $key (keys (%innd_connect)) {
$innd_offered{$key} = ($innd_accepted{$key} || 0)
+ ($innd_refused{$key} || 0)
+ ($innd_rejected{$key} || 0);
$innd_offered_size{$key} = ($innd_stored_size{$key} || 0)
+ ($innd_duplicated_size{$key} || 0) + ($innd_rejected_size{$key} || 0);
}
# Sum all incoming traffic for each full server.
foreach $key (keys (%innd_connect)) {
if ($key =~ /^(\S+):\d+$/) {
$innd_seconds_sum{$1} += ($innd_seconds{$key} || 0);
$innd_connect_sum{$1} += ($innd_connect{$key} || 0);
$innd_offered_sum{$1} += ($innd_offered{$key} || 0);
$innd_accepted_sum{$1} += ($innd_accepted{$key} || 0);
$innd_refused_sum{$1} += ($innd_refused{$key} || 0);
$innd_rejected_sum{$1} += ($innd_rejected{$key} || 0);
$innd_stored_size_sum{$1} += ($innd_stored_size{$key} || 0);
$innd_duplicated_size_sum{$1} += ($innd_duplicated_size{$key} || 0);
$innd_offered_size_sum{$1} += ($innd_offered_size{$key} || 0);
$innd_rejected_size_sum{$1} += ($innd_rejected_size{$key} || 0);
}
}
# adjust min/max of innd timer stats.
if (%innd_time_min) {
foreach $key (keys (%innd_time_min)) {
$innd_time_min{$key} = 0 if ($innd_time_min{$key} == $MIN);
$innd_time_max{$key} = 0 if ($innd_time_max{$key} == $MAX);
#$innd_time_min{$key} /= 1000;
#$innd_time_max{$key} /= 1000;
}
}
if (%innfeed_time_min) {
foreach $key (keys (%innfeed_time_min)) {
$innfeed_time_min{$key} = 0 if ($innfeed_time_min{$key} == $MIN);
$innfeed_time_max{$key} = 0 if ($innfeed_time_max{$key} == $MAX);
}
}
if (%nnrpd_time_min) {
foreach $key (keys (%nnrpd_time_min)) {
$nnrpd_time_min{$key} = 0 if ($nnrpd_time_min{$key} == $MIN);
$nnrpd_time_max{$key} = 0 if ($nnrpd_time_max{$key} == $MAX);
}
}
# remove the innd timer stats if not used.
unless ($innd_time_times) {
undef %innd_time_min;
undef %innd_time_max;
undef %innd_time_num;
undef %innd_time_time;
}
# same thing for innfeed timer
unless ($innfeed_time_times) {
undef %innfeed_time_min;
undef %innfeed_time_max;
undef %innfeed_time_num;
undef %innfeed_time_time;
}
# same thing for nnrpd timer
unless ($nnrpd_time_times) {
undef %nnrpd_time_min;
undef %nnrpd_time_max;
undef %nnrpd_time_num;
undef %nnrpd_time_time;
}
}
if (%inn_flow) {
my ($prev_dd, $prev_d, $prev_h) = ("", -1, -1);
my $day;
foreach $day (sort datecmp keys (%inn_flow)) {
my ($r, $h) = $day =~ /^(.*) (\d+)$/;
my $d = index ("JanFebMarAprMayJunJulAugSepOctNovDec",
substr ($r,0,3)) / 3 * 31 + substr ($r, 4, 2);
$prev_h = $h if ($prev_h == -1);
if ($prev_d == -1) {
$prev_d = $d;
$prev_dd = $r;
}
if ($r eq $prev_dd) { # Same day and same month ?
if ($h != $prev_h) {
if ($h == $prev_h + 1) {
$prev_h++;
}
else {
my $j;
for ($j = $prev_h + 1; $j < $h; $j++) {
my $t = sprintf "%02d", $j;
$inn_flow{"$r $t"} = 0;
}
$prev_h = $h;
}
}
}
else {
my $j;
# then end of the first day...
for ($j = ($prev_h == 23) ? 24 : $prev_h + 1; $j < 24; $j++) {
my $t = sprintf "%02d", $j;
$inn_flow{"$prev_dd $t"} = 0;
}
# all the days between (if any)
# well, we can forget them as it is supposed to be a tool
# launched daily.
# the beginning of the last day..
for ($j = 0; $j < $h; $j++) {
my $t = sprintf "%02d", $j;
$inn_flow{"$r $t"} = 0;
}
$prev_dd = $r;
$prev_d = $d;
$prev_h = $h;
}
}
my $first = 1;
my (%hash, %hash_time, %hash_size, $date, $delay);
foreach $day (sort datecmp keys (%inn_flow)) {
my ($r, $h) = $day =~ /^(.*) (\d+)$/o;
if ($first) {
$first = 0;
my ($t) = $first_date =~ m/:(\d\d:\d\d)$/o;
$date = "$day:$t - $h:59:59";
$t =~ m/(\d\d):(\d\d)/o;
$delay = 3600 - $1 * 60 - $2;
}
else {
$date = "$day:00:00 - $h:59:59";
$delay = 3600;
}
$hash{$date} = $inn_flow{$day};
$hash_size{$date} = $inn_flow_size{$day};
$inn_flow_labels{$date} = $h;
$hash_time{$date} = $delay;
}
my ($h, $t) = $last_date =~ m/ (\d+):(\d\d:\d\d)$/o;
my ($h2) = $date =~ m/ (\d+):\d\d:\d\d /o;
my $date2 = $date;
$date2 =~ s/$h2:59:59$/$h:$t/;
$hash{$date2} = $hash{$date};
delete $hash{"$date"};
$hash_size{$date2} = $hash_size{$date};
delete $hash_size{"$date"};
$t =~ m/(\d\d):(\d\d)/o;
$hash_time{$date2} = $hash_time{$date} - ($h2 == $h) * 3600 + $1 * 60 + $2;
delete $hash_time{"$date"};
$inn_flow_labels{$date2} = $h;
%inn_flow = %hash;
%inn_flow_time = %hash_time;
%inn_flow_size = %hash_size;
}
if (%innd_bad_ihave) {
my $key;
my $msg = 'Bad ihave control messages received';
foreach $key (keys %innd_bad_ihave) {
$innd_misc_stat{$msg}{$key} = $innd_bad_ihave{$key};
}
}
if (%innd_bad_msgid) {
my $key;
my $msg = 'Bad Message-ID\'s offered';
foreach $key (keys %innd_bad_msgid) {
$innd_misc_stat{$msg}{$key} = $innd_bad_msgid{$key};
}
}
if (%innd_bad_sendme) {
my $key;
my $msg = 'Ignored sendme control messages received';
foreach $key (keys %innd_bad_sendme) {
$innd_misc_stat{$msg}{$key} = $innd_bad_sendme{$key};
}
}
if (%innd_bad_command) {
my $key;
my $msg = 'Bad command received';
foreach $key (keys %innd_bad_command) {
$innd_misc_stat{$msg}{$key} = $innd_bad_command{$key};
}
}
if (%innd_bad_newsgroup) {
my $key;
my $msg = 'Bad newsgroups received';
foreach $key (keys %innd_bad_newsgroup) {
$innd_misc_stat{$msg}{$key} = $innd_bad_newsgroup{$key};
}
}
if (%innd_posted_future) {
my $key;
my $msg = 'Article posted in the future';
foreach $key (keys %innd_posted_future) {
$innd_misc_stat{$msg}{$key} = $innd_posted_future{$key};
}
}
if (%innd_no_colon_space) {
my $key;
my $msg = 'No colon-space in header';
foreach $key (keys %innd_no_colon_space) {
$innd_misc_stat{$msg}{$key} = $innd_no_colon_space{$key};
}
}
if (%innd_huge) {
my $key;
my $msg = 'Huge articles';
foreach $key (keys %innd_huge) {
$innd_misc_stat{$msg}{$key} = $innd_huge{$key};
}
}
if (%innd_blocked) {
my $key;
my $msg = 'Blocked server feeds';
foreach $key (keys %innd_blocked) {
$innd_misc_stat{$msg}{$key} = $innd_blocked{$key};
}
}
if (%innd_strange_strings) {
my $key;
my $msg = 'Including strange strings';
foreach $key (keys %innd_strange_strings) {
$innd_misc_stat{$msg}{$key} = $innd_strange_strings{$key};
}
}
if (%rnews_bogus_ng) {
my $key;
my $msg = 'Unwanted newsgroups';
foreach $key (keys %rnews_bogus_ng) {
$rnews_misc{$msg}{$key} = $rnews_bogus_ng{$key};
}
}
if (%rnews_bogus_dist) {
my $key;
my $msg = 'Unwanted distributions';
foreach $key (keys %rnews_bogus_dist) {
$rnews_misc{$msg}{$key} = $rnews_bogus_dist{$key};
}
}
if (%rnews_unapproved) {
my $key;
my $msg = 'Articles unapproved';
foreach $key (keys %rnews_unapproved) {
$rnews_misc{$msg}{$key} = $rnews_unapproved{$key};
}
}
if (%rnews_bogus_date) {
my $key;
my $msg = 'Bad Date';
foreach $key (keys %rnews_bogus_date) {
$rnews_misc{$msg}{$key} = $rnews_bogus_date{$key};
}
}
$rnews_misc{'Too old'}{'--'} = $rnews_too_old if $rnews_too_old;
$rnews_misc{'Bad linecount'}{'--'} = $rnews_linecount if $rnews_linecount;
$rnews_misc{'Duplicate articles'}{'--'} = $rnews_duplicate
if $rnews_duplicate;
$rnews_misc{'No colon-space'}{'--'} = $rnews_no_colon_space
if $rnews_no_colon_space;
if (%nnrpd_groups) {
foreach my $key (keys (%nnrpd_connect)) {
unless ($nnrpd_groups{$key} || $nnrpd_post_ok{$key} ||
$nnrpd_post_rej{$key} || $nnrpd_post_error{$key} ||
$nnrpd_articles{$key}) {
$nnrpd_curious{$key} = $nnrpd_connect{$key};
delete $nnrpd_connect{$key};
}
}
}
}
sub report_unwanted_ng($) {
my $file = shift;
open (FILE, "$file") && do {
while (<FILE>) {
my ($c, $n) = $_ =~ m/^\s*(\d+)\s+(.*)$/;
next unless defined $n;
$n =~ s/^newsgroup //o; # for pre 1.8 logs
$inn_uw_ng{$n} += $c;
}
close (FILE);
};
unlink ("${file}.old");
rename ($file, "${file}.old");
open (FILE, "> $file") && do {
my $g;
foreach $g (sort {$inn_uw_ng{$b} <=> $inn_uw_ng{$a}} (keys (%inn_uw_ng))) {
printf FILE "%d %s\n", $inn_uw_ng{$g}, $g;
}
close (FILE);
chmod(0660, "$file");
};
unlink ("${file}.old");
}
###########################################################################
# Compare 2 dates (+hour), used with sort (arguments $a and $b)
sub datecmp() {
# ex: "May 12 06" for May 12, 6:00am
# The 2 dates are near. The range is less than a few days that's why we
# can cheat to determine the order. It is only important if one date
# is in January and the other in December.
my($date1) = substr($a, 4, 2) * 24;
my($date2) = substr($b, 4, 2) * 24;
$date1 += index("JanFebMarAprMayJunJulAugSepOctNovDec",substr($a,0,3)) * 288;
$date2 += index("JanFebMarAprMayJunJulAugSepOctNovDec",substr($b,0,3)) * 288;
if ($date1 - $date2 > 300 * 24) {
$date2 += 288 * 3 * 12;
}
elsif ($date2 - $date1 > 300 * 24) {
$date1 += 288 * 3 * 12;
}
$date1 += substr($a, 7, 2);
$date2 += substr($b, 7, 2);
$date1 - $date2;
}
sub host2dom($) {
my $host = shift;
$host =~ m/^[^\.]+(.*)/;
$host =~ m/^[\d\.]+$/ ? "unresolved" : $1 ? "*$1" : "?";
}
1;
|