home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / nocol / part24 < prev    next >
Encoding:
Text File  |  1993-11-24  |  75.7 KB  |  2,357 lines

  1. Newsgroups: comp.sources.misc
  2. From: vikas@jvnc.net (Vikas Aggarwal)
  3. Subject: v40i154:  nocol - Network Monitoring System, Part24/26
  4. Message-ID: <1993Nov24.163918.2079@sparky.sterling.com>
  5. X-Md4-Signature: b5cbcf7f47b9998708d9344d71b53b1c
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Wed, 24 Nov 1993 16:39:18 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: vikas@jvnc.net (Vikas Aggarwal)
  12. Posting-number: Volume 40, Issue 154
  13. Archive-name: nocol/part24
  14. Environment: INET, UNIX
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # Contents:  nocol-3.0/src/README
  21. #   nocol-3.0/src/cmu-snmp/include/parse.h
  22. #   nocol-3.0/src/cmu-snmp/include/snmp_auth.c
  23. #   nocol-3.0/src/cmu-snmp/include/snmp_impl.h
  24. #   nocol-3.0/src/cmu-snmp/man/snmpgetnext.1
  25. #   nocol-3.0/src/cmu-snmp/man/variables.5
  26. #   nocol-3.0/src/cmu-snmp/snmplib/parse.h
  27. #   nocol-3.0/src/cmu-snmp/snmplib/snmp_auth.c
  28. #   nocol-3.0/src/cmu-snmp/snmplib/snmp_impl.h
  29. #   nocol-3.0/src/doc/eventselect.8 nocol-3.0/src/doc/genmon.8
  30. #   nocol-3.0/src/doc/pingmon.8 nocol-3.0/src/doc/tpmon.8
  31. #   nocol-3.0/src/include/nsmon.h nocol-3.0/src/include/tpmon.h
  32. #   nocol-3.0/src/netmon/help_page.c nocol-3.0/src/netmon/msg_dpy.c
  33. #   nocol-3.0/src/nsmon/poll_sites.c
  34. #   nocol-3.0/src/perlnocol/armon-confg nocol-3.0/src/perlnocol/rcisco
  35. #   nocol-3.0/src/tpmon/poll_sites.c nocol-3.0/src/tpmon/tptest.1
  36. # Wrapped by kent@sparky on Tue Nov  9 22:22:28 1993
  37. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  38. echo If this archive is complete, you will see the following message:
  39. echo '          "shar: End of archive 24 (of 26)."'
  40. if test -f 'nocol-3.0/src/README' -a "${1}" != "-c" ; then 
  41.   echo shar: Will not clobber existing file \"'nocol-3.0/src/README'\"
  42. else
  43.   echo shar: Extracting \"'nocol-3.0/src/README'\" \(2657 characters\)
  44.   sed "s/^X//" >'nocol-3.0/src/README' <<'END_OF_FILE'
  45. X$Header: /home/aggarwal/lsrc/nocol/src/RCS/README,v 1.3 1993/10/30 04:50:34 aggarwal Exp $
  46. X
  47. XREADME for NOCOL v3.0
  48. X=====================
  49. X
  50. XNOCOL (Network Operation Center On-Line) is a network monitoring
  51. Xpackage that runs on Unix platforms. It can monitor various network
  52. Xvariables such as ICMP reachability, nameservers, SNMP traps,  modem
  53. Xline usage, appletalk & novell routes and services, BGP peers, etc.
  54. X
  55. XThe software consists of a number of monitoring agents that poll various
  56. Xparameters (from any system) and put it into a common format.  All the
  57. Xmonitors have a common display and postprocessing interface (such as logging,
  58. Xnotification, etc.). The design also allows running just one set of
  59. Xmonitoring agents and *any* number of display agents, and all of the displays
  60. Xsee the same consistent set of data. Additionally, each event is assigned a
  61. Xpre-determined severity which is gradually escalated, thus preventing false
  62. Xalarms and a customized priority notification based on the severity. The
  63. Xseverity levels range from Critical thru Info.
  64. X
  65. XThe display uses UNIX 'curses' screen management and can thus run on a large
  66. Xvariety of terminals. The user running the display can select the minimum
  67. Xdisplay priority- only events above this minimum priority level are displayed.
  68. X
  69. XTo date, the various monitoring agents developed are:
  70. X
  71. X    - IP ICMP monitor (using 'ping' or 'multiping')
  72. X    - OSI reachability monitor (using the OSI ping)
  73. X    - SNMP trap monitor
  74. X    - IP data throughput monitor
  75. X    - Nameserver (named) monitor
  76. X    - Monitor for usage of terminal server modem lines in use
  77. X    - Appletalk route monitor (for cisco routers)
  78. X    - Novell service monitor
  79. X    - BGP peer status (if not connected)
  80. X    - TCP port monitor
  81. X    
  82. X
  83. XA PERL interface has been provided (jmwobus@mailbox.syr.edu) for 
  84. Xdeveloping additional monitors in the PERL programming language. It is
  85. Xeasy to add additional monitors for system load, etc.
  86. X
  87. XNew features are:
  88. X----------------
  89. X
  90. X - Large portions of the code cleaned up.
  91. X - Logging facility (similar to syslogd)
  92. X - Perl interface
  93. X - TCP port monitor
  94. X - Perl appletalk, Novell, BGP, modem line monitors.
  95. X
  96. X
  97. X
  98. XHas been tested on Solaris2.2, SunOS4.1.1, Ultrix4.2. 
  99. X
  100. XThe software is available from 'ftp.jvnc.net' (128.121.50.2) under 
  101. X~ftp/pub/jvncnet-packages/nocol/nocol.tar.Z.
  102. X
  103. XPlease send a message to 'nocol-users-request@jvnc.net' to be added to the
  104. X'nocol-users' mailing list for updates and bug fixes. Mail comments to
  105. X'nocol-info@jvnc.net' and bugs to 'nocol-bugs@jvnc.net'.
  106. X
  107. XThe JvNCnet display monitor can be viewed by logging onto 'nocol.jvnc.net' 
  108. Xas user 'nocol'.
  109. X
  110. X
  111. X    Vikas Aggarwal (vikas@jvnc.net)
  112. X    JvNCnet, GES
  113. X    Nov 1, 1993
  114. X    --------------
  115. END_OF_FILE
  116.   if test 2657 -ne `wc -c <'nocol-3.0/src/README'`; then
  117.     echo shar: \"'nocol-3.0/src/README'\" unpacked with wrong size!
  118.   fi
  119.   # end of 'nocol-3.0/src/README'
  120. fi
  121. if test -f 'nocol-3.0/src/cmu-snmp/include/parse.h' -a "${1}" != "-c" ; then 
  122.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/include/parse.h'\"
  123. else
  124.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/include/parse.h'\" \(2568 characters\)
  125.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/include/parse.h' <<'END_OF_FILE'
  126. X/***********************************************************
  127. X    Copyright 1989 by Carnegie Mellon University
  128. X
  129. X                      All Rights Reserved
  130. X
  131. XPermission to use, copy, modify, and distribute this software and its 
  132. Xdocumentation for any purpose and without fee is hereby granted, 
  133. Xprovided that the above copyright notice appear in all copies and that
  134. Xboth that copyright notice and this permission notice appear in 
  135. Xsupporting documentation, and that the name of CMU not be
  136. Xused in advertising or publicity pertaining to distribution of the
  137. Xsoftware without specific, written prior permission.  
  138. X
  139. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  140. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  141. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  142. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  143. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  144. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  145. XSOFTWARE.
  146. X******************************************************************/
  147. X/*
  148. X * parse.h
  149. X */
  150. X
  151. X/*
  152. X * A linked list of tag-value pairs for enumerated integers.
  153. X */
  154. Xstruct enum_list {
  155. X    struct enum_list *next;
  156. X    int    value;
  157. X    char *label;
  158. X};
  159. X
  160. X/*
  161. X * A linked list of nodes.
  162. X */
  163. Xstruct node {
  164. X    struct node *next;
  165. X    char label[32]; /* This node's (unique) textual name */
  166. X    u_long  subid;  /* This node's integer subidentifier */
  167. X    char parent[32];/* The parent's textual name */
  168. X    int type;        /* The type of object this represents */
  169. X    struct enum_list *enums;    /* (optional) list of enumerated integers (otherwise NULL) */
  170. X};
  171. X
  172. X/*
  173. X * A tree in the format of the tree structure of the MIB.
  174. X */
  175. Xstruct tree {
  176. X    struct tree *child_list;    /* list of children of this node */
  177. X    struct tree *next_peer;    /* Next node in list of peers */
  178. X    struct tree *parent;
  179. X    char label[32];        /* This node's textual name */
  180. X    u_long subid;        /* This node's integer subidentifier */
  181. X    int type;            /* This node's object type */
  182. X    struct enum_list *enums;    /* (optional) list of enumerated integers (otherwise NULL) */
  183. X    void (*printer)();     /* Value printing function */
  184. X};
  185. X
  186. X/* non-aggregate types for tree end nodes */
  187. X#define TYPE_OTHER        0
  188. X#define TYPE_OBJID        1
  189. X#define TYPE_OCTETSTR        2
  190. X#define TYPE_INTEGER        3
  191. X#define TYPE_NETADDR        4
  192. X#define    TYPE_IPADDR        5
  193. X#define TYPE_COUNTER        6
  194. X#define TYPE_GAUGE        7
  195. X#define TYPE_TIMETICKS        8
  196. X#define TYPE_OPAQUE        9
  197. X#define TYPE_NULL        10
  198. X
  199. Xstruct tree *read_mib();
  200. X
  201. END_OF_FILE
  202.   if test 2568 -ne `wc -c <'nocol-3.0/src/cmu-snmp/include/parse.h'`; then
  203.     echo shar: \"'nocol-3.0/src/cmu-snmp/include/parse.h'\" unpacked with wrong size!
  204.   fi
  205.   # end of 'nocol-3.0/src/cmu-snmp/include/parse.h'
  206. fi
  207. if test -f 'nocol-3.0/src/cmu-snmp/include/snmp_auth.c' -a "${1}" != "-c" ; then 
  208.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/include/snmp_auth.c'\"
  209. else
  210.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/include/snmp_auth.c'\" \(3037 characters\)
  211.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/include/snmp_auth.c' <<'END_OF_FILE'
  212. X/*
  213. X * snmp_auth.c -
  214. X *   Authentication for SNMP (RFC 1067).  This implements a null
  215. X * authentication layer.
  216. X *
  217. X *
  218. X */
  219. X/***********************************************************
  220. X    Copyright 1988, 1989 by Carnegie Mellon University
  221. X
  222. X                      All Rights Reserved
  223. X
  224. XPermission to use, copy, modify, and distribute this software and its 
  225. Xdocumentation for any purpose and without fee is hereby granted, 
  226. Xprovided that the above copyright notice appear in all copies and that
  227. Xboth that copyright notice and this permission notice appear in 
  228. Xsupporting documentation, and that the name of CMU not be
  229. Xused in advertising or publicity pertaining to distribution of the
  230. Xsoftware without specific, written prior permission.  
  231. X
  232. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  233. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  234. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  235. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  236. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  237. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  238. XSOFTWARE.
  239. X******************************************************************/
  240. X
  241. X#ifdef KINETICS
  242. X#include "gw.h"
  243. X#include "fp4/cmdmacro.h"
  244. X#endif
  245. X
  246. X#if (defined(unix) && !defined(KINETICS))
  247. X#include <sys/types.h>
  248. X#include <netinet/in.h>
  249. X#ifndef NULL
  250. X#define NULL 0
  251. X#endif
  252. X#endif
  253. X
  254. X#include "asn1.h"
  255. X#include "snmp.h"
  256. X#include "snmp_impl.h"
  257. X
  258. Xu_char *
  259. Xsnmp_auth_parse(data, length, sid, slen, version)
  260. X    u_char        *data;
  261. X    int            *length;
  262. X    u_char        *sid;
  263. X    int            *slen;
  264. X    long        *version;
  265. X{
  266. X    u_char    type;
  267. X
  268. X    data = asn_parse_header(data, length, &type);
  269. X    if (data == NULL){
  270. X    ERROR("bad header");
  271. X    return NULL;
  272. X    }
  273. X    if (type != (ASN_SEQUENCE | ASN_CONSTRUCTOR)){
  274. X    ERROR("wrong auth header type");
  275. X    return NULL;
  276. X    }
  277. X    data = asn_parse_int(data, length, &type, version, sizeof(*version));
  278. X    if (data == NULL){
  279. X    ERROR("bad parse of version");
  280. X    return NULL;
  281. X    }
  282. X    data = asn_parse_string(data, length, &type, sid, slen);
  283. X    if (data == NULL){
  284. X    ERROR("bad parse of community");
  285. X    return NULL;
  286. X    }
  287. X    sid[*slen] = '\0';
  288. X    return (u_char *)data;
  289. X}
  290. X
  291. Xu_char *
  292. Xsnmp_auth_build(data, length, sid, slen, version, messagelen)
  293. X    u_char        *data;
  294. X    int            *length;
  295. X    u_char        *sid;
  296. X    int            *slen;
  297. X    long        *version;
  298. X    int            messagelen;
  299. X{
  300. X    data = asn_build_header(data, length, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), messagelen + *slen + 5);
  301. X    if (data == NULL){
  302. X    ERROR("buildheader");
  303. X    return NULL;
  304. X    }
  305. X    data = asn_build_int(data, length,
  306. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
  307. X        (long *)version, sizeof(*version));
  308. X    if (data == NULL){
  309. X    ERROR("buildint");
  310. X    return NULL;
  311. X    }
  312. X    data = asn_build_string(data, length,
  313. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR), 
  314. X        sid, *slen);
  315. X    if (data == NULL){
  316. X    ERROR("buildstring");
  317. X    return NULL;
  318. X    }
  319. X    return (u_char *)data;
  320. X}
  321. END_OF_FILE
  322.   if test 3037 -ne `wc -c <'nocol-3.0/src/cmu-snmp/include/snmp_auth.c'`; then
  323.     echo shar: \"'nocol-3.0/src/cmu-snmp/include/snmp_auth.c'\" unpacked with wrong size!
  324.   fi
  325.   # end of 'nocol-3.0/src/cmu-snmp/include/snmp_auth.c'
  326. fi
  327. if test -f 'nocol-3.0/src/cmu-snmp/include/snmp_impl.h' -a "${1}" != "-c" ; then 
  328.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/include/snmp_impl.h'\"
  329. else
  330.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/include/snmp_impl.h'\" \(2591 characters\)
  331.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/include/snmp_impl.h' <<'END_OF_FILE'
  332. X/*
  333. X * Definitions for SNMP (RFC 1067) implementation.
  334. X *
  335. X *
  336. X */
  337. X/***********************************************************
  338. X    Copyright 1988, 1989 by Carnegie Mellon University
  339. X
  340. X                      All Rights Reserved
  341. X
  342. XPermission to use, copy, modify, and distribute this software and its 
  343. Xdocumentation for any purpose and without fee is hereby granted, 
  344. Xprovided that the above copyright notice appear in all copies and that
  345. Xboth that copyright notice and this permission notice appear in 
  346. Xsupporting documentation, and that the name of CMU not be
  347. Xused in advertising or publicity pertaining to distribution of the
  348. Xsoftware without specific, written prior permission.  
  349. X
  350. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  351. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  352. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  353. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  354. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  355. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  356. XSOFTWARE.
  357. X******************************************************************/
  358. X
  359. X
  360. X#if (defined vax) || (defined (mips))
  361. X/*
  362. X * This is a fairly bogus thing to do, but there seems to be no better way for
  363. X * compilers that don't understand void pointers.
  364. X */
  365. X#define void char
  366. X#endif
  367. X
  368. X/*
  369. X * Error codes:
  370. X */
  371. X/*
  372. X * These must not clash with SNMP error codes (all positive).
  373. X */
  374. X#define PARSE_ERROR    -1
  375. X#define BUILD_ERROR    -2
  376. X
  377. X#define SID_MAX_LEN    64
  378. X#define MAX_NAME_LEN    64  /* number of subid's in a objid */
  379. X
  380. X#ifndef NULL
  381. X#define NULL 0
  382. X#endif
  383. X
  384. X#ifndef TRUE
  385. X#define TRUE    1
  386. X#endif
  387. X#ifndef FALSE
  388. X#define FALSE    0
  389. X#endif
  390. X
  391. X#define READ        1
  392. X#define WRITE        0
  393. X
  394. X#define RONLY    0xAAAA    /* read access for everyone */
  395. X#define RWRITE    0xAABA    /* add write access for community private */
  396. X#define NOACCESS 0x0000    /* no access for anybody */
  397. X
  398. X#define INTEGER        ASN_INTEGER
  399. X#define STRING        ASN_OCTET_STR
  400. X#define OBJID        ASN_OBJECT_ID
  401. X#define NULLOBJ        ASN_NULL
  402. X
  403. X/* defined types (from the SMI, RFC 1065) */
  404. X#define IPADDRESS   (ASN_APPLICATION | 0)
  405. X#define COUNTER        (ASN_APPLICATION | 1)
  406. X#define GAUGE        (ASN_APPLICATION | 2)
  407. X#define TIMETICKS   (ASN_APPLICATION | 3)
  408. X#define OPAQUE        (ASN_APPLICATION | 4)
  409. X
  410. X#ifdef DEBUG
  411. X#define ERROR(string)    printf("%s(%d): %s",__FILE__, __LINE__, string);
  412. X#else
  413. X#define ERROR(string)
  414. X#endif
  415. X
  416. X/* from snmp.c*/
  417. Xextern u_char    sid[];    /* size SID_MAX_LEN */
  418. X
  419. Xu_char    *snmp_parse_var_op();
  420. Xu_char    *snmp_build_var_op();
  421. X
  422. Xu_char    *snmp_auth_parse();
  423. Xu_char    *snmp_auth_build();
  424. END_OF_FILE
  425.   if test 2591 -ne `wc -c <'nocol-3.0/src/cmu-snmp/include/snmp_impl.h'`; then
  426.     echo shar: \"'nocol-3.0/src/cmu-snmp/include/snmp_impl.h'\" unpacked with wrong size!
  427.   fi
  428.   # end of 'nocol-3.0/src/cmu-snmp/include/snmp_impl.h'
  429. fi
  430. if test -f 'nocol-3.0/src/cmu-snmp/man/snmpgetnext.1' -a "${1}" != "-c" ; then 
  431.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/man/snmpgetnext.1'\"
  432. else
  433.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/man/snmpgetnext.1'\" \(2605 characters\)
  434.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/man/snmpgetnext.1' <<'END_OF_FILE'
  435. X.\* /***********************************************************
  436. X.\"     Copyright 1988, 1989 by Carnegie Mellon University
  437. X.\" 
  438. X.\"                       All Rights Reserved
  439. X.\" 
  440. X.\" Permission to use, copy, modify, and distribute this software and its 
  441. X.\" documentation for any purpose and without fee is hereby granted, 
  442. X.\" provided that the above copyright notice appear in all copies and that
  443. X.\" both that copyright notice and this permission notice appear in 
  444. X.\" supporting documentation, and that the name of CMU not be
  445. X.\" used in advertising or publicity pertaining to distribution of the
  446. X.\" software without specific, written prior permission.  
  447. X.\" 
  448. X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  449. X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  450. X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  451. X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  452. X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  453. X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  454. X.\" SOFTWARE.
  455. X.\" ******************************************************************/
  456. X.TH SNMPGETNEXT 1 "17 September 1989"
  457. X.UC 4
  458. X.SH NAME
  459. Xsnmpgetnext - communicates with a network entity using SNMP GET NEXT Requests.
  460. X.SH SYNOPSIS
  461. Xsnmpgetnext host community variable-name [variable-name]...
  462. X.SH DESCRIPTION
  463. XSnmpget is an SNMP application that uses the GET NEXT Request to query for
  464. Xinformation on a network entity.  One or more object
  465. Xidentifiers may be given as arguments on the command line.
  466. XEach variable name is given in the format specified in
  467. X.IR variables (5).
  468. XFor each one, the variable that is lexicographicly "next" in the remote entity's
  469. XMIB will be returned.
  470. X.PP
  471. XThe
  472. X.I host
  473. Xspecification may be either a host name or an internet address
  474. Xspecified in "dot notation"
  475. X.PP
  476. XThe
  477. X.I community
  478. Xspecifies the community name for the transaction with the remote system.
  479. X.PP
  480. XFor example
  481. X.PP
  482. X.I snmpgetnext netdev-kbox.cc.cmu.edu public system.sysdescr system.sysUpTime
  483. X.PP
  484. Xwill retrieve the variables sysDescr.0 and sysUpTime.0:
  485. X.PP
  486. X.I Name: system.sysDescr.0
  487. X.br
  488. X.I OCTET STRING- (ascii):    Kinetics FastPath2
  489. X.PP
  490. X.I Name: system.sysUpTime.0
  491. X.br
  492. X.I Timeticks: (2270351) 6:18:23
  493. X.PP
  494. XIf the network entity has an error processing the request packet, an error
  495. Xmessage will be shown, helping to pinpoint in what way the request was malformed.
  496. X.PP
  497. XAdding a "-d" to the argument list will cause the application to dump input and output packets.
  498. X.PP
  499. X.SH "SEE ALSO"
  500. Xvariables(5), RFC 1065, RFC 1066, RFC 1067
  501. END_OF_FILE
  502.   if test 2605 -ne `wc -c <'nocol-3.0/src/cmu-snmp/man/snmpgetnext.1'`; then
  503.     echo shar: \"'nocol-3.0/src/cmu-snmp/man/snmpgetnext.1'\" unpacked with wrong size!
  504.   fi
  505.   # end of 'nocol-3.0/src/cmu-snmp/man/snmpgetnext.1'
  506. fi
  507. if test -f 'nocol-3.0/src/cmu-snmp/man/variables.5' -a "${1}" != "-c" ; then 
  508.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/man/variables.5'\"
  509. else
  510.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/man/variables.5'\" \(2850 characters\)
  511.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/man/variables.5' <<'END_OF_FILE'
  512. X.\* /***********************************************************
  513. X.\"     Copyright 1988, 1989 by Carnegie Mellon University
  514. X.\" 
  515. X.\"                       All Rights Reserved
  516. X.\" 
  517. X.\" Permission to use, copy, modify, and distribute this software and its 
  518. X.\" documentation for any purpose and without fee is hereby granted, 
  519. X.\" provided that the above copyright notice appear in all copies and that
  520. X.\" both that copyright notice and this permission notice appear in 
  521. X.\" supporting documentation, and that the name of CMU not be
  522. X.\" used in advertising or publicity pertaining to distribution of the
  523. X.\" software without specific, written prior permission.  
  524. X.\" 
  525. X.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  526. X.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  527. X.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  528. X.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  529. X.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  530. X.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  531. X.\" SOFTWARE.
  532. X.\" ******************************************************************/
  533. X.TH VARIABLES 5 "17 September 1989"
  534. X.UC 4
  535. X.SH NAME
  536. X    variables - Format of specifying variable names to SNMP tools.
  537. X.SH SYNOPSIS
  538. X    system.sysdescr.0
  539. X.SH DESCRIPTION
  540. XVariable names are in the format of Object Identifiers (ASN.1).  There are
  541. Xseveral methods of representation. Each variable name is given in the format of A.B.C.D...,
  542. Xwhere A, B, C, and D are subidentifiers in one of two forms of notation.
  543. XEach subidentifier may be encoded as a decimal integer, or a symbol as found in
  544. Xthe RFC1066 MIB.  The case of the symbols is not significant.
  545. X.br
  546. XIf there is no leading "." in the variable name, the name will be formed
  547. Xas if having been preceded with "iso.org.dod.internet.mgmt.mib.".  A "." must
  548. Xbe placed before the first variable if the user is to fully specify the name.
  549. XFor example:
  550. X.PP
  551. X.I 1.1.0  system.sysDescr.0 and 1.sysDescr.0
  552. X.PP
  553. Xall refer to the same variable name.  Likewise:
  554. X.PP
  555. X.I .1.3.6.1.2.1.1.1.0 .iso.org.dod.internet.mgmt.mib.system.sysdescr.0 .1.3.6.1.2.1.1.sysdescr.0
  556. X.PP
  557. XAll refer to the same variable name.
  558. X.PP
  559. XThe description of the variables in the MIB is given in a file named
  560. X.I "mib.txt"
  561. Xin the current directory or in a file named in the environment variable
  562. X.I "MIBFILE" or in
  563. X.I "/etc/mib.txt".
  564. XThese files are searched in the above order.  The files are in the ASN.1 notation and use the
  565. XOBJECT TYPE macro defined in RFC 1065.  Most of the file describing the RFC 1066 MIB is pulled
  566. Xout of RFC 1066 without change.
  567. X.SH "SEE ALSO"
  568. XRFC 1065, RFC 1066, RFC 1067, ISO IS 8824(ASN.1)
  569. X.SH BUGS
  570. XThe parser of the
  571. X.I "mib.txt"
  572. Xfile is not expected to handle bizarre (although correct) interpretations of the ASN.1 notation.
  573. X
  574. X
  575. END_OF_FILE
  576.   if test 2850 -ne `wc -c <'nocol-3.0/src/cmu-snmp/man/variables.5'`; then
  577.     echo shar: \"'nocol-3.0/src/cmu-snmp/man/variables.5'\" unpacked with wrong size!
  578.   fi
  579.   # end of 'nocol-3.0/src/cmu-snmp/man/variables.5'
  580. fi
  581. if test -f 'nocol-3.0/src/cmu-snmp/snmplib/parse.h' -a "${1}" != "-c" ; then 
  582.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/snmplib/parse.h'\"
  583. else
  584.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/snmplib/parse.h'\" \(2568 characters\)
  585.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/snmplib/parse.h' <<'END_OF_FILE'
  586. X/***********************************************************
  587. X    Copyright 1989 by Carnegie Mellon University
  588. X
  589. X                      All Rights Reserved
  590. X
  591. XPermission to use, copy, modify, and distribute this software and its 
  592. Xdocumentation for any purpose and without fee is hereby granted, 
  593. Xprovided that the above copyright notice appear in all copies and that
  594. Xboth that copyright notice and this permission notice appear in 
  595. Xsupporting documentation, and that the name of CMU not be
  596. Xused in advertising or publicity pertaining to distribution of the
  597. Xsoftware without specific, written prior permission.  
  598. X
  599. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  600. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  601. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  602. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  603. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  604. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  605. XSOFTWARE.
  606. X******************************************************************/
  607. X/*
  608. X * parse.h
  609. X */
  610. X
  611. X/*
  612. X * A linked list of tag-value pairs for enumerated integers.
  613. X */
  614. Xstruct enum_list {
  615. X    struct enum_list *next;
  616. X    int    value;
  617. X    char *label;
  618. X};
  619. X
  620. X/*
  621. X * A linked list of nodes.
  622. X */
  623. Xstruct node {
  624. X    struct node *next;
  625. X    char label[32]; /* This node's (unique) textual name */
  626. X    u_long  subid;  /* This node's integer subidentifier */
  627. X    char parent[32];/* The parent's textual name */
  628. X    int type;        /* The type of object this represents */
  629. X    struct enum_list *enums;    /* (optional) list of enumerated integers (otherwise NULL) */
  630. X};
  631. X
  632. X/*
  633. X * A tree in the format of the tree structure of the MIB.
  634. X */
  635. Xstruct tree {
  636. X    struct tree *child_list;    /* list of children of this node */
  637. X    struct tree *next_peer;    /* Next node in list of peers */
  638. X    struct tree *parent;
  639. X    char label[32];        /* This node's textual name */
  640. X    u_long subid;        /* This node's integer subidentifier */
  641. X    int type;            /* This node's object type */
  642. X    struct enum_list *enums;    /* (optional) list of enumerated integers (otherwise NULL) */
  643. X    void (*printer)();     /* Value printing function */
  644. X};
  645. X
  646. X/* non-aggregate types for tree end nodes */
  647. X#define TYPE_OTHER        0
  648. X#define TYPE_OBJID        1
  649. X#define TYPE_OCTETSTR        2
  650. X#define TYPE_INTEGER        3
  651. X#define TYPE_NETADDR        4
  652. X#define    TYPE_IPADDR        5
  653. X#define TYPE_COUNTER        6
  654. X#define TYPE_GAUGE        7
  655. X#define TYPE_TIMETICKS        8
  656. X#define TYPE_OPAQUE        9
  657. X#define TYPE_NULL        10
  658. X
  659. Xstruct tree *read_mib();
  660. X
  661. END_OF_FILE
  662.   if test 2568 -ne `wc -c <'nocol-3.0/src/cmu-snmp/snmplib/parse.h'`; then
  663.     echo shar: \"'nocol-3.0/src/cmu-snmp/snmplib/parse.h'\" unpacked with wrong size!
  664.   fi
  665.   # end of 'nocol-3.0/src/cmu-snmp/snmplib/parse.h'
  666. fi
  667. if test -f 'nocol-3.0/src/cmu-snmp/snmplib/snmp_auth.c' -a "${1}" != "-c" ; then 
  668.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_auth.c'\"
  669. else
  670.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_auth.c'\" \(3037 characters\)
  671.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/snmplib/snmp_auth.c' <<'END_OF_FILE'
  672. X/*
  673. X * snmp_auth.c -
  674. X *   Authentication for SNMP (RFC 1067).  This implements a null
  675. X * authentication layer.
  676. X *
  677. X *
  678. X */
  679. X/***********************************************************
  680. X    Copyright 1988, 1989 by Carnegie Mellon University
  681. X
  682. X                      All Rights Reserved
  683. X
  684. XPermission to use, copy, modify, and distribute this software and its 
  685. Xdocumentation for any purpose and without fee is hereby granted, 
  686. Xprovided that the above copyright notice appear in all copies and that
  687. Xboth that copyright notice and this permission notice appear in 
  688. Xsupporting documentation, and that the name of CMU not be
  689. Xused in advertising or publicity pertaining to distribution of the
  690. Xsoftware without specific, written prior permission.  
  691. X
  692. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  693. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  694. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  695. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  696. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  697. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  698. XSOFTWARE.
  699. X******************************************************************/
  700. X
  701. X#ifdef KINETICS
  702. X#include "gw.h"
  703. X#include "fp4/cmdmacro.h"
  704. X#endif
  705. X
  706. X#if (defined(unix) && !defined(KINETICS))
  707. X#include <sys/types.h>
  708. X#include <netinet/in.h>
  709. X#ifndef NULL
  710. X#define NULL 0
  711. X#endif
  712. X#endif
  713. X
  714. X#include "asn1.h"
  715. X#include "snmp.h"
  716. X#include "snmp_impl.h"
  717. X
  718. Xu_char *
  719. Xsnmp_auth_parse(data, length, sid, slen, version)
  720. X    u_char        *data;
  721. X    int            *length;
  722. X    u_char        *sid;
  723. X    int            *slen;
  724. X    long        *version;
  725. X{
  726. X    u_char    type;
  727. X
  728. X    data = asn_parse_header(data, length, &type);
  729. X    if (data == NULL){
  730. X    ERROR("bad header");
  731. X    return NULL;
  732. X    }
  733. X    if (type != (ASN_SEQUENCE | ASN_CONSTRUCTOR)){
  734. X    ERROR("wrong auth header type");
  735. X    return NULL;
  736. X    }
  737. X    data = asn_parse_int(data, length, &type, version, sizeof(*version));
  738. X    if (data == NULL){
  739. X    ERROR("bad parse of version");
  740. X    return NULL;
  741. X    }
  742. X    data = asn_parse_string(data, length, &type, sid, slen);
  743. X    if (data == NULL){
  744. X    ERROR("bad parse of community");
  745. X    return NULL;
  746. X    }
  747. X    sid[*slen] = '\0';
  748. X    return (u_char *)data;
  749. X}
  750. X
  751. Xu_char *
  752. Xsnmp_auth_build(data, length, sid, slen, version, messagelen)
  753. X    u_char        *data;
  754. X    int            *length;
  755. X    u_char        *sid;
  756. X    int            *slen;
  757. X    long        *version;
  758. X    int            messagelen;
  759. X{
  760. X    data = asn_build_header(data, length, (u_char)(ASN_SEQUENCE | ASN_CONSTRUCTOR), messagelen + *slen + 5);
  761. X    if (data == NULL){
  762. X    ERROR("buildheader");
  763. X    return NULL;
  764. X    }
  765. X    data = asn_build_int(data, length,
  766. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
  767. X        (long *)version, sizeof(*version));
  768. X    if (data == NULL){
  769. X    ERROR("buildint");
  770. X    return NULL;
  771. X    }
  772. X    data = asn_build_string(data, length,
  773. X        (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR), 
  774. X        sid, *slen);
  775. X    if (data == NULL){
  776. X    ERROR("buildstring");
  777. X    return NULL;
  778. X    }
  779. X    return (u_char *)data;
  780. X}
  781. END_OF_FILE
  782.   if test 3037 -ne `wc -c <'nocol-3.0/src/cmu-snmp/snmplib/snmp_auth.c'`; then
  783.     echo shar: \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_auth.c'\" unpacked with wrong size!
  784.   fi
  785.   # end of 'nocol-3.0/src/cmu-snmp/snmplib/snmp_auth.c'
  786. fi
  787. if test -f 'nocol-3.0/src/cmu-snmp/snmplib/snmp_impl.h' -a "${1}" != "-c" ; then 
  788.   echo shar: Will not clobber existing file \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_impl.h'\"
  789. else
  790.   echo shar: Extracting \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_impl.h'\" \(2591 characters\)
  791.   sed "s/^X//" >'nocol-3.0/src/cmu-snmp/snmplib/snmp_impl.h' <<'END_OF_FILE'
  792. X/*
  793. X * Definitions for SNMP (RFC 1067) implementation.
  794. X *
  795. X *
  796. X */
  797. X/***********************************************************
  798. X    Copyright 1988, 1989 by Carnegie Mellon University
  799. X
  800. X                      All Rights Reserved
  801. X
  802. XPermission to use, copy, modify, and distribute this software and its 
  803. Xdocumentation for any purpose and without fee is hereby granted, 
  804. Xprovided that the above copyright notice appear in all copies and that
  805. Xboth that copyright notice and this permission notice appear in 
  806. Xsupporting documentation, and that the name of CMU not be
  807. Xused in advertising or publicity pertaining to distribution of the
  808. Xsoftware without specific, written prior permission.  
  809. X
  810. XCMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  811. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  812. XCMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  813. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  814. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  815. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  816. XSOFTWARE.
  817. X******************************************************************/
  818. X
  819. X
  820. X#if (defined vax) || (defined (mips))
  821. X/*
  822. X * This is a fairly bogus thing to do, but there seems to be no better way for
  823. X * compilers that don't understand void pointers.
  824. X */
  825. X#define void char
  826. X#endif
  827. X
  828. X/*
  829. X * Error codes:
  830. X */
  831. X/*
  832. X * These must not clash with SNMP error codes (all positive).
  833. X */
  834. X#define PARSE_ERROR    -1
  835. X#define BUILD_ERROR    -2
  836. X
  837. X#define SID_MAX_LEN    64
  838. X#define MAX_NAME_LEN    64  /* number of subid's in a objid */
  839. X
  840. X#ifndef NULL
  841. X#define NULL 0
  842. X#endif
  843. X
  844. X#ifndef TRUE
  845. X#define TRUE    1
  846. X#endif
  847. X#ifndef FALSE
  848. X#define FALSE    0
  849. X#endif
  850. X
  851. X#define READ        1
  852. X#define WRITE        0
  853. X
  854. X#define RONLY    0xAAAA    /* read access for everyone */
  855. X#define RWRITE    0xAABA    /* add write access for community private */
  856. X#define NOACCESS 0x0000    /* no access for anybody */
  857. X
  858. X#define INTEGER        ASN_INTEGER
  859. X#define STRING        ASN_OCTET_STR
  860. X#define OBJID        ASN_OBJECT_ID
  861. X#define NULLOBJ        ASN_NULL
  862. X
  863. X/* defined types (from the SMI, RFC 1065) */
  864. X#define IPADDRESS   (ASN_APPLICATION | 0)
  865. X#define COUNTER        (ASN_APPLICATION | 1)
  866. X#define GAUGE        (ASN_APPLICATION | 2)
  867. X#define TIMETICKS   (ASN_APPLICATION | 3)
  868. X#define OPAQUE        (ASN_APPLICATION | 4)
  869. X
  870. X#ifdef DEBUG
  871. X#define ERROR(string)    printf("%s(%d): %s",__FILE__, __LINE__, string);
  872. X#else
  873. X#define ERROR(string)
  874. X#endif
  875. X
  876. X/* from snmp.c*/
  877. Xextern u_char    sid[];    /* size SID_MAX_LEN */
  878. X
  879. Xu_char    *snmp_parse_var_op();
  880. Xu_char    *snmp_build_var_op();
  881. X
  882. Xu_char    *snmp_auth_parse();
  883. Xu_char    *snmp_auth_build();
  884. END_OF_FILE
  885.   if test 2591 -ne `wc -c <'nocol-3.0/src/cmu-snmp/snmplib/snmp_impl.h'`; then
  886.     echo shar: \"'nocol-3.0/src/cmu-snmp/snmplib/snmp_impl.h'\" unpacked with wrong size!
  887.   fi
  888.   # end of 'nocol-3.0/src/cmu-snmp/snmplib/snmp_impl.h'
  889. fi
  890. if test -f 'nocol-3.0/src/doc/eventselect.8' -a "${1}" != "-c" ; then 
  891.   echo shar: Will not clobber existing file \"'nocol-3.0/src/doc/eventselect.8'\"
  892. else
  893.   echo shar: Extracting \"'nocol-3.0/src/doc/eventselect.8'\" \(3237 characters\)
  894.   sed "s/^X//" >'nocol-3.0/src/doc/eventselect.8' <<'END_OF_FILE'
  895. X.\"$Header: /home/aggarwal/lsrc/nocol/src/doc/RCS/eventselect.8,v 1.2 1993/10/28 16:38:03 aggarwal Exp $
  896. X.\"
  897. X.TH EVENTSELECT 8 "October 1, 1993"
  898. X.SH NAME
  899. Xeventselect \- NOCOL event selector.
  900. X.SH SYNOPSIS
  901. X.B eventselect
  902. X[
  903. X.B \-d
  904. X] [
  905. X.B \-l
  906. X] [
  907. X.B \-s
  908. X.I <sender>
  909. X] [
  910. X.B \-S
  911. X.I <site name>
  912. X] [
  913. X.B \-v
  914. X.I <severity as Critical|Error|Warning|Info>
  915. X] [
  916. X.B \-f
  917. X.I <fromtime>
  918. X] [
  919. X.B \-t
  920. X.I <to time>
  921. X] [
  922. X.I nocol-data-files ...
  923. X]
  924. X.\"
  925. X.SH DESCRIPTION
  926. X.LP
  927. X.B eventselect
  928. Xparses all NOCOL format data files and outputs only those events that
  929. Xmatch the criterion specified on the command line. The output of
  930. X.B eventselect
  931. Xis text strings in the nocol LOG format.
  932. X
  933. XThe program is useful for running periodically from the
  934. X.I crontab
  935. Xand list all sites that are in a particular severity for more than a
  936. Xcertain amount of time (like escalate the problem internally and
  937. Xsend email to someone else within a group).
  938. X
  939. XEvents can be selected based on the site-name, the monitor (sender)
  940. Xname, the severity and the time stamp of the event. Multiple site and
  941. Xsender names can be specified. The time can also be specified as 
  942. Xincremental values (seconds from the current time).
  943. X
  944. XThe matching events are printed out on the standard output as text
  945. Xlines in the nocol log (
  946. X.IR noclogd (8)
  947. X) format. Optionally, the events can be sent to the logging daemon (in
  948. Xcase the 
  949. X.I noclogd
  950. Xdaemon starts up later and we need to log the existing state of the
  951. Xevents to the logging daemon).
  952. X
  953. X.SH OPTIONS
  954. X.TP 3
  955. X.B \-d
  956. Xprints debugging output.
  957. X.TP 3
  958. X.B \-l
  959. Xlog matching events to the \fI noclogd\fR daemon. Useful to log existing
  960. Xevents in case the logging daemon starts up after the various monitors.
  961. X.TP 3
  962. X.B \-s
  963. X.I <sender name>
  964. XThis is the name of the NOCOL monitoring program (EVENT.sender). Multiple
  965. Xsender names can be specified using multiple '\-s'  options. A sub-string
  966. Xwill also be matched.
  967. X.TP 3
  968. X.B \-S
  969. X.I <site name>
  970. XThis is the name of the site (EVENT.site.name). Multiple site-names can
  971. Xbe specified by repeating the '\-S' options.
  972. X.TP 3
  973. X.B \-v
  974. X.I <minimum severity>
  975. XMinimum severity of the event (critical or error or warning or info). Only
  976. Xthe first letter need to be specified.
  977. X.TP 3
  978. X.B \-f
  979. X.I <from time>
  980. XThe minimum timestamp of the events. It is specified in the Unix 'date'
  981. Xformat (Oct 1, 1993 23:15). It can also be specified as an incremental
  982. Xvalue (number of seconds from the current time) by prefixing the number
  983. Xof seconds with a '+' sign (+3600 means in the past 1 hour=3600secs).
  984. XDefault (if no value is specified) time is zero (beginning of eternity).
  985. X.TP 3
  986. X.B \-t
  987. X.I <to time>
  988. XThis is the maximum timestamp of the events. It has the same format as
  989. Xthe 
  990. X.I from-time
  991. Xdescribed above.
  992. X.sp
  993. X.I e.g.
  994. X.RS
  995. X  eventselect 
  996. X\-s pingmon  \-s tpmon  \-S bellcore \-S rutgers \-v E 
  997. X\-f 'Oct 25 05:00'  -t +3600
  998. X.RE
  999. X.TP 3
  1000. X.I nocol-data-files
  1001. XThis is a list of NOCOL format datafiles that are to be processed. If
  1002. Xno file is specified, the program reads from the standard input (
  1003. X.I stdin
  1004. X).
  1005. X.\"------------------------------------
  1006. X.SH AUTHOR
  1007. XVikas Aggarwal, JvNCnet (vikas@jvnc.net).
  1008. X.SH SEE ALSO
  1009. Xnocol(1) nocol-prog(3) perlnocol(3)
  1010. Xeventselect(8) genmon(8) noclogd(8) nocol-overview(8)
  1011. Xnocol-utility(8) nsmon(8) pingmon(8) portmon(8) 
  1012. Xtpmon(8) trapmon(8)
  1013. X
  1014. END_OF_FILE
  1015.   if test 3237 -ne `wc -c <'nocol-3.0/src/doc/eventselect.8'`; then
  1016.     echo shar: \"'nocol-3.0/src/doc/eventselect.8'\" unpacked with wrong size!
  1017.   fi
  1018.   # end of 'nocol-3.0/src/doc/eventselect.8'
  1019. fi
  1020. if test -f 'nocol-3.0/src/doc/genmon.8' -a "${1}" != "-c" ; then 
  1021.   echo shar: Will not clobber existing file \"'nocol-3.0/src/doc/genmon.8'\"
  1022. else
  1023.   echo shar: Extracting \"'nocol-3.0/src/doc/genmon.8'\" \(2775 characters\)
  1024.   sed "s/^X//" >'nocol-3.0/src/doc/genmon.8' <<'END_OF_FILE'
  1025. X.\" $Header: /home/aggarwal/lsrc/nocol/src/doc/RCS/genmon.8,v 1.2 1993/10/28 16:38:03 aggarwal Exp $
  1026. X.\"
  1027. X.TH GENMON 8 "Oct 1 1993"
  1028. X.SH NAME
  1029. Xgenmon \- Generic NOCOL monitoring interface
  1030. X.SH SYNOPSIS
  1031. X.B genmon
  1032. X[
  1033. X.B \-d
  1034. X] [
  1035. X.B \-e
  1036. X.I prog-to-execute
  1037. X] [
  1038. X.B \-a
  1039. X.I 'args to program'
  1040. X]
  1041. X.LP
  1042. XThe
  1043. X.I genmon
  1044. Xprogram parses nocol LOG format
  1045. X.I text 
  1046. Xstrings and creates the NOCOL format datafiles which can then be parsed 
  1047. Xby the various NOCOL post-processors.
  1048. X.SH OPTIONS
  1049. X.TP
  1050. X.B \-d
  1051. XFor debug mode. Will not daemonize and writes errrors to terminal.
  1052. X.TP
  1053. X.B \-e
  1054. X.I <program to execute>
  1055. XFull path to the program that is run
  1056. X.TP
  1057. X.B \-a
  1058. X.I <arguments>
  1059. XThis is a list of arguments for the program to be executed. Enclose
  1060. Xmultiple arguments within single quotes.
  1061. X
  1062. X.SH DESCRIPTION
  1063. X.LP
  1064. XThe
  1065. X.B genmon
  1066. Xprocess provides a simple interface for developing additional monitors
  1067. Xfor NOCOL. It reads in EVENT text lines (of the format generated by
  1068. X.IR noclogd (8)
  1069. X), and creates NOCOL data structures. Additionally, it recognizes the
  1070. X.I LOG
  1071. Xkeyword for logging the event to the noclogd daemon and the
  1072. X.I APPEND
  1073. Xkeyword for seeking to the end of the existing output datafile before
  1074. Xwriting additional nocol events.
  1075. X.LP
  1076. XThe typical format of the NOCOL text lines (of the
  1077. X.I noclogd
  1078. Xformat) are:
  1079. X.RS
  1080. X.I date
  1081. X[
  1082. X.I sender
  1083. X]: SITE
  1084. X.I sitename address
  1085. XVAR
  1086. X.I varname value threshold units
  1087. XLEVEL
  1088. X.I severity
  1089. XLOGLEVEL
  1090. X.I log severity
  1091. XNOCOP
  1092. X.I up down unknown test
  1093. X.RE
  1094. X
  1095. XThus, any monitoring front-end process (could be a shell script) can
  1096. Xoutput text lines in the above format and create a NOCOL format datafile.
  1097. XThere are two ways to use this program:
  1098. X.RS
  1099. X    mymonitor | genmon  > DATADIR/mymonitor-output
  1100. X.RE
  1101. XIn this mode, the 'APPEND' keyword is ignored since the output is written
  1102. Xto the stdout.
  1103. XAlternatively, you can use:
  1104. X.RS
  1105. X    genmon  \-e mymonitor \-a 'mymonitors various flags'
  1106. X.RE
  1107. XIn this mode, genmon forks and opens a datafile in the nocol data directory.
  1108. XIt then invokes the program specified on the command line and reads text
  1109. Xlines from the stdout of the process being called. If it scans an
  1110. XAPPEND keyword, it seeks to the end of the datafile before writing (it only
  1111. Xneeds this once in each pass). It then sleeps for SLEEPTIME (15 secs)
  1112. Xand then calls the monitoring program again. Keep in mind that since
  1113. Xthe monitoring process is re-invoked each time, it has no way of
  1114. Xremembering the state of the events it monitored in the previous passes.
  1115. XThus, the 'APPEND' keyword should be used with caution (as you don't want
  1116. Xto go on appending to the datafile each time).
  1117. X
  1118. X.SH AUTHOR
  1119. XVikas Aggarwal, JvNCnet (vikas@jvnc.net) 
  1120. X.SH SEE ALSO
  1121. Xnocol(1) nocol-prog(3) perlnocol(3)
  1122. Xeventselect(8) genmon(8) noclogd(8) nocol-overview(8)
  1123. Xnocol-utility(8) nsmon(8) pingmon(8) portmon(8) 
  1124. Xtpmon(8) trapmon(8)
  1125. X
  1126. END_OF_FILE
  1127.   if test 2775 -ne `wc -c <'nocol-3.0/src/doc/genmon.8'`; then
  1128.     echo shar: \"'nocol-3.0/src/doc/genmon.8'\" unpacked with wrong size!
  1129.   fi
  1130.   # end of 'nocol-3.0/src/doc/genmon.8'
  1131. fi
  1132. if test -f 'nocol-3.0/src/doc/pingmon.8' -a "${1}" != "-c" ; then 
  1133.   echo shar: Will not clobber existing file \"'nocol-3.0/src/doc/pingmon.8'\"
  1134. else
  1135.   echo shar: Extracting \"'nocol-3.0/src/doc/pingmon.8'\" \(3322 characters\)
  1136.   sed "s/^X//" >'nocol-3.0/src/doc/pingmon.8' <<'END_OF_FILE'
  1137. X.\"$Header: /home/aggarwal/lsrc/nocol/src/doc/RCS/pingmon.8,v 1.3 1993/10/28 16:38:03 aggarwal Exp $
  1138. X.\"
  1139. X.TH PINGMON 8 "October 1, 1993"
  1140. X.SH NAME
  1141. Xpingmon \- NOCOL ICMP reachability monitor  (
  1142. X.IR ip pingmon
  1143. X& 
  1144. X.IR osi pingmon)
  1145. X.SH SYNOPSIS
  1146. X.B ippingmon
  1147. X[
  1148. X.B \-d
  1149. X] [
  1150. X.B \-o
  1151. X.I <output-data-file>
  1152. X] [
  1153. X.B \-p
  1154. X.I <ping command>
  1155. X] [
  1156. X.I config-file
  1157. X]
  1158. X.\"
  1159. X.SH DESCRIPTION
  1160. X.LP
  1161. X.B ippingmon
  1162. X(and
  1163. X.BR osipingmon )
  1164. Xare NOCOL monitors for testing reachability of IP (OSI) hosts via the
  1165. XICMP 
  1166. X.I ping
  1167. Xprogram. The monitor uses the standard Unix 
  1168. X.I ping
  1169. Xprogram to send 10 ICMP packets to the list of hosts psecified in the 
  1170. Xconfiguration file and if the number of lost packets exceeds a certain
  1171. Xthreshold (set to 3 packets by default), the site is marked as DOWN and
  1172. Xthe NOCOL severity of the site is escalated. In each pass, if the site
  1173. Xis still unreachable, the severity is escalated (till it reaches
  1174. XCRITICAL). Thus, when a site is marked as CRITICAL, it has been ping-ed
  1175. Xand marked unreachable atleast 3 times (thus avoiding false alarms).
  1176. X
  1177. XThe program does a 
  1178. X.IR popen (3)
  1179. Xcall to the ping program and parses the last two output lines of the
  1180. Xprogram. The 
  1181. X.I osiping
  1182. Xprogram available with OSI protocol software also produces similar output
  1183. Xas the IP ping program, so it can be used instead of the IP
  1184. X.I ping
  1185. Xprogram. The corresponding monitor is called 
  1186. X.I osipingmon
  1187. Xand it can be given a list of OSI nodes with OSI addresses.
  1188. X
  1189. XSince the list of nodes can get quite large and it can take a large
  1190. Xamount of time before a site is tested again, it has been adapted to
  1191. Xwork with the 
  1192. X.IR multiping (8)
  1193. Xprogram (also available with the NOCOL distribution). It is advised
  1194. Xto use this program instead of the standard Unix ping program for large
  1195. Xnumber of sites. No such program is available (at this time) for OSI
  1196. Xnetworks.
  1197. X.\"
  1198. X.SH OPTIONS
  1199. X.TP 5
  1200. X.B \-d
  1201. Xprints debugging output.
  1202. X.TP 3
  1203. X.BI \-o " <output-data-file>"
  1204. XThe name of the nocol format datafile produced by ippingmon. By default,
  1205. Xthis file is ETCDIR/ippingmon-output.
  1206. X.TP 3
  1207. X.BI \-p  <ping-program>
  1208. XThis is the path to the 
  1209. X.I ping
  1210. Xprogram to be used for sending ICMP packets to the remote hosts.
  1211. XThis must produce output summary lines in the format:
  1212. X.RS
  1213. X.sp
  1214. X.DS
  1215. X   r2d2%  ping -s  nisc.jvnc.net 100 10 | tail -2
  1216. X    5 packets transmitted, 5 packets received, 0% packet loss
  1217. X    round-trip (ms)  min/avg/max = 4/5/7
  1218. X.DE
  1219. X.sp
  1220. X.RE
  1221. XSet the default location of the ping program during compile time (or
  1222. Xif you are using
  1223. X.I multiping
  1224. Xinstead).
  1225. X.TP 3
  1226. X.I <config-file>
  1227. XThis is the list of IP nodes. The default filename is ETCDIR/ipnodes (osinodes
  1228. Xfor the osipingmon monitor).
  1229. XThe format of this file is:
  1230. X.RS
  1231. X.sp
  1232. X.DS
  1233. X  POLLINTERVAL   secs
  1234. X.br
  1235. X  sitename  address
  1236. X.br
  1237. X  site2   address  test
  1238. X.DE
  1239. X.RE
  1240. X.sp
  1241. XThe
  1242. X.I test
  1243. Xkeyword sets the NOCOP
  1244. X.I test
  1245. Xoption in the EVENT structure. This is useful to mark sites that are
  1246. XNOT in production yet and need to be monitored. The post-processors
  1247. Xcan then differentiate between test sites and production sites.
  1248. X.SH CAVEATS
  1249. XThe program expects to parse fixed format \fIping\fR output.
  1250. X.\"------------------------------------
  1251. X.SH AUTHOR
  1252. XVikas Aggarwal, JvNCnet (vikas@jvnc.net).
  1253. X.SH SEE ALSO
  1254. Xnocol(1) nocol-prog(3) perlnocol(3)
  1255. Xeventselect(8) genmon(8) noclogd(8) nocol-overview(8)
  1256. Xnocol-utility(8) nsmon(8) pingmon(8) portmon(8) 
  1257. Xtpmon(8) trapmon(8)
  1258. X
  1259. END_OF_FILE
  1260.   if test 3322 -ne `wc -c <'nocol-3.0/src/doc/pingmon.8'`; then
  1261.     echo shar: \"'nocol-3.0/src/doc/pingmon.8'\" unpacked with wrong size!
  1262.   fi
  1263.   # end of 'nocol-3.0/src/doc/pingmon.8'
  1264. fi
  1265. if test -f 'nocol-3.0/src/doc/tpmon.8' -a "${1}" != "-c" ; then 
  1266.   echo shar: Will not clobber existing file \"'nocol-3.0/src/doc/tpmon.8'\"
  1267. else
  1268.   echo shar: Extracting \"'nocol-3.0/src/doc/tpmon.8'\" \(3323 characters\)
  1269.   sed "s/^X//" >'nocol-3.0/src/doc/tpmon.8' <<'END_OF_FILE'
  1270. X.\"$Header: /home/aggarwal/lsrc/nocol/src/doc/RCS/tpmon.8,v 1.3 1993/10/28 16:38:03 aggarwal Exp $"
  1271. X.\"
  1272. X.TH TPMON 8 "June 9, 1992"
  1273. X.SH NAME
  1274. Xtpmon \- TCP/IP network throughput measuring program
  1275. X.SH SYNOPSIS
  1276. X.B tpmon
  1277. X[
  1278. X.B \-d
  1279. X] [
  1280. X.B \-o
  1281. X.I output-file
  1282. X]
  1283. X.I config-file
  1284. X.SH DESCRIPTION
  1285. X.LP
  1286. X.B tpmon
  1287. Xis part of the NOCOL network monitoring package from JvNCnet, used for
  1288. Xmeasuring the throughput (bits per second) to a remote networked site.
  1289. X
  1290. XThe program reads in the list of sites to test from a config file at startup
  1291. Xand then tests the throughput by dumping data to the 
  1292. X.I discard
  1293. Xport (TCP port 9) on the remote hosts. It keeps track of the amount of data
  1294. Xsent and the time to send it, and calculates the throughput in bits
  1295. Xper second.  If the measured throughput drops below the set threshold value
  1296. X(in the configuration file), then the
  1297. X.I severity
  1298. Xfor that site is incremented. However, the severity is not incremented beyond
  1299. XWARNING (this is because the intent of the program is more towards providing
  1300. Xinformation than realtime monitoring. Furthermore, the thruput is a function
  1301. Xof the network load, system load, etc. and can only be considered a rough
  1302. Xestimate).
  1303. X
  1304. XThe program sleeps for POLLINTERVAL seconds between each run through the
  1305. Xlist of hosts. This should be set to about 2 hours or more (7200) to avoid
  1306. Xloading the system and the network.
  1307. X
  1308. XThe program is useful for 
  1309. X.I comparing
  1310. Xthe throughputs to various sites. The output indicates the throughput rate in
  1311. XKbits per second.
  1312. X
  1313. X.SH OPTIONS
  1314. X.TP 16
  1315. X.B \-d
  1316. Xselects verbose debugging output mode
  1317. X.TP
  1318. X.BI "\-o" " output file"
  1319. XName of the file to which to write the output.  This file is 
  1320. X.I not
  1321. Xin human-readable format, and is intended to be processed by the 
  1322. X.BR nocol (1)
  1323. Xdisplay program.
  1324. X.TP
  1325. X.I config-file
  1326. XThis file lists the hosts to be tested for throughput and the threshold
  1327. Xlevels. It also has the sleep interval between tests.
  1328. X
  1329. XThe format of this file is:
  1330. X.RS
  1331. X.sp
  1332. X.DS
  1333. XPOLLINTERVAL   secs
  1334. X.br
  1335. X<SiteName>  <IPaddress> <Threshold in Kbps> [TEST]
  1336. X.DE
  1337. X.RE
  1338. X.sp
  1339. X.IP
  1340. XThe 
  1341. X.I sitename
  1342. Xis there only for the operator's benefit and thus does not have to be a full
  1343. Xname.  The second column is the site's IP address.  The third column
  1344. Xis the lower threshold for throughput in Kbits per second (i.e.
  1345. X1000 is 1 megabit per second)- if the throughput drops below this, the site
  1346. Xwill be elevated to the WARNING level. The TEST keyword sets the n_TEST flag
  1347. Xin the 
  1348. X.I nocop
  1349. Xfield for the event which is then used by the post-processors (nocol, etc.).
  1350. X.\"------------------------------------
  1351. X.SH AUTHOR
  1352. XS. Spencer Sun (spencer@phoenix.princeton.edu, spencer@jvnc.net) for JvNCnet.
  1353. X.SH CAVEATS
  1354. X.LP
  1355. XThe measured throughput is a function of the network load, the end system
  1356. Xload and the intermediate hops. Hence, it can only be used as a rough
  1357. Xestimate.
  1358. X
  1359. XThe program should
  1360. X.I not
  1361. Xbe used for connecting to routers because of the additional CPU load on the
  1362. Xrouter (typically, router CPU's don't need to process every packet since the
  1363. Xpacket can be switched by the I/O card directly).
  1364. XFurthermore, the router might give lower priority to discard port
  1365. Xconnections. 
  1366. X.\"------------------------------------
  1367. X.SH SEE ALSO
  1368. Xnocol(1) nocol-prog(3) perlnocol(3)
  1369. Xeventselect(8) genmon(8) noclogd(8) nocol-overview(8)
  1370. Xnocol-utility(8) nsmon(8) pingmon(8) portmon(8) 
  1371. Xtpmon(8) trapmon(8)
  1372. X
  1373. END_OF_FILE
  1374.   if test 3323 -ne `wc -c <'nocol-3.0/src/doc/tpmon.8'`; then
  1375.     echo shar: \"'nocol-3.0/src/doc/tpmon.8'\" unpacked with wrong size!
  1376.   fi
  1377.   # end of 'nocol-3.0/src/doc/tpmon.8'
  1378. fi
  1379. if test -f 'nocol-3.0/src/include/nsmon.h' -a "${1}" != "-c" ; then 
  1380.   echo shar: Will not clobber existing file \"'nocol-3.0/src/include/nsmon.h'\"
  1381. else
  1382.   echo shar: Extracting \"'nocol-3.0/src/include/nsmon.h'\" \(3330 characters\)
  1383.   sed "s/^X//" >'nocol-3.0/src/include/nsmon.h' <<'END_OF_FILE'
  1384. X/*
  1385. X * $Header: /home/aggarwal/lsrc/nocol/src/include/RCS/nsmon.h,v 1.3 1993/10/30 03:03:19 aggarwal Exp $
  1386. X */
  1387. X#ifndef __NSMON_H__
  1388. X#define __NSMON_H__
  1389. X
  1390. X
  1391. X/*
  1392. X *        FILE DEFINITIONS
  1393. X *
  1394. X * DATADIR is the location of the datafile. The name is prepended to
  1395. X * PINGOUTPUT to create the output filename.
  1396. X *
  1397. X * NODESFILE is the full name of the file containing the list of hosts
  1398. X * and ip addresses.
  1399. X *
  1400. X * The program needs to know the location of the 'ping' progam that is
  1401. X * to be used.
  1402. X */
  1403. X
  1404. X#ifndef DATADIR
  1405. X#define DATADIR        "../../data"
  1406. X#endif
  1407. X
  1408. X#ifndef NODESFILE
  1409. X#define NODESFILE    "../../etc/nsmon-confg"
  1410. X#endif
  1411. X
  1412. X/*
  1413. X * The progam automatically fills in its own name in the EVENT.sender
  1414. X * field. If you want to over-ride this name with your own, then define
  1415. X * SENDER
  1416. X */
  1417. X/* #define SENDER    "nsmon"    /* */
  1418. X
  1419. X/*
  1420. X * Extension of the output datafile. DATADIR/prognm is tacked onto this name.
  1421. X */
  1422. X#define    NSMONOUTPUTEXT  "-output"
  1423. X
  1424. X/*
  1425. X *        CONSTANTS
  1426. X */
  1427. X#ifndef BUFSIZ                      /* in stdio.h */
  1428. X#define BUFSIZ 1024
  1429. X#endif /* BUFSIZ */
  1430. X
  1431. X#define MAXLINE        128        /* Randomly selected string lengths */
  1432. X
  1433. X#define VARNM        "named status"      /* for EVENT.var.name field */
  1434. X#define VARUNITS    "SOA"            /* Units name (none)*/
  1435. X#define DEBUG_FLG     "NOCOL_DEBUG"        /* run in debug mode if set */
  1436. X#define POLLINTERVAL    (time_t)60        /* interval between queries */
  1437. X
  1438. X  /*
  1439. X   * C_IN and T_SOA are #defined in /usr/include/arpa/nameser.h.
  1440. X   *
  1441. X   * QUERY is the actual data with which to query the server.  If the
  1442. X   * data is not needed just #define it to "".  For example, if QUERY
  1443. X   * is T_PTR, then nsmon will construct a query by taking the IP# of
  1444. X   * the server and making an in-addr.arpa out of it, so no QUERY is
  1445. X   * needed, but it needs to be #defined to avoid compiler errors.
  1446. X   */
  1447. X
  1448. X#define QUERYTIMEOUT    20    /* timeout connections in this many seconds */
  1449. X#define QUERYCLASS    C_IN    /* query class */
  1450. X#define QUERYTYPE    T_SOA    /* type of query to make */
  1451. X#define QUERY_AA_ONLY    0    /* set to 1 to set RES_AAONLY flag of _res */
  1452. X#ifndef QUERYDATA
  1453. X#  define QUERYDATA    "jvnc.net"
  1454. X#endif
  1455. X
  1456. X/*
  1457. X * Global variables
  1458. X */
  1459. X#ifdef GLOBALS
  1460. X#define EXTERN
  1461. X#else
  1462. X#define EXTERN extern
  1463. X#endif
  1464. X
  1465. XEXTERN int debug;
  1466. XEXTERN char *prognm;            /* Program name            */
  1467. XEXTERN char *sender;            /* Name used in the v.sender field */
  1468. XEXTERN char ipnodes[MAXLINE];        /* File with the list of nodes    */
  1469. XEXTERN char datafile[MAXLINE] ;        /* Names of the data file    */
  1470. XEXTERN char querydata[MAXLINE];        /* Query data string (domainname) */
  1471. X
  1472. X/*
  1473. X * nsmon() -- does all the dirty work
  1474. X *
  1475. X * input parameters:
  1476. X *      server: address of the nameserver to be queried (MUST be an IP #)
  1477. X *      request: query to be passed to nameserver.  If type is T_SOA then
  1478. X *              this needs to be a domain name
  1479. X *      class: a class, probably C_IN, as defined in <arpa/nameser.h>
  1480. X *      type: query type, probably T_SOA, as defined in <arpa/nameser.h>
  1481. X *      timeout: if no response in this many seconds, give up
  1482. X *      flags: options as defined below
  1483. X *
  1484. X * return values: defined below
  1485. X */
  1486. X
  1487. Xint nsmon(/* char *server, char *request, int class, int type,
  1488. X  int timeout, int aa_only, int debug */);
  1489. X
  1490. X/* return codes from nsmon() */
  1491. X
  1492. X#define ALL_OK            0    /* everything's groovy */
  1493. X#define NOT_AUTHORITATIVE    1    /* got a response, but not auth. */
  1494. X#define ERROR            2    /* no response, or connection */
  1495. X
  1496. X#endif /* __NSMON__H__ */
  1497. X
  1498. X
  1499. END_OF_FILE
  1500.   if test 3330 -ne `wc -c <'nocol-3.0/src/include/nsmon.h'`; then
  1501.     echo shar: \"'nocol-3.0/src/include/nsmon.h'\" unpacked with wrong size!
  1502.   fi
  1503.   # end of 'nocol-3.0/src/include/nsmon.h'
  1504. fi
  1505. if test -f 'nocol-3.0/src/include/tpmon.h' -a "${1}" != "-c" ; then 
  1506.   echo shar: Will not clobber existing file \"'nocol-3.0/src/include/tpmon.h'\"
  1507. else
  1508.   echo shar: Extracting \"'nocol-3.0/src/include/tpmon.h'\" \(3217 characters\)
  1509.   sed "s/^X//" >'nocol-3.0/src/include/tpmon.h' <<'END_OF_FILE'
  1510. X/*
  1511. X * $Header: /nocol/src/include/RCS/tpmon.h,v 1.1 1992/06/12 21:08:20 aggarwal Exp $
  1512. X */
  1513. X#ifndef __TPMON_H__
  1514. X#define __TPMON_H__
  1515. X
  1516. X
  1517. X/*
  1518. X *        FILE DEFINITIONS
  1519. X *
  1520. X * DATADIR is the location of the datafile. The name is prepended to
  1521. X * the programs own name to create the output filename.
  1522. X *
  1523. X * NODESFILE is the full name of the thruput config file
  1524. X * and ip addresses.
  1525. X *
  1526. X */
  1527. X
  1528. X#ifndef DATADIR
  1529. X#define DATADIR        "../../data"
  1530. X#endif
  1531. X
  1532. X#ifndef NODESFILE
  1533. X#define NODESFILE    "../../etc/tpmon-confg"
  1534. X#endif
  1535. X
  1536. X/*
  1537. X * The progam automatically fills in its own name in the EVENT.sender
  1538. X * field. If you want to over-ride this name with your own, then define
  1539. X * SENDER
  1540. X */
  1541. X/* #define SENDER    "thruputmon"    /* About 16 characters possible ? */
  1542. X
  1543. X/*
  1544. X * Extension of the output datafile. DATADIR/prognm is tacked onto this name.
  1545. X */
  1546. X#define    TPMONOUTPUTEXT  "-output"
  1547. X
  1548. X/*
  1549. X *        CONSTANTS
  1550. X */
  1551. X#ifndef BUFSIZ                      /* in stdio.h */
  1552. X#define BUFSIZ 1024
  1553. X#endif /* BUFSIZ */
  1554. X
  1555. X#define MAXLINE        127    /* Randomly selected string lengths */
  1556. X
  1557. X#define VARNM        "Thruput"    /* for EVENT.var.name field    */
  1558. X#define VARUNITS    "Kbps"        /* Units name */
  1559. X#define DEBUG_FLG     "TPMON_DEBUG"     /* to run in debug mode    if set    */
  1560. X#define POLLINTERVAL    (time_t)(2 * 3600)    /* interval between queries */
  1561. X
  1562. X#define PORT_NUMBER    9        /* tcp discard port */
  1563. X#define NUM_BYTES    0L        /* default num_blocks */
  1564. X#ifdef BUFSIZ    /* in stdio.h */
  1565. X#define BLOCKSIZE     BUFSIZ        /* default blocksize */
  1566. X#endif /* BUFSIZ */
  1567. X#define PATTERN        NULL        /* default pattern == none == random */
  1568. X#define RUN_TIME    30        /* default secs of test run */
  1569. X  /* see below for the effects of having both time and blocksize non-zero */
  1570. X
  1571. X/*
  1572. X * Global variables
  1573. X */
  1574. X#ifdef GLOBALS
  1575. X#define EXTERN
  1576. X#else
  1577. X#define EXTERN extern
  1578. X#endif
  1579. X
  1580. XEXTERN int debug;
  1581. XEXTERN time_t pollinterval;        /* Time between polls */
  1582. XEXTERN char *prognm;            /* Program name            */
  1583. XEXTERN char *sender;            /* Name used in the v.sender field */
  1584. XEXTERN char ipnodes[MAXLINE];        /* File with the list of nodes    */
  1585. XEXTERN char datafile[MAXLINE] ;        /* Name of the data file    */
  1586. XEXTERN char sigtoprog[MAXLINE] ;    /* Prog recieving SIGUSR1 sig when */
  1587. X                                        /* a site goes critical */
  1588. X
  1589. X/*
  1590. X * throughput -- finds throughput of a remote site
  1591. X *
  1592. X * parameters:
  1593. X *   addr is the address of the site to be tested.  It can be either
  1594. X *     a name (e.g. phoenix.princeton.edu) or an IP # (e.g. 128.112.128.43)
  1595. X *   port is the port number, and defaults to 9 (discard port)
  1596. X *   numblocks is the number of blocks to send
  1597. X *   blocksize is the blocksize to be used
  1598. X *   pattern is a pattern of bytes which will be used to fill the data block
  1599. X *     (set it to NULL for random characters)
  1600. X *   time is the duration of the test in seconds
  1601. X *   verbose enables verbose output mode
  1602. X *
  1603. X *   if both numblocks and time are nonzero, then the test will last until
  1604. X *   either numblocks blocks have been sent, or time seconds have elapsed,
  1605. X *   whichever comes first
  1606. X *
  1607. X * return values:
  1608. X *   a double representing the throughput in bits per second
  1609. X *   -1.0 if an error occured
  1610. X */
  1611. X
  1612. Xdouble throughput(/* char *addr, short int port, long numbytes, int blocksize,
  1613. X                  char *pattern, int time, int verbose */);
  1614. X
  1615. X#endif /* __TPMON__H__ */
  1616. X
  1617. X
  1618. END_OF_FILE
  1619.   if test 3217 -ne `wc -c <'nocol-3.0/src/include/tpmon.h'`; then
  1620.     echo shar: \"'nocol-3.0/src/include/tpmon.h'\" unpacked with wrong size!
  1621.   fi
  1622.   # end of 'nocol-3.0/src/include/tpmon.h'
  1623. fi
  1624. if test -f 'nocol-3.0/src/netmon/help_page.c' -a "${1}" != "-c" ; then 
  1625.   echo shar: Will not clobber existing file \"'nocol-3.0/src/netmon/help_page.c'\"
  1626. else
  1627.   echo shar: Extracting \"'nocol-3.0/src/netmon/help_page.c'\" \(2760 characters\)
  1628.   sed "s/^X//" >'nocol-3.0/src/netmon/help_page.c' <<'END_OF_FILE'
  1629. X/*+ 
  1630. X** $Header
  1631. X**/
  1632. X
  1633. X/* Copyright 1992 JvNCnet, Princeton */
  1634. X
  1635. X/*+
  1636. X**
  1637. X** FUNCTION:
  1638. X**     To display the help page by reading the file HELPFILE
  1639. X**/
  1640. X
  1641. X/*
  1642. X *     $Log: help_page.c,v $
  1643. X * Revision 1.4  1992/06/18  21:04:34  aggarwal
  1644. X * Added copyright notice.
  1645. X *
  1646. X * Revision 1.3  1992/04/22  22:59:58  aggarwal
  1647. X * Lot of cleaning up for releasing. Organized things right.
  1648. X *
  1649. X * Revision 1.2  1990/03/21  15:27:08  aggarwal
  1650. X * replaced clrtoeol() with wclrtoeol(hwin)
  1651. X *
  1652. X * Revision 1.1  90/03/09  13:05:58  aggarwal
  1653. X * Initial revision
  1654. X * 
  1655. X * 
  1656. X */
  1657. X
  1658. X#include    "netmon.h"
  1659. X#include     <sys/file.h>
  1660. X
  1661. X#ifndef HELPFILE
  1662. X#define HELPFILE    "helpfile"
  1663. X#endif
  1664. X#define WFULL(w)      (w->_cury == (w->_maxy - 2)) ? 1:0
  1665. X
  1666. Xhelp_page()
  1667. X{
  1668. X    extern int errno;
  1669. X    extern char *sys_errlist[];
  1670. X    extern char *helpfile ;            /* In netmon.h        */
  1671. X    WINDOW *hwin;
  1672. X    char buffer[MAXLINE], *strcat() ;
  1673. X    int i = 1, fd ;
  1674. X
  1675. X    hwin= newwin( 0, 0, 0, 0 );
  1676. X    touchwin(hwin) ;
  1677. X
  1678. X    help_title(hwin, i) ;            /* display fancy title    */
  1679. X    if ((fd = open(helpfile, O_RDONLY)) < 0)
  1680. X    {
  1681. X    wprintw(hwin,"Netmon help (open) %s: %s\n", 
  1682. X        helpfile, sys_errlist[errno]);
  1683. X    wprintw(hwin, "\nHit any key to continue: ");
  1684. X    wclrtobot(hwin);
  1685. X    wrefresh(hwin);
  1686. X    getchar();
  1687. X    return(1);
  1688. X    }
  1689. X
  1690. X    for ( ; ; )            /* display screenfuls of the helpfile    */
  1691. X    {
  1692. X    while (!(WFULL(hwin)) && fdgets(buffer, MAXLINE, fd) != 0)
  1693. X      wprintw(hwin, "%s", buffer);
  1694. X    
  1695. X    if (WFULL(hwin))            /* window filled    */
  1696. X    {
  1697. X        wprintw (hwin, "\n--More--");
  1698. X        wclrtoeol(hwin);
  1699. X        wrefresh(hwin);
  1700. X        if (getchar() == 'q')
  1701. X          break ;                /* from outer 'for'    */
  1702. X    }
  1703. X    else                    /* end of the file    */
  1704. X    {
  1705. X        wprintw(hwin, "\nHit any key to return: ");
  1706. X        wclrtoeol(hwin);
  1707. X        wclrtobot(hwin);            /* Remove old trash    */
  1708. X        wrefresh(hwin) ;
  1709. X        getchar() ;
  1710. X        break ;                /* from outer for loop    */
  1711. X    }
  1712. X    werase(hwin);
  1713. X    help_title(hwin, ++i);
  1714. X    }                        /* end:  for        */
  1715. X    close(fd);
  1716. X    return(0);                    /* all OK    */
  1717. X
  1718. X}                        /* end: help_page    */
  1719. X
  1720. X
  1721. Xhelp_title(hwin, hpage)
  1722. X     WINDOW *hwin;
  1723. X     int hpage;
  1724. X{
  1725. X    wstandout (hwin);
  1726. X    mvwprintw (hwin, 0, (int)(COLS/2 - 6), "HELP SCREEN (%d)\n\n", hpage);
  1727. X    wstandend (hwin);
  1728. X
  1729. X    return(1) ;
  1730. X}
  1731. X/*+ 
  1732. X** FUNCTION:
  1733. X**     Read in  a string from the open file desc. Keeps newline and
  1734. X** appends a NULL at the end of the string
  1735. X**/
  1736. Xfdgets(buf, bufsiz, fd)
  1737. X     char *buf;
  1738. X     int bufsiz, fd;
  1739. X{
  1740. X    register n, i = 0;
  1741. X
  1742. X    if (bufsiz <= 0)
  1743. X      return(-1);            /* invalid buffer size    */
  1744. X
  1745. X    while ((n = read(fd, &(buf[i]), 1)) > 0  &&  buf[i++] != '\n')
  1746. X      if (i == (bufsiz - 1))
  1747. X    break;
  1748. X
  1749. X    buf[i] = '\0';                  /* Append a null character    */
  1750. X    if (n <= 0)                /* No characters read        */
  1751. X      return(0);
  1752. X    else
  1753. X      return(n) ;            /* Num of characters read    */
  1754. X
  1755. X}                    /* end: fdgets            */
  1756. END_OF_FILE
  1757.   if test 2760 -ne `wc -c <'nocol-3.0/src/netmon/help_page.c'`; then
  1758.     echo shar: \"'nocol-3.0/src/netmon/help_page.c'\" unpacked with wrong size!
  1759.   fi
  1760.   # end of 'nocol-3.0/src/netmon/help_page.c'
  1761. fi
  1762. if test -f 'nocol-3.0/src/netmon/msg_dpy.c' -a "${1}" != "-c" ; then 
  1763.   echo shar: Will not clobber existing file \"'nocol-3.0/src/netmon/msg_dpy.c'\"
  1764. else
  1765.   echo shar: Extracting \"'nocol-3.0/src/netmon/msg_dpy.c'\" \(3199 characters\)
  1766.   sed "s/^X//" >'nocol-3.0/src/netmon/msg_dpy.c' <<'END_OF_FILE'
  1767. X/*+ 
  1768. X** $Header: /home/aggarwal/lsrc/nocol/src/netmon/RCS/msg_dpy.c,v 1.7 1993/10/30 03:52:42 aggarwal Exp $
  1769. X**/
  1770. X
  1771. X/* Copyright 1992 JvNCnet, Princeton */
  1772. X
  1773. X/*+ 
  1774. X** This module displays messages on the 'wmsg' window. It displays all
  1775. X** the files in the MSGSDIR directory.
  1776. X** The window can scroll, so only the latest message is going to be shown
  1777. X** anyway. For this very reason, make sure that the newlines when printing
  1778. X** out strings are *before* the string starts and not afterwards (else
  1779. X** the message can scroll off as soon as printed if the size of the
  1780. X** message window is very small).
  1781. X**
  1782. X**/
  1783. X
  1784. X/*+ 
  1785. X *   $Log: msg_dpy.c,v $
  1786. X * Revision 1.7  1993/10/30  03:52:42  aggarwal
  1787. X * Now uses dirent(). Deleted include dir.h
  1788. X *
  1789. X * Revision 1.6  1992/06/18  21:05:02  aggarwal
  1790. X * Small cleanups for releasing.
  1791. X *
  1792. X *
  1793. X * Revision 1.4  1992/04/22  22:59:58  aggarwal
  1794. X * Lot of cleaning up for releasing. Organized things right.
  1795. X *
  1796. X * Revision 1.3  1990/05/23  17:22:38  aggarwal
  1797. X * Added control of the variable 'msg_on' so that it is turned
  1798. X * off after displaying all the files in MSGDIR.
  1799. X *
  1800. X * Revision 1.2  90/05/13  16:24:00  aggarwal
  1801. X * Removed the line to skip over "." and ".." since it is done
  1802. X * in the fill_window module now.
  1803. X * 
  1804. X * Revision 1.1  90/03/09  13:06:10  aggarwal
  1805. X * Initial revision
  1806. X * 
  1807. X * 
  1808. X */
  1809. X
  1810. X#include    "netmon.h"
  1811. X
  1812. Xmsg_dpy ()
  1813. X{
  1814. X    extern struct allwins aw ;            /* In netmon.h        */
  1815. X    extern int msg_on;                /* In netmon.h        */
  1816. X    extern char *msgsdir ;            /* dir name, in netmon.h */
  1817. X    static DIR *msgdirp ;                 /* Ptr to 'msgs' dir    */
  1818. X    static int msgfd ;                /* Open file desc    */
  1819. X    int display_one_msg() ;
  1820. X
  1821. X    if (msgdirp == NULL)            /* Not opened yet    */
  1822. X    {
  1823. X    if ((msgdirp = opendir(msgsdir)) == NULL)
  1824. X    {
  1825. X        wprintw (aw.wmsg, "\n msg_dpy (opendir '%s'): %s", 
  1826. X             msgsdir, sys_errlist[errno]);
  1827. X        return(1) ;                /* 'minor' error    */
  1828. X    }
  1829. X    }
  1830. X
  1831. X    if (fill_window(aw.wmsg, msgdirp, MSGSDIR, &msgfd, display_one_msg))
  1832. X    {
  1833. X    closedir(msgdirp);
  1834. X    msgdirp = NULL ;            /* reset to reopen dir    */
  1835. X    msgfd = 0 ;
  1836. X    msg_on = 0 ;        /* to skip this function next time    */
  1837. X    }
  1838. X
  1839. X    return(0);
  1840. X
  1841. X}                        /* end: msg_dpy()    */
  1842. X
  1843. X/*+ 
  1844. X** FUNCTION:
  1845. X**     Displays one line from the open file descriptor on the msg
  1846. X** window. If reached the end of file, then returns a zero so that the
  1847. X** calling program can close the file.
  1848. X**
  1849. X** Note that the function gets an opened file descriptor and it does
  1850. X** not mess with the location of the file pointer since the next line
  1851. X** is read from the previous location.
  1852. X**
  1853. X** The initial newline character should clear the present line to the
  1854. X** end else the previous contents remain messed up. Hence used
  1855. X** wclrtoeol() to make things safe and sound.
  1856. X**/
  1857. Xdisplay_one_msg(fd, wmsg)
  1858. X     int fd;
  1859. X     WINDOW *wmsg ;
  1860. X{
  1861. X    char c ;
  1862. X
  1863. X    waddch(wmsg, '\n');            /* Insert a newline first    */
  1864. X    while (read(fd, &c, 1) > 0)        /* read one character at a time    */
  1865. X      if ( c == '\n')            /* reached end of line        */
  1866. X      {
  1867. X      wclrtoeol(wmsg);        /* Clear prev stuff        */
  1868. X      return(1);            /* return to calling program    */
  1869. X      }
  1870. X      else
  1871. X    waddch(wmsg, c);             /* Put character onto screen    */
  1872. X
  1873. X    wclrtoeol(wmsg) ;
  1874. X    return (0);                /* Here only if end of file    */
  1875. X}
  1876. END_OF_FILE
  1877.   if test 3199 -ne `wc -c <'nocol-3.0/src/netmon/msg_dpy.c'`; then
  1878.     echo shar: \"'nocol-3.0/src/netmon/msg_dpy.c'\" unpacked with wrong size!
  1879.   fi
  1880.   # end of 'nocol-3.0/src/netmon/msg_dpy.c'
  1881. fi
  1882. if test -f 'nocol-3.0/src/nsmon/poll_sites.c' -a "${1}" != "-c" ; then 
  1883.   echo shar: Will not clobber existing file \"'nocol-3.0/src/nsmon/poll_sites.c'\"
  1884. else
  1885.   echo shar: Extracting \"'nocol-3.0/src/nsmon/poll_sites.c'\" \(2732 characters\)
  1886.   sed "s/^X//" >'nocol-3.0/src/nsmon/poll_sites.c' <<'END_OF_FILE'
  1887. X/*
  1888. X * $Header: /home/aggarwal/lsrc/nocol/src/nsmon/RCS/poll_sites.c,v 1.5 1993/10/30 03:41:25 aggarwal Exp $
  1889. X *
  1890. X * poll_sites.c for Nameserver monitor (nsmon)
  1891. X *     makes one pass over the entire data file
  1892. X *     adapted from poll_sites.c of pingmon 1.15
  1893. X *
  1894. X *
  1895. X * $Log: poll_sites.c,v $
  1896. X * Revision 1.5  1993/10/30  03:41:25  aggarwal
  1897. X * *** empty log message ***
  1898. X *
  1899. X * Revision 1.4  1993/10/29  22:03:36  aggarwal
  1900. X * Changed L_INCR to SEEK_CUR. Also deleted the wierd  sockad.sin_addr.S_un
  1901. X * stuff. Now passed the 'querydata' properly.
  1902. X *
  1903. X * Revision 1.3  1993/10/02  05:34:49  aggarwal
  1904. X * Moved the 'logic' for escalating severity and updating the
  1905. X * loglevel, etc. into a libnocol library routine.
  1906. X *
  1907. X * Revision 1.2  1993/09/18  22:37:16  aggarwal
  1908. X * Added logging, etc.
  1909. X *
  1910. X * Revision 1.1  1992/06/11  05:06:12  aggarwal
  1911. X * Initial revision
  1912. X *
  1913. X */
  1914. X
  1915. X/* Copyright 1993 JvNCnet, Global Enterprise Services */
  1916. X
  1917. X/*+ 
  1918. X * INCLUDE FILES
  1919. X */
  1920. X
  1921. X#include "nocol.h"            /* common structures */
  1922. X#include "nsmon.h"            /* program specific defines */
  1923. X
  1924. X#include <signal.h>
  1925. X#include <sys/file.h>
  1926. X#include <arpa/nameser.h>
  1927. X
  1928. Xstatic int maxseverity = E_CRITICAL ; /* Max severity of events from nsmon */
  1929. X
  1930. X/* #defines for finish_status */
  1931. X#define REACHED_EOF 1
  1932. X#define READ_ERROR 2
  1933. X
  1934. Xpoll_sites(fdout)
  1935. X     int fdout;                /* Descriptors to open files    */
  1936. X{
  1937. X  EVENT v;                    /* described in nocol.h        */
  1938. X  struct tm *ltime ;    
  1939. X  time_t locclock ;            /* careful: don't use 'long'    */
  1940. X  long status;                       /* site status            */
  1941. X  int bufsize;                /* for reading in file */
  1942. X  int sigpid;                /* PID of program to get signal    */
  1943. X
  1944. X  if ( lseek(fdout, (off_t)0, SEEK_SET) == -1) { /* rewind the file    */
  1945. X    perror (prognm);
  1946. X    return (-1);
  1947. X  }
  1948. X
  1949. X  /* 
  1950. X   * until end of the file or erroneous data... one entire pass
  1951. X   */
  1952. X
  1953. X  while ( (bufsize = read (fdout, (char *)&v, sizeof(v))) == sizeof(v) ) 
  1954. X  {
  1955. X      switch(nsmon(v.site.addr, querydata, QUERYCLASS, QUERYTYPE,
  1956. X           QUERYTIMEOUT, QUERY_AA_ONLY, debug)) 
  1957. X      {
  1958. X       case ALL_OK: case NOT_AUTHORITATIVE:
  1959. X      status = 1; break;            /* '1' for all OK */
  1960. X       case ERROR: default:
  1961. X      status = 0; break;
  1962. X      } /* switch */
  1963. X
  1964. X      update_event(&v, status,/* VALUE */ status, maxseverity);
  1965. X
  1966. X    /* Now rewind to start of present record and write to the file    */
  1967. X     
  1968. X      lseek(fdout,-(off_t)sizeof(v), SEEK_CUR);
  1969. X      write (fdout, (char *)&v, sizeof(v));
  1970. X     
  1971. X  }        /* end of:    while (read..)    */
  1972. X    
  1973. X  /**** Now determine why we broke out of the above loop *****/
  1974. X    
  1975. X  if (bufsize == 0)            /* reached end of the file    */
  1976. X    return (1);
  1977. X  else {                /* error in output data file     */
  1978. X    fprintf (stderr, "%s: Insufficient read data in output file", prognm);
  1979. X    return (-1);
  1980. X  }
  1981. X}    /* end of:  poll_sites        */
  1982. X
  1983. END_OF_FILE
  1984.   if test 2732 -ne `wc -c <'nocol-3.0/src/nsmon/poll_sites.c'`; then
  1985.     echo shar: \"'nocol-3.0/src/nsmon/poll_sites.c'\" unpacked with wrong size!
  1986.   fi
  1987.   # end of 'nocol-3.0/src/nsmon/poll_sites.c'
  1988. fi
  1989. if test -f 'nocol-3.0/src/perlnocol/armon-confg' -a "${1}" != "-c" ; then 
  1990.   echo shar: Will not clobber existing file \"'nocol-3.0/src/perlnocol/armon-confg'\"
  1991. else
  1992.   echo shar: Extracting \"'nocol-3.0/src/perlnocol/armon-confg'\" \(79 characters\)
  1993.   sed "s/^X//" >'nocol-3.0/src/perlnocol/armon-confg' <<'END_OF_FILE'
  1994. X## Config for armon
  1995. X#
  1996. Xrouter=nomad
  1997. X50-50 e0 GES: Sub50
  1998. Xtest= 52  e0 GES: Sub50
  1999. END_OF_FILE
  2000.   if test 79 -ne `wc -c <'nocol-3.0/src/perlnocol/armon-confg'`; then
  2001.     echo shar: \"'nocol-3.0/src/perlnocol/armon-confg'\" unpacked with wrong size!
  2002.   fi
  2003.   # end of 'nocol-3.0/src/perlnocol/armon-confg'
  2004. fi
  2005. if test -f 'nocol-3.0/src/perlnocol/rcisco' -a "${1}" != "-c" ; then 
  2006.   echo shar: Will not clobber existing file \"'nocol-3.0/src/perlnocol/rcisco'\"
  2007. else
  2008.   echo shar: Extracting \"'nocol-3.0/src/perlnocol/rcisco'\" \(3084 characters\)
  2009.   sed "s/^X//" >'nocol-3.0/src/perlnocol/rcisco' <<'END_OF_FILE'
  2010. X#!/usr/local/bin/perl
  2011. X#
  2012. X# $Header: /home/aggarwal/lsrc/nocol/src/perlnocol/RCS/rcisco,v 1.3 1993/10/17 11:55:33 aggarwal Exp $
  2013. X#
  2014. X#     rcisco - perl routine to execute a Cisco router command remotely
  2015. X#
  2016. X# Programmer: Christopher Sedore
  2017. X# Revised by: John Wobus, jmwobus@mailbox.syr.edu
  2018. X#
  2019. X#    (c) Syracuse University Computing & Network Services 1993
  2020. X#
  2021. X# No warranty is expressed or implied.  Permission to copy and use is
  2022. X# extended to all.  Permission to redistribute is granted under the
  2023. X# following conditions: it is not sold for profit; this copyright
  2024. X# notice remains intact; the same permissions extend to the recipient;
  2025. X# and if any changes are made, a notice is added so stating.
  2026. X#
  2027. X# Command Format:
  2028. X#
  2029. X#  rcisco <router> <command> [<port>]
  2030. X#
  2031. X#    Signs on to Cisco router, executes command, and returns the
  2032. X#    result.
  2033. X#
  2034. X#    <router>       - the name or IP number of the Cisco router.
  2035. X#    <command>      - the Cisco router command, e.g. "show interfaces".
  2036. X#    <port>         - the TCP port: 23 by default.
  2037. X#
  2038. X# Example Call:
  2039. X#
  2040. X#  rcisco mycisco.excellent.edu "show hardware"
  2041. X#
  2042. X#    This command signs on to myscisco.excellent.edu, executes the
  2043. X#    command "show hardware" and sends the result to the standard
  2044. X#    output.
  2045. X#
  2046. X# Depends upon:
  2047. X#    hostname      - Unix command to list a host's name.
  2048. X#
  2049. X# To install this:
  2050. X#   (1) Assign the perl variables below appropriately.
  2051. X#   (2) Put this file whereever you want.
  2052. X#
  2053. X
  2054. X#
  2055. X
  2056. X$defaultrouter="router.domain.edu";    # Default router.
  2057. X$defaultpasswd="mypasswd";        # PW of the router.
  2058. X$defaultcommand="show hardware";    # Command to exec on router
  2059. X$defaultport=23;            # Default TCP port.
  2060. X
  2061. X#
  2062. X# main routine
  2063. X#
  2064. X
  2065. X($them,$passwd,$command,$port) = @ARGV;
  2066. X$them = $defaultrouter unless $them;
  2067. X$passwd = $defaultpasswd unless $passwd;
  2068. X$command = $defaultcommand unless $command;
  2069. X$port = $defaultport unless $port;    # usually should be port 23
  2070. X
  2071. X$AF_INET = 2;
  2072. X$SOCK_STREAM = 1;
  2073. X
  2074. X$SIG{'INT'} = 'dokill';
  2075. Xsub dokill { kill 9,$child if $child; }
  2076. X
  2077. X# require "$socketph";
  2078. X
  2079. X$sockaddr = 'S n a4 x8';
  2080. Xchop($hostname = `hostname`);
  2081. X
  2082. X($name, $aliases, $proto) = getprotobyname('tcp');
  2083. X($name, $aliases, $port) = getservbyname($port, 'tcp')
  2084. X     unless $port =~ /^\d+$/;
  2085. X($name, $aliases, $type, $len, $thisaddr) =
  2086. X                    gethostbyname($hostname);
  2087. Xif ($them =~ /^\d+/)        # IP address specified
  2088. X{
  2089. X    local(@a) = split (/\./,$them);
  2090. X    $thataddr = pack ('C4', @a);
  2091. X}
  2092. Xelse {
  2093. X    ($name, $aliases, $type, $len, $thataddr) = gethostbyname($them);
  2094. X}
  2095. X
  2096. X$thataddr || die "Unknown host: $!";
  2097. X
  2098. X$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
  2099. X$that = pack($sockaddr, $AF_INET, $port, $thataddr);
  2100. X
  2101. Xsocket(S, $AF_INET, $SOCK_STREAM, $proto) || die "socket: $!";
  2102. Xbind(S, $this) || die "bind: $!";
  2103. Xconnect(S, $that) || die "connect: $!";
  2104. X
  2105. Xselect(S); $| = 1; select(STDOUT); # set socket to be command buffered
  2106. X
  2107. X
  2108. Xif ($child = fork) {
  2109. X  print S "$passwd\n";
  2110. X  print S "terminal length 0\n";    # dont need a 'more'
  2111. X  sleep 1; #some routers work better with this.
  2112. X  print S "$command\n";
  2113. X  print S "quit\n"; 
  2114. X  sleep 3;
  2115. X  do dokill();
  2116. X}
  2117. Xelse {
  2118. X  while (<S>) {print;}
  2119. X}
  2120. END_OF_FILE
  2121.   if test 3084 -ne `wc -c <'nocol-3.0/src/perlnocol/rcisco'`; then
  2122.     echo shar: \"'nocol-3.0/src/perlnocol/rcisco'\" unpacked with wrong size!
  2123.   fi
  2124.   chmod +x 'nocol-3.0/src/perlnocol/rcisco'
  2125.   # end of 'nocol-3.0/src/perlnocol/rcisco'
  2126. fi
  2127. if test -f 'nocol-3.0/src/tpmon/poll_sites.c' -a "${1}" != "-c" ; then 
  2128.   echo shar: Will not clobber existing file \"'nocol-3.0/src/tpmon/poll_sites.c'\"
  2129. else
  2130.   echo shar: Extracting \"'nocol-3.0/src/tpmon/poll_sites.c'\" \(3158 characters\)
  2131.   sed "s/^X//" >'nocol-3.0/src/tpmon/poll_sites.c' <<'END_OF_FILE'
  2132. X
  2133. X/*
  2134. X * $Header: /home/aggarwal/lsrc/nocol/src/tpmon/RCS/poll_sites.c,v 1.4 1993/10/30 03:28:28 aggarwal Exp $
  2135. X *
  2136. X * FUNCTIONS:
  2137. X *    Test throughput to a site (NOCOL style).
  2138. X *
  2139. X * poll_sites.c -- makes one pass over the entire data file
  2140. X *
  2141. X * adapted from poll_sites.c of 'pingmon' 1.15
  2142. X *
  2143. X * AUTHOR
  2144. X *    S. Spencer Sun, JvNCnet, June 1992
  2145. X *
  2146. X * $Log: poll_sites.c,v $
  2147. X * Revision 1.4  1993/10/30  03:28:28  aggarwal
  2148. X * Deleted code for sending signal to watchdog. Now uses the
  2149. X * libnocol.a update_event() call.
  2150. X *
  2151. X * Revision 1.3  1992/06/15  17:05:13  aggarwal
  2152. X * Added '=' in the if(tp <= 0)
  2153. X *
  2154. X * Revision 1.2  1992/06/12  21:14:17  aggarwal
  2155. X * Changed the bps returned by tpmon to Kbps.
  2156. X *
  2157. X * Revision 1.1  1992/06/12  04:07:29  aggarwal
  2158. X * Initial revision
  2159. X *
  2160. X */
  2161. X
  2162. X/* Copyright 1992 JvNCnet, Princeton */
  2163. X
  2164. X
  2165. X#include "nocol.h"            /*    common structures    */
  2166. X#include "tpmon.h"            /* program specific defines */
  2167. X
  2168. X#include <signal.h>
  2169. X#include <sys/file.h>
  2170. X#include <arpa/nameser.h>
  2171. X
  2172. X/*
  2173. X * Macro to escalate the severity of a site.
  2174. X * Change E_CRITICAL to E_ERROR if you don't want this program to put
  2175. X * events in the critical state.
  2176. X */
  2177. Xstatic int maxseverity = E_WARNING ; /* Max severity of events from tpmon */
  2178. X
  2179. X/* #defines for finish_status */
  2180. X#define REACHED_EOF 1
  2181. X#define READ_ERROR 2
  2182. X
  2183. Xpoll_sites(fdout)
  2184. X     int fdout;                /* Descriptors to open files    */
  2185. X{
  2186. X  extern int debug;            /* Enable debug (in pingmon.h)    */
  2187. X  static FILE *p_cmd;            /* for creating the ping cmd    */
  2188. X  EVENT v;                    /* described in nocol.h        */
  2189. X  char line[MAXLINE];             /* to create the ping command    */
  2190. X  struct tm *ltime ;    
  2191. X  time_t locclock ;            /* careful: don't use 'long'    */
  2192. X  long status;                       /* site status            */
  2193. X  int bufsize;                /* for reading in file */
  2194. X  long tp;
  2195. X
  2196. X  if ( lseek(fdout, (off_t)0, L_SET) == -1) { /* rewind the file    */
  2197. X    perror (prognm);
  2198. X    return (-1);
  2199. X  }
  2200. X
  2201. X  /* 
  2202. X   * until end of the file or erroneous data... one entire pass
  2203. X   */
  2204. X
  2205. X  while ( (bufsize = read (fdout, (char *)&v, sizeof(v))) == sizeof(v) )
  2206. X  {
  2207. X    /* all these default parameters are #defined in tpmon.h */
  2208. X    tp = (long)throughput(v.site.addr, PORT_NUMBER, NUM_BYTES, BLOCKSIZE,
  2209. X       PATTERN, RUN_TIME, debug);
  2210. X
  2211. X    tp = tp /1000L ;            /* convert bits into Kbits */
  2212. X
  2213. X    if (tp <= 0) /* some error occurred for this site */
  2214. X    {
  2215. X      v.nocop = SETF_UPDOUN(v.nocop, n_DOWN) ;    /* mark as down, dont log */
  2216. X      continue;                    /* keep old value */
  2217. X    }
  2218. X
  2219. X    /* Here if we have a thruput value */
  2220. X
  2221. X    if (tp < v.var.threshold)        /* if bad, then raise the severity */
  2222. X      status = 0;
  2223. X    else
  2224. X      status = 1;
  2225. X    update_event(&v, status, tp, maxseverity) ;
  2226. X
  2227. X    /* Now rewind to start of present record and write to the file    */
  2228. X     
  2229. X    lseek(fdout,-(off_t)sizeof(v), SEEK_CUR);
  2230. X    write (fdout, (char *)&v, sizeof(v));
  2231. X     
  2232. X  }    /* end of:    while (read..)    */
  2233. X    
  2234. X  /*
  2235. X   * Now determine why we broke out of the above loop
  2236. X   */
  2237. X    
  2238. X  if (bufsize == 0)            /* reached end of the file    */
  2239. X    return (1);
  2240. X  else {                /* error in output data file     */
  2241. X    fprintf (stderr, "%s: Insufficient read data in output file", prognm);
  2242. X    return (-1);
  2243. X  }
  2244. X}        /* end of:  poll_sites        */
  2245. X
  2246. END_OF_FILE
  2247.   if test 3158 -ne `wc -c <'nocol-3.0/src/tpmon/poll_sites.c'`; then
  2248.     echo shar: \"'nocol-3.0/src/tpmon/poll_sites.c'\" unpacked with wrong size!
  2249.   fi
  2250.   # end of 'nocol-3.0/src/tpmon/poll_sites.c'
  2251. fi
  2252. if test -f 'nocol-3.0/src/tpmon/tptest.1' -a "${1}" != "-c" ; then 
  2253.   echo shar: Will not clobber existing file \"'nocol-3.0/src/tpmon/tptest.1'\"
  2254. else
  2255.   echo shar: Extracting \"'nocol-3.0/src/tpmon/tptest.1'\" \(2671 characters\)
  2256.   sed "s/^X//" >'nocol-3.0/src/tpmon/tptest.1' <<'END_OF_FILE'
  2257. X.\"$Header: /nocol/src/tpmon/RCS/tptest.1,v 1.1 1992/06/18 21:22:15 aggarwal Exp $"
  2258. X.TH TPTEST 1 "June 9, 1992"
  2259. X.SH NAME
  2260. X\fBtptest\fR \- testing program for \fBtpmon.c\fR C module
  2261. X.SH SYNOPSIS
  2262. X\fBtp\fR [ \fB-v\fR ] [ \fB-b \fInumbytes\fR ]
  2263. X[ \fB-s \fIblock size\fR ]
  2264. X[ \fB-t \fIseconds\fR ]
  2265. X.if n .ti +0.25i
  2266. X[ \fB-p \fIfill pattern\fR ] [ \fB-P \fIport number\fR ]
  2267. X\fBhost\fR [ \fBhost ...\fR ]
  2268. X.SH DESCRIPTION
  2269. X\fBtptest\fR is a demonstration program to illustrate the usage of the
  2270. X\fBthroughput()\fR function in \fBtpmon.c\fR so that you can use the
  2271. X\fBthroughput()\fR function in your own programs, although I can't imagine
  2272. Xwhy you would want to.
  2273. X.PP
  2274. XThe program measures throughput for each host listed on the command line on
  2275. Xthe network by flooding the discard TCP port (usually port 9) with data.
  2276. XIt keeps track of how much data it wrote and how long it took to write
  2277. Xthis data and calculates the throughput in bits per second.
  2278. X.PP
  2279. XThe results may vary quite a bit depending on system load, so the
  2280. Xthroughput figure reported by the program should not be regarded as being too
  2281. Xreliable.
  2282. X.SH OPTIONS
  2283. X.TP 16
  2284. X.B \-v
  2285. Xselects verbose output mode
  2286. X.TP
  2287. X.BI "\-b " "numbytes"
  2288. XNumber of bytes to send
  2289. X.TP
  2290. X.BI "\-s " "block size"
  2291. XAttempt to send blocks that are \fIblock size\fR bytes long.  Default is 1024.
  2292. XNote that in order for the \fB-t\fR option to work properly, non-blocking
  2293. XI/O has to be used, so that while the program \fItries\fR to send \fIblock
  2294. Xsize\fR bytes with every call to \fBwrite(2)\fR, most of the time the actual
  2295. Xnumber of bytes written will be less than that.  Thus, changing the value
  2296. Xdefault 1024) probably will not accomplish a whole lot.  The parameter does
  2297. Xdetermine the size of the block used in pattern filling, see \fB-p\fR option
  2298. Xbelow.
  2299. X.TP
  2300. X.BI "\-t " seconds
  2301. Xsend data for
  2302. X.I seconds
  2303. Xseconds.  Note that this is probably not going to be accurate in any way
  2304. Xbecause it uses
  2305. X.B alarm(3)
  2306. Xto interrupt the sending after
  2307. X.I seconds
  2308. Xseconds.
  2309. X.TP
  2310. X.BI "\-p " "fill pattern"
  2311. Xrepeat
  2312. X.I "fill pattern"
  2313. Xto fill up the data block.  For example, if
  2314. X.I "block size"
  2315. Xis 16 and
  2316. X.I "fill pattern"
  2317. Xis
  2318. X.I foobar
  2319. Xthen the data block will be
  2320. X.IB "foobarfoobarfoob" "."
  2321. X.TP
  2322. X.BI "\-P " "port number"
  2323. Xsend the data to socket port
  2324. X.IB "port number" "."
  2325. X.SH BUGS
  2326. XIdeally if you give use both the \fB-b\fR and the \fB-t\fR options at
  2327. Xthe same time, it should stop the test after \fInumbytes\fR bytes
  2328. Xhave been sent, or \fIseconds\fR seconds have elapsed, whichever comes
  2329. Xfirst.  This may be implemented later, but currently if you specify
  2330. Xboth options at once, the \fB-b\fR option is ignored.
  2331. X.SH AUTHOR
  2332. X.nf
  2333. XS. Spencer Sun (spencer@phoenix.princeton.edu, spencer@jvnc.net)
  2334. END_OF_FILE
  2335.   if test 2671 -ne `wc -c <'nocol-3.0/src/tpmon/tptest.1'`; then
  2336.     echo shar: \"'nocol-3.0/src/tpmon/tptest.1'\" unpacked with wrong size!
  2337.   fi
  2338.   # end of 'nocol-3.0/src/tpmon/tptest.1'
  2339. fi
  2340. echo shar: End of archive 24 \(of 26\).
  2341. cp /dev/null ark24isdone
  2342. MISSING=""
  2343. for I in 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 ; do
  2344.     if test ! -f ark${I}isdone ; then
  2345.     MISSING="${MISSING} ${I}"
  2346.     fi
  2347. done
  2348. if test "${MISSING}" = "" ; then
  2349.     echo You have unpacked all 26 archives.
  2350.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2351. else
  2352.     echo You still must unpack the following archives:
  2353.     echo "        " ${MISSING}
  2354. fi
  2355. exit 0
  2356. exit 0 # Just in case...
  2357.