Debian Codegraph @

agent/mibgroup/host.h

raw
1 /*
2 * Host Resources 'wrapper' interface
3 * calls the per-group interfaces from 'hr_*.h'
4 */
5 /* Portions of this file are subject to the following copyright(s). See
6 * the Net-SNMP's COPYING file for more details and other copyrights
7 * that may apply:
8 */
9 /*
10 * Portions of this file are copyrighted by:
11 * Copyright (C) 2007 Apple, Inc. All rights reserved.
12 * Use is subject to license terms specified in the COPYING file
13 * distributed with the Net-SNMP package.
14 */
15
16 config_require(host/hr_system);
17 config_require(host/hr_device);
18 config_require(host/hr_other);
19 config_require(host/hr_proc);
20 config_require(host/hr_network);
21 config_require(host/hr_print);
22 config_require(host/hr_disk);
23 config_require(host/hr_partition);
24
25 config_version_require((host/hr_storage, 5.7, host/hrh_storage));
26 config_version_require((host/hr_filesys, 5.7, host/hrh_filesys));
27
28 config_version_require((host/hr_swinst, 5.6, host/hrSWInstalledTable));
29 config_version_require((host/hr_swrun, 5.6, host/hrSWRunTable));
30
31 /* add the host resources mib to the default mibs to load */
32 config_add_mib(HOST-RESOURCES-MIB);
33 config_add_mib(HOST-RESOURCES-TYPES);
34
35 /*********************************************
36 *
37 * A few words about the design of the Host Resources
38 * implementation - particularly as regards the hrDevice
39 * group and hrDeviceIndex. This (and hrStorageIndex) make
40 * use of the non-consecutive nature of SNMP instance identifiers.
41 *
42 * hrDeviceIndex is structured in a 'major/minor' form,
43 * with the high end indicating the type of device
44 * (following the enumerations of hrDeviceType) and the low
45 * end being used to differentiate between devices of that type.
46 *
47 * The implementation of walking through the available devices
48 * uses a pair of arrays of functions - indexed by hrDeviceType
49 * These are used to perform any initialisation needed for that
50 * type of device, and to step through the instances of that type.
51 * This latter 'get_next' routing returns the hrDeviceIndex (including
52 * the hrDeviceType major number), or -1 if there are no further
53 * instances of that type.
54 * When all devices of a particular type have been processed, the
55 * initialisation function for the next device type is called,
56 * and so on until all devices have been proceesed.
57 *
58 * Similar arrays are used to provide type-specific functions to
59 * return the "common" device information (description, ID, status
60 * and error count), and to save any internal structures needed
61 * to provide these.
62 * A final array is used to indicate whether hrDeviceIndexes are
63 * returned in a random order, or strictly increasing. In the
64 * latter case, this allows the search for a particular index to
65 * terminate as soon as the 'next' device is reached, without needing
66 * to check the rest of them. Similarly, once a particular type of
67 * device has been scanned, further types will not be examined unless
68 * a suitable index has not yet been found.
69 *
70 * The index used for hrFSIndex is also used as hrStorageIndex,
71 * for those storage areas corresponding to filestore.
72 * Additional storage areas (such as memory or swap space) are
73 * distinguished by index values greater than a defined constant.
74 * Currently these are individually defined entries, but other
75 * ranges could be implemented similarly.
76 * If hrFSIndex was re-implemented to reflect internal identifiers,
77 * it would be possible to reverse the sense of the current
78 * implementation, with non-filestore storage having indices
79 * less than a defined constant, rather than greater.
80 *
81 *
82 * Much of the detailed implementation of this group (as opposed to
83 * the implementation infrastructure outlined about) is likely to
84 * be very system-specific.
85 * The initial implementation (for HP-UX 9 and Linux) should be
86 * regarded as a 'proof of concept' example, rather than as
87 * finished, releasable code. This particularly hold for the
88 * disk device discovery code, which is gross in the extreme,
89 * and should never have seen the light of day!
90 * Hopefully this can be ripped out and given a quiet burial as
91 * soon as is decently possible.
92 *
93 * Now it's up to the rest of you to hammer this into some sort of
94 * sensible shape.
95 * Dave Shield
96 *
97 *********************************************/