Wed May 9 11:30:27 MET DST 2001
Introduction
Here is small agent in scotty for temperature and other goodies monitoring. It is just an example how such things can be done, but it works ...
It can be started under any user ID and reniced, also you can add logging capabilities to increase sec. or IP checking
To get it work you'll need tcl and scotty
This is my free time work, I hope it will be of some use
Please let me now if there are problems or errors ....
Damir Delija
Files and directories
unix.mib |
standard mib requested by agent |
carnet.mib |
many years ago our home-brew mib |
enviroment.mib |
last extension with temp modules |
df.mib |
extension to df -lk and df -oi on Solaris very simple |
iostat.mib |
extenstion to iostat -ne command on solaris |
my_agent.tcl |
tcl code it support system group and env |
Df_lib.tcl |
tcl code to start and act on df mib |
Env_lib.tcl |
tcl code to start and act on enviroment mib |
Iostat_lib.tcl |
tcl code to start and act on iostat mib |
System_lib.tcl |
tcl code to start and act on system group of mibII, just minimal! |
Sec_lib.tcl |
tcl code to control acess, based on tcp wrapper lib |
wrapper |
dir. with tcl wrapper for Sec_lib code |
Mibs
Introduction
This mibs are designed to be compatible with command output (mostly Solaris command) simple screen scrappers implementation.
Basically one or more well known command is parsed into mib values, there are always tables, control variables and timestamp variables.
All of the are read-mostly variables.
I know this is not as it must be, but it was simple, easy to do and portable.
So resulting structure is something like this
number-of-rows, (control variable) |
||
timeStampVar |
||
table |
||
rows-with-data, indexed by number of rows |
Action are simple, when agent is stated module is initialized and bound into tree. Each time controlVar is accessed new time stamp is generated and table is regenerated.
DF mib
Idea is to parse useful output of df lk and df oi into one filesyetm table capable of metadevices etc operates on solaris df -lk (data nodes) and df -oi (inodes) info
Definitions
FileSystemNumbe
r: Number of file systems on which df -lk returns stats, for controlFileSystemLastChange: The value of sysUpTime at the time the when data was last time loaded (it can be used in future as load limiter)
I decided to left percentage varibales iusedP and capacityP because they are already calculated by the command itself and they are in fact decision making data in table (I know this is heresy ..)
MountedOn |
Filesystem |
kbytes |
used |
avail |
capacityP |
iused |
ifree |
iusedP |
/ |
/dev/dsk/c0t0d0s0 |
126125 |
37833 |
75680 |
34 |
2216 |
65304 |
3 |
/var |
/dev/dsk/c0t0d0s1 |
156740 |
45776 |
95290 |
33 |
3279 |
77745 |
4 |
/usr/local |
/dev/dsk/c0t0d0s4 |
3942346 |
916885 |
2986038 |
24 |
21017 |
453863 |
4 |
/opt |
/dev/dsk/c0t0d0s5 |
549532 |
74451 |
420128 |
16 |
2596 |
280988 |
1 |
/usr |
/dev/dsk/c0t0d0s6 |
1588231 |
576570 |
964015 |
38 |
29185 |
357503 |
8 |
/home |
/dev/dsk/c0t0d0s7 |
1474979 |
585211 |
830769 |
42 |
14235 |
345317 |
4 |
/cache/cache5 |
/dev/dsk/c0t10d0s0 |
9204379 |
7681656 |
1522723 |
84 |
505179 |
1336869 |
27 |
/cache/cache6 |
/dev/dsk/c0t10d0s3 |
8180826 |
7681923 |
498903 |
94 |
486219 |
1151157 |
30 |
/cache/cache7 |
/dev/dsk/c0t8d0s0 |
9204379 |
7697890 |
1506489 |
84 |
4594 |
1347454 |
27 |
/cache/cache8 |
/dev/dsk/c0t8d0s3 |
8180826 |
7685088 |
495738 |
94 |
489489 |
1147887 |
30 |
/proc |
/proc |
0 |
0 |
0 |
0 |
|||
fd |
/dev/fd |
0 |
0 |
0 |
0 |
|||
swap |
/tmp |
993976 |
320 |
993656 |
1 |
|||
MOUNTEDON |
FILESYSTEM |
KBTOTAL |
USED |
AVAIL |
CAPACITY_PER |
IUSED |
IFREE |
ISUED_PER |
string |
string |
long |
long |
long |
0-100 (%) |
long |
long |
0-100 (%) |
Or it looks like this (logicaly):
FileSystemsTable |
||
FileSystemEntry |
||
MountedOn FileSystemD KbTotal KBuseD KBavaiL KBcapacityPer Iused Ifree IsuedPer |
Table is loaded each time as control variable FileSystemNumber is reached, so it is possible to control load on agent, or to keep snapshots
If you want snapshot, fisrt load table than reload the control variable and table again ...
Iostat mib
Definitions
Idea is to get iostat -ne output into simple index table. Iostat -ne is powerfull Solaris 2.6 and higher command ich shows erros on devices (disks, tapes, cdroms, matadevices, autovolumes etc). There is also iostat -E which prints disk ids!
Outut example:
iostat -e
---- errors --- |
||||
s/w |
h/w |
trn |
tot |
|
0 |
0 |
0 |
0 |
fd0 |
0 |
0 |
0 |
0 |
c0t0d0 |
0 |
1 |
0 |
1 |
c0t6d0 |
0 |
0 |
0 |
0 |
c0t8d0 |
0 |
0 |
0 |
0 |
c0t10d0 |
0 |
0 |
0 |
0 |
marica.srce.hr:vold(pid214) |
SoftError |
HardError |
TransientError |
------ |
DEVICE |
cAtBdCsD Contrtoler A Disk B Target C SLice (partition) D |
||||
int |
int |
int |
------ |
string |
Or it looks like this (logicaly):
ErrorsIostat |
||||
IostaDeviceTable |
||||
IostatDeviceEentry |
||||
IostatDevice |
SoftError |
HardError |
TransientError |
IoDevicesNumber: Number of devices on which iostat -e returns stats, for control
ErrorsIostatLastChange:The value of sysUpTime at the time the when iostat -e was last time loaded it can be used in future as load limiter
Damir Delija