⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 innlog.awk

📁 早期freebsd实现
💻 AWK
📖 第 1 页 / 共 3 页
字号:
	    }	    if ($8 == "Unwanted" && $9 == "distribution") {		rnews_bad_dist++;		rnews_bdist[$10]++;		next;	    }	    if ($8 == "Bad" && $9 == "\"Date\"") {		rnews_bad_date++;		next;	    }	}    }    if ($6 == "offered") {	rnews_hosts[$8]++;	rnews_host = 1;	next;    }}####  NNTPLINK##$5 ~ /.*nntplink.*/ {    if ( $6 ~ /:/ ) {	n = split($6, path, ":");	host = path[1];    }    else	host = $6;    if ($7 == "EOF") {	##  There is no startup marked for this.	nntplink_site[host]++;	nntplink_eof[host]++;	next;    }    if ($10 == "Broken" && $11 == "pipe") {	##  There is no startup marked for this.	nntplink_site[host]++;	nntplink_bpipe[host]++;	next;    }    if ($7 == "greeted" && $10 == "400" \     && (($11 == "No" && $12 == "space") \       || ($12 == "NNTP" && $14 == "out" && $16 ~ /space/))) {	##  There is no startup marked for this.	nntplink_site[host]++;	nntplink_nospace[host]++;	next;    }    if ($7 == "greeted" && $10 == "400" && $11 == "loadav") {	##  There is no startup marked for this.	nntplink_site[host]++;	nntplink_hiload[host]++;	next;    }    if ($7 == "greeted" && $10 == "400" && $0 ~ /[Ee][Xx][Pp][Ii][Rr]/) {	##  There is no startup marked for this.	nntplink_site[host]++;	nntplink_expire[host]++;	next;    }    if ($7 == "greeted" && $10 == "400") {	##  Some other failure, or innd throttle for some local reason.	##  There is no startup marked for this.	nntplink_site[host]++;	nntplink_fail[host]++;	next;    }    if ($7 == "socket():") {	##  There is no startup marked for this.	nntplink_site[host]++;	nntplink_sockerr[host]++;	next;    }    if ($7 == "connection" && $8 == "timed" && $9 == "out") {	##  There is no startup marked for this.  Fake reason.	nntplink_bpipe[host]++;	nntplink_site[host]++;	next;    }    if ($7 == "sent" && $8 == "authinfo" && $10 == "exiting") {	##  There is no startup marked for this.	nntplink_site[host]++;	nntplink_auth[host]++;    }    if ($7 == "sent" && $8 == "IHAVE") {	##  An "ihave failure":  site rejected the article after the	##  IHAVE command; most likely it was out of space.  Don't	##  count this as an offered article, so remember it.  Since	##  nntplink keeps trying to send we could get many such	##  failures in a single connection.  For counting purposes	##  we pretend that there were several separate connections.	nntplink_ihfail[host]++;	if ($11 == "436" && $13 == "NNTP" && $15 == "out" && $17 ~ /space/) {	    nntplink_fake_connects[host]++;	    nntplink_nospace[host]++;	    next;	}    }    ## Since stats lines are always followed by xmit lines, we    ## only do the nntplink_site[host]++ and nntplink=1 once    if ($7 == "stats") {	nntplink_offered[host] += $8 - nntplink_ihfail[host];	nntplink_accepted[host] += $10;	nntplink_rejected[host] += $12;	nntplink_failed[host] += $14;	nntplink_ihfail[host] = 0;	if (nntplink_fake_connects[host]) {	    nntplink_site[host] += nntplink_fake_connects[host];	    nntplink_fake_connects[host] = 0;	} else {	    nntplink_site[host]++;	}	nntplink = 1;	next;    }    if ($7 == "xmit") {	nntplink_times_user[host] += $9;	nntplink_times_sys[host] += $11;	nntplink_times_elapsed[host] += $13;	next;    }    if ($7 == "xfer") {	##  We can compute this if we need it, but there isn't	##  space in the output table for it	#nntplink_offer_min[host] += $9;	#nntplink_accept_min[host] += $11;	next;    }    ##  503 is the code for timeouts.    if ($11 == "503" || $12 == "Timeout") {	nntplink_timeout[host]++;	timeout = 1;	next;    }}####  NNTPD##$5 ~ /nntpd.*/ {    if ( $6 ~ /.*:.*/ ) {	n = split($6, path, ":");	host = path[1];    }    else	host = $6;    if ($7 == "connect") {	nntpd_connect[host]++;	nntpd = 1;	next;    }    if ($7 == "times") {	nntpd_seconds[host] += $9 + $11;	nntpd_elapsed[host] += $13;	if (nntpd_connect[host] == 0)	    nntpd_connect[host]++;	nntpd_done[host]++;	next;    }    if ($7 == "ihave_stats") {	nntpd_accepted[host] += $9;	nntpd_refused[host] += $11;	nntpd_rejected[host] += $13;	next;    }    if ($7 == "no" && $8 == "space") {	nntpd_nospace[host]++;	if (nntpd_connect[host] == 0)	    nntpd_connect[host]++;	nntpd_done[host]++;	next;    }    if ($6 == "no" && $7 == "space")	next;    ##  Rest is likely to be reader stuff; skip for now.}####  MTHREADS##$5 ~ /mthreads.*/ {    if ($6 == "Started" && $7 == "mthreads") {	mthreads = 1;	mthreads_started++;	next;    }    if ($6 == "Processed" && $9 == "added" && $12 == "expired") {	mthreads = 1;	mthreads_added += $10;	mthreads_expired += $13;	next;    }    if ($6 == "Turned" && $8 == "groups" && $9 == "on.") {	mthreads = 1;	mthreads_turned_on += $7;	next;    }    if ($6 == "Turned" && $8 == "groups" && $9 == "off.") {	mthreads = 1;	mthreads_turned_off += $7;	next;    }}####  UNKNOWN##{    if (unknowns == 0) {	printf("Unknown entries from news log file:\n");	unknowns = 1;    }    print;}####  SUMMARIZE DATA##  NOTE: the following are collected but not used right now:##	innd_flush##	innd_feed##	innd_pauses##	innd_throttles##	innd_newgroups##	innd_rmgroups##	innd_reloads##	innd_timeout##	innd_change_groups##END {    printf("\n");    if (innd) {	##  INND control statistics.	if (ctlinnd_seen) {	    printf("Control commands to INND\t(%d total)\n\n", ctlinnd_seen);	    i = 0;	    for (m in ctlinnd_type) {		printf("\t%13s %4d", ctlinnd[m], ctlinnd_type[m]);		if (++i == 3) {		    i = 0;		    printf("\n");		}	    }	    if (i != 0)		printf("\n");	    printf("\n");	    if (ctlinnd_new) {		printf("Newsgroups created:\n");		for (m in ctlinnd_newgroups)		    printf("\t%-30.30s by %s\n", m, ctlinnd_newgroups[m]);		printf("\n");	    }	    if (ctlinnd_rmg) {		printf("Newsgroups removed:\n");		for (m in ctlinnd_rmgroups)		    printf("\t%s\n", m);		printf("\n");	    }	}	##  INND exchange statistics.	printf("Articles received by server\n");	printf("System            Connects  Offered   Took Refuse Rejct Accpt   Elapsed\n");	for ( ; ; ) {	    s = invalid;	    for (sortindex in innd_connect)		if (innd_connect[sortindex] >= 0 && sortindex < s)		    s = sortindex;	    if (s == invalid)		break;	    ninnd_connect += innd_connect[s];	    ninnd_accept += innd_accepted[s];	    ninnd_refuse += innd_refused[s];	    ninnd_reject += innd_rejected[s];	    ninnd_ela += innd_seconds[s];	    offered = innd_accepted[s] + innd_refused[s] + innd_rejected[s];	    ninnd_offered += offered;	    if (offered == 0)		offered = 1;	    percent_accpt = (innd_accepted[s] * 100) / offered;	    e_hours      = innd_seconds[s] / 3600;	    e_sec        = innd_seconds[s] % 3600;	    e_min        = e_sec / 60;	    e_sec        %= 60;	    printf("%-20.20s %5d   %6d %6d %6d %5d  %3d%% %3d:%02d:%02d\n", \		s, innd_connect[s], \		innd_accepted[s] + innd_refused[s] + innd_rejected[s], \		innd_accepted[s], innd_refused[s], innd_rejected[s], \		percent_accpt, e_hours, e_min, e_sec);            innd_connect[s] = -1;	}	e_hours      = ninnd_ela / 3600;	e_sec        = ninnd_ela % 3600;	e_min        = e_sec / 60;	e_sec        %= 60;	they_offered = ninnd_offered;	if (they_offered == 0)	    they_offered = 1;	percent_accpt = (ninnd_accept * 100.0)/ (they_offered + 0.1);	printf("\n%-20s %5d   %6d %6d %6d %5d  %3d%% %3d:%02d:%02d\n\n", \	    "TOTALS", ninnd_connect, ninnd_offered, ninnd_accept, \	    ninnd_refuse, ninnd_reject, percent_accpt, e_hours, e_min, \	    e_sec);    }    ##  Miscellaneous innd statistics.    if (innd_bad_msgids) {	printf("Bad Message-ID's offered\n");	for ( ; ; ) {	    s = invalid;	    for (sortindex in innd_bad_msgid)		if (innd_bad_msgid[sortindex] >= 0 && sortindex < s)		    s = sortindex;	    if (s == invalid)		break;	    printf("%-20.20s %5d\n", s, innd_bad_msgid[s]);	    innd_bad_msgid[s] = -1;        }	printf("\n");    }    if (innd_bad_ihaves) {	printf("Bad ihave control messages received\n");	for ( ; ; ) {	    s = invalid;	    for (sortindex in innd_bad_ihave)	        if (innd_bad_ihave[sortindex] >= 0 && sortindex < s)		    s = sortindex;            if (s == invalid)		break;	    printf("%-20.20s %5d\n", s, innd_bad_ihave[s]);	    innd_bad_ihave[s] = -1;        }	printf("\n");    }    if (innd_bad_sendmes) {	printf("Ignored sendme control messages received\n");	for ( ; ; ) {	    s = invalid;	    for (sortindex in innd_bad_sendme)		if (innd_bad_sendme[sortindex] >= 0 && sortindex < s)		    s = sortindex;            if (s == invalid)		break;	    printf("%-20.20s %5d\n", s, innd_bad_sendme[s]);	    innd_bad_sendme[s] = -1;        }	printf("\n");    }    if (innd_blockeds) {	printf("Blocked server feeds\n");	for ( ; ; ) {	    s = invalid;	    for (sortindex in innd_blocked)		if (innd_blocked[sortindex] >= 0 && sortindex < s)		    s = sortindex;            if (s == invalid)		break;	    printf("%-20.20s %5d\n", s, innd_blocked[s]);	    innd_blocked[s] = -1;        }	printf("\n");    }    ##  NNTPD statistics.    if (nntpd) {	printf("Articles received by NNTPD\n");	printf("System            Connects NSpc Fail Offered  Took Refuse Rejct Accpt   Elapsed\n");	for ( ; ; ) {	    s = invalid;	    for (sortindex in nntpd_connect)		if (nntpd_connect[sortindex] >= 0 && sortindex < s)		    s = sortindex;            if (s == invalid)		break;	    nnntpd_connect += nntpd_connect[s];	    nnntpd_nospace += nntpd_nospace[s];	    nnntpd_accept += nntpd_accepted[s];	    nnntpd_refuse += nntpd_refused[s];	    nnntpd_reject += nntpd_rejected[s];	    nnntpd_ela += nntpd_elapsed[s];	    nnntpd_done += nntpd_done[s];	    offered = nntpd_accepted[s] + nntpd_refused[s] + nntpd_rejected[s];	    nnntpd_offered += offered;	    if (offered == 0)		offered = 1;	    percent_accpt = (nntpd_accepted[s] * 100) / offered;	    e_hours      = nntpd_elapsed[s] / 3600;	    e_sec        = nntpd_elapsed[s] % 3600;	    e_min        = e_sec / 60;	    e_sec        %= 60;	    printf("%-20.20s %5d %4d %4d %6d %6d %6d %5d  %3d%% %3d:%02d:%02d\n", \		s, nntpd_connect[s], nntpd_nospace[s], \		nntpd_connect[s] - nntpd_done[s], \		nntpd_accepted[s] + nntpd_refused[s] + nntpd_rejected[s], \		nntpd_accepted[s], nntpd_refused[s], nntpd_rejected[s], \		percent_accpt, e_hours, e_min, e_sec);            nntpd_connect[s] = -1;	}	e_hours      = nnntpd_ela / 3600;	e_sec        = nnntpd_ela % 3600;	e_min        = e_sec / 60;	e_sec        %= 60;	they_offered = nnntpd_offered;	if (they_offered == 0)	    they_offered = 1;	percent_accpt = (nnntpd_accept * 100.0)/ (they_offered + 0.1);	printf("\n%-20s %5d %4d %4d %6d %6d %6d %5d  %3d%% %3d:%02d:%02d\n\n", \	    "TOTALS", nnntpd_connect, nnntpd_nospace, \	    nnntpd_connect - nnntpd_done, \	    nnntpd_offered, nnntpd_accept, nnntpd_refuse, nnntpd_reject, \	    percent_accpt, e_hours, e_min, e_sec);    }    ##  Innxmit statistics.    if (innxmit) {	printf("Articles sent by innxmit\n");	printf("System                Offrd   Took   Toss  Fail  Pct   Elapsed       CPU  Pct\n");	for ( ; ; ) {	    s = invalid;	    for (sortindex in innxmit_site)		if (innxmit_offered[sortindex] >= 0 && sortindex < s)		    s = sortindex;            if (s == invalid)		break;	    we_offered = innxmit_offered[s];	    if (we_offered == 0)		we_offered = 1;	    they_take = (innxmit_accepted[s] * 100.0) / we_offered;	    e_hours = innxmit_times_elapsed[s] / 3600;	    e_sec   = innxmit_times_elapsed[s] % 3600;	    e_min   = e_sec / 60;	    e_sec   %= 60;	    c_hours = (innxmit_times_user[s] + innxmit_times_sys[host]) / 3600;	    c_sec   = (innxmit_times_user[s] + innxmit_times_sys[s]) % 3600;	    c_min   = c_sec / 60;	    c_sec   %= 60;	    elapsed = innxmit_times_elapsed[s];	    if (elapsed == 0)		elapsed = 1;	    pct = ((innxmit_times_user[s] + innxmit_times_sys[s]) * 100.0) / elapsed;	    printf("%-20.20s %6d %6d %6d %5d %3d%% %3d:%02d:%02d %3d:%02d:%02d %3d%%\n", \		s, innxmit_offered[s], innxmit_accepted[s], \		innxmit_rejected[s], innxmit_failed[s], they_take, \		e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);	    ixmt        += innxmit_offered[s];	    ixmt_accept += innxmit_accepted[s];	    ixmt_reject += innxmit_rejected[s];	    ixmt_failed += innxmit_failed[s];	    ixmt_ela    += innxmit_times_elapsed[s];	    ixmt_cpu    += innxmit_times_user[s] + innxmit_times_sys[s];	    innxmit_offered[s] = -1;	}	we_offered = ixmt;	if (we_offered == 0)	    we_offered = 1;	they_take = (ixmt_accept * 100) / we_offered;	e_hours = ixmt_ela / 3600;	e_sec   = ixmt_ela % 3600;	e_min   = e_sec / 60;	e_sec   %= 60;	c_hours = ixmt_cpu / 3600;	c_sec   = ixmt_cpu % 3600;	c_min   = c_sec / 60;	c_sec   %= 60;	if (ixmt_ela == 0)	    ixmt_ela = 1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -