-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.solaris
1311 lines (912 loc) · 42.8 KB
/
README.solaris
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
README.solaris
$Id$
This document describes issues relating to compiling,
installing and using net-snmp on Solaris.
0. Introduction
1. Things you will need
2. Disabling Sun's SNMP daemons
3. Compiling net-snmp
4. Obtaining and installing binaries
5. Creating snmpd.conf and testing
6. Creating your own binaries
7. Using Sun's SNMP daemon and net-snmp together
8. Monitoring disks, processes and execs (DISMAN-EVENT-MIB)
9. Monitoring CPU temp, fan and power supply sensors (LM-SENSORS-MIB)
10. MIB rewrites for IF-MIB, TCP-MIB and UDP-MIB
Additional compilation issues:
11. Files descriptors and fopen
12. Perl
13. sed
14. OpenSSL and crle
15. IPv6
16. Wish list
Other issues:
17. Known Bugs!!
18. Discussion and further information
------------------------------------------------------------
0. Introduction
This document is a compilation of information relating to
running net-snmp (www.net-snmp.org) on Sun SPARC and Ultra
hardware under the Solaris operating system.
This can be done either in conjunction with or as a
replacement for Sun's SNMP daemons.
This is discussed in detail in the sections below. Since
this is the work of several authors, credit is given.
Discussion, however, should take place on the net-snmp-users
or net-snmp-coders mailing lists so everybody can
benefit. See http://sourceforge.net/mail/?group_id=12694 .
Use "net-snmp-users" for general usage questions and "net-snmp-coders" for
discussion of net-snmp source code.
No warranty is implied by this document.
This document is copyright but usage allowed under the same
licensing as net-snmp in general. See http://www.net-snmp.org/COPYING.txt.
------------------------------------------------------------
1. Things you will need
A. Root access
Root access is required to follow pretty much any of
the steps below. At a bare minimum, you will need
to be able to start and stop daemons, which requires root
(at least for the default ports).
B. Determine existing SNMP functionality
SNMP uses ports 161 and 162 by default. Only one application
can use them at a time. If there is an existing SNMP
application (eg. Sun's snmpdx daemon) you need to either
turn this off or work around it. You may also have
a previous version of net-snmp, the older ucd-snmp, or
something completely different. The following commands:
ps -ef | grep snm
ps -ef | grep mibi
will give you a fairly good idea what is going on.
If you see something like:
root 643 1 0 Jan 16 ? 5:49 /usr/local/sbin/snmpd
that's probably a version of net-snmp. The instructions in various
sections below should give you clues on what to do next.
If you see something like:
root 16178 1 0 13:16:04 pts/2 0:00 /usr/lib/snmp/snmpdx -y -c /etc/snmp/conf
and/or
root 21371 1 0 Feb 07 ? 0:52 mibiisa -r -p 41178
then Sun's SNMP daemons are running.
If you need this, for example if you use the Solstice Enterprise
Agent, you may wish to run net-snmp as a sub-agent (see section 7).
Otherwise, you will need to disable Sun's daemons (see section 2).
Regardless you may wish to compile net-snmp from source
and install it (see sections 3, 5 and 6) or install
binaries (see sections 4 and 5).
If some other SNMP daemon is running, you will need to determine
where it came from and what it's being used for. You get clues by
typing "snmpd -v" or "snmpd --help". In some cases it may be
a subagent or agent from another application, such as ORACLE. If
you disable its agent, you will need to re-create this functionality
under net-snmp (eg. by running it as a sub-agent). ORACLE's SNMP
functionality is turned on by default and may be unnecessary if
you aren't using ORACLE's Enterprise Manager. Refer to ORACLE's
documentation on how to disable it.
If you have decided to compile your own net-snmp, you will need ...
C. A compilation environment
-a compiler (gcc or Sun's Forte cc) or the gcc libraries
(note, the cc in /usr/ucb is NOT a full-blown compiler)
-OpenSSL (sunfreeware.com or source www.openssl.org)
-zlib (sunfreeware.com or source www.gzip.org/zlib/)
-an SNMP community string ("public" is deprecated)
If you are installing on a development machine, it may be best
to compile OpenSSL and zlib from source, otherwise
obtain the appropriate zlib for your platform from sunfreeware
and install (it goes to /usr/local automatically).
Obtain the appropriate OpenSSL for your platform from sunfreeware
and install (it goes to /usr/local), you may need the gcc libraries.
These libraries should not need to be installed if you are using
binaries, but your mileage may vary. Note the library problem
with libcrypto noted below (section 14).
There are two choices for compilers. Sun has a Forte development
suite that includes a standalone C compiler. If you have it, it
is likely installed in /opt/SUNWspro/bin.
The more common choice is gcc (2.95.3 or better have been tested)
available from sunfreeware.com. If you install gcc, you do not
need the gcc libraries. 3.3.2 or later is recommended.
Given that net-snmp is developed to work on a wide variety of
platforms, but especially for linux, there's a better chance of
it working using gcc at any given time. We also do regular test
builds with Sun cc, though.
-- Bruce Shaw <Bruce.Shaw at shaw.ca>
-- Thomas Anders <[email protected]>
------------------------------------------------------------
2. Disabling Sun's SNMP daemons
Note: Sun has started to include net-snmp (version 5.0.9 plus their
patches) with Solaris 10 and later. These instructions are written
with Solaris 9 and previous in mind.
Out of the box, Sun runs four SNMP daemons: mibiisa, idmispd,
snmpXdmid and snmpdx.
These must be disabled before running net-snmp unless you are planning
on running them together (see Section 7 below). Here is the procedure:
cd /etc/rc3.d
./S76snmpdx stop
./S77dmi stop
mv S76snmpdx s76snmpdx
mv S77dmi s77dmi
If you are using Solstice Disksuite, you may also be running
mdlogd. Leave this alone.
You will need to create a new script to start net-snmp.
See dist/snmpd-init.d and dist/snmptrapd-init.d for templates.
-- Bruce Shaw <Bruce.Shaw at shaw.ca>
------------------------------------------------------------
3. Compiling net-snmp
It is strongly recommended that you compile net-snmp from source.
That way you are guaranteed a working version for your specific
configuration of operating system, applications and libraries.
If, for some reason, you cannot compile on a specific machine,
there are binaries available for download (see section 4).
In addition, you may create your own binaries (see section 6).
You need to set your $PATH. This is extremely important
because otherwise there may be conflicts between the various
components of the development environment.
If you are using FORTE:
PATH=/usr/bin:/usr/sbin:/usr/ccs/bin:/opt/SUNWspro/bin:/usr/local/bin:
If you are using gcc (installed in /usr/local/bin):
PATH=/usr/sbin:/usr/local/bin:/usr/ccs/bin:/usr/bin
Obtain a current version of net-snmp (which, if you're reading this,
presumably you have - don't you love recursion?) www.net-snmp.org/download/
Uncompress it and untar it in a working directory eg. /usr/local/src/net-snmp
In order to save a lot of typing, you should create a "configure"
script eg. bcc.sh in the directory below eg. /usr/local/src.
./configure --with-mib-modules="ucd-snmp/lmSensors ucd-snmp/diskio \
smux mibII/mta_sendmail" --with-cc=gcc
(note, see the long discussion about Perl below)
(note, substitute "cc" for "gcc" as appropriate)
(note, for LM-SENSORS-MIB support, see discussion below)
then call this script from the net-snmp directory ie ../bcc.sh
and answer the appropriate questions (usually with the default).
When it completes, you should see something like:
---------------------------------------------------------
Net-SNMP configuration summary:
---------------------------------------------------------
Net-SNMP Version: 5.4
Building for: solaris2
Network transport support: Callback Unix TCP UDP
SNMPv3 Security Modules: usm
Agent MIB code: mibII ucd_snmp snmpv3mibs notification target
\agent_mibs agentx agent_mibs utilities host disman/event-mib
\ucd-snmp/diskio smux agentx mibII/mta_sendmail
SNMP Perl modules: disabled
Embedded perl support: disabled
Authentication support: MD5 SHA1
Encryption support: DES
Type:
make
and watch for compile errors.
You will receive numerous warnings. This is normal,
a side effect of supporting a variety of development environments.
Now type:
make test
and watch for failures. Also watch for the special tests for Solaris.
If you are satisfied with the tests, stop any snmpd daemons
that may be running (see section 2) and type:
make install
When complete, go on to section 5 below.
-- Bruce Shaw <Bruce.Shaw at shaw.ca>
------------------------------------------------------------
4. Obtaining and installing binaries
It is strongly recommended that you compile net-snmp from source.
That way you are guaranteed a working version for your specific
configuration of operating system, applications and libraries.
Binaries for Solaris may be found in two locations.
www.sunfreeware.com - this installs as a package.
It does not have Perl support.
Therefore, I recommend:
http://net-snmp.sourceforge.net/download/ (you will be redirected)
This is the official repository for binaries.
To determine which binary you need, you will need several pieces of
information.
-operating system version,
-hardware platform
-net-snmp version desired
The first two may be obtained by typing:
uname -a
It will return something like:
SunOS foo 5.8 Generic_108528-14 sun4u sparc SUNW,Ultra-4
5.8 means Solaris 8
5.7 means Solaris 7 etc.
"sun4u" is the Ultra hardware platform
"sun4m" is SuperSPARC eg. Sparc 5 or Sparc 10
"sun4d" is older SPARC boxes.
You can then decode the binary version by its name eg.:
net-snmp_5.0.9-SunOS_5.8_sun4u.tar.gz
means "net-snmp version 5.0.9 for Solaris 8 running on Ultra
hardware".
Once you have found the appropriate version, download it to a
distribution directory (making one if necessary) eg. /usr/local/dist
Type the following: (using the sample above)
cd /
tar -xvf /usr/local/dist/net-snmp-5.0.9-SunOS_5.8_sun4u.tar
The binaries, libraries, etc. will be installed in /usr/local.
Remove the tar file to save space. Create an snmpd.conf (see below)
or use an existing one from another machine.
It installs in /usr/local/share/snmp.
Install a startup script (see section 1).
For further information, see README.solaris.binaries.x that ships
with the binaries.
--Bruce Shaw <Bruce.Shaw at shaw.ca>
------------------------------------------------------------
5. Creating snmpd.conf and testing
When everything is installed, run:
snmpconf -g basic_setup
and answer the questions appropriately. If you are using
the defaults, place the resulting snmpd.conf file in:
/usr/local/share/snmp/snmpd.conf
A security note - use of the "public" community is deprecated.
This example uses "whatever" as a community.
When you have the daemon running either with the script above or running:
/usr/local/sbin/snmpd
test the daemon's functionality by typing:
snmpget -v 1 -c whatever localhost sysUpTime.0
snmpwalk -v 2c -c whatever -m ALL localhost .1.3 | more
and paging through the results.
If you have problems, you can examine diagnostic messages
by running:
/usr/local/sbin/snmpd -f -Le
or use gdb (available from www.sunsolve.com) as follows:
cd /usr/local/sbin
gdb snmpd
run -f -Le
and when it blows up:
bt
to get the backtrace.
You can use:
run -f -Le -D <modulename>
to display debug messages.
To display all debug messages type:
run -f -Le -D ALL
but this will be extremely verbose.
-- Bruce Shaw <Bruce.Shaw at shaw.ca> with suggestions by Thushara Wickram
------------------------------------------------------------
6. Creating your own binaries
Pick an appropriate name for a tarfile
eg. net-snmp-5.4.custom-SunOS_5.8_sun4u.tar (see above)
(this particular one means "a customized version of
net-snmp 5.4 that works under Solaris 8 running on Ultra hardware")
Create an empty directory such as /usr/local/dist, then do the following
from the source directory (using the example above):
make install prefix=/usr/local/dist/usr/local \
exec_prefix=/usr/local/dist/usr/local
cd /usr/local/dist
tar -cvf net-snmp-5.4.custom-SunOS_5.8_sun4u.tar usr
Transfer this file to the machine where you want to install from binary.
Place it in a distribution directory eg. /usr/local/dist
Type the following (using the example above):
cd /
tar -xvf /usr/local/dist/net-snmp-5.4.custom-SunOS_5.8_sun4u.tar
Remove the tar file to save space. Create an snmpd.conf (see above)
or use an existing one from another machine. If you are using
the defaults, it installs in /usr/local/share/snmp. Install
a startup script (see section 2).
Note that if you create a binary with Perl support (see below) an
identically configured Perl needs to be installed as well.
-- Bruce Shaw <Bruce.Shaw at shaw.ca>
------------------------------------------------------------
7. Using Sun's SNMP daemon and net-snmp together
Net-SNMP may be used as a subagent in conjunction with Sun's snmpdx daemon.
To do this, you will need to modify several files,
all located in /etc/snmp/conf.
First, do the following:
/etc/rc3.d/S76snmpdx stop (assuming you haven't done so already, and...)
/etc/rc3.d/S77dmi stop (...assuming you haven't renamed them)
cd /etc/snmp/conf
cp snmpd.conf snmpd.conf.orig
cp snmpdx.acl snmpdx.acl.orig
cp snmpdx.reg snmpdx.reg.orig
cp snmpdx.rsrc snmpdx.rsrc.orig
cp mibiisa.reg mibiisa.reg.orig
cp mibiisa.rsrc mibiisa.rsrc.orig
modify snmpd.conf with the correct:
sysdescr
syscontact
sysLocation
system-group-read-community
read-community (in my example below I will use community "whatever")
trap
trap-community
managers (leave blank for all)
modify snmpdx.acl with the correct:
trap-community
trap-recipients
communities
access
Make sure that in snmpdx.reg the port is 161.
You will now need to add two files - net-snmp.reg and net-snmp.rsrc
In this example, "subtrees" is set for HOST-RESOURCES-MIB, and UCD-SNMP-MIB.
Do not use net-snmp's MIB-2 information as this is already provided by
Sun's mib and may cause a conflict.
::::: net-snmp.reg ::::::
# net-snmp.reg
# mib-2 is already provided by the mibiisa process
# that is a default sub agent of snmpdx
# we are specifying only hostmib and ucd
##########
# agents #
##########
# The following 3 macros are predefined:
#
# mib-2 = 1.3.6.1.2.1
# enterprise = 1.3.6.1.4.1
# sun = 1.3.6.1.4.1.42
#
# You can define your own macros, so that you can
# manipulate strings instead of OIDs in defining the agent.
# See the "agent" section below.
macros =
{
host = mib-2.25
ucd = enterprise.2021
}
agents =
{
{
name = "net-snmp"
subtrees = { host,ucd }
timeout = 2000000
watch-dog-time = 86400
}
}
::::::::::::::::::
::::: net-snmp.rsrc ::::::
# /etc/snmp/conf/net-snmp.rsrc
resource =
{
{
registration_file = "/etc/snmp/conf/net-snmp.reg"
policy = "spawn"
type = "legacy"
command = "/usr/local/sbin/snmpd $PORT"
}
}
::::::::::::::::::
Stop any net-snmp processes that may be running.
Start Sun's daemons by typing:
/etc/rc3.d/S76snmpdx start (assuming you haven't renamed it)
/etc/rc3.d/S77dmi start (assuming you haven't renamed it)
Wait a moment for everything to stabilize, then try these two queries:
snmpget -v 1 -c whatever localhost sysDescr.0
snmpget -v 1 -c whatever localhost hrSystemUptime.0
You should see something like:
SNMPv2-MIB::sysDescr.0 = STRING: SunOS foo 5.6 Generic_105181-30 sun4u
which is Sun's daemon talking, and:
HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (78540910) 9 days, 2:10:09.10
which is net-snmp talking. It is acting as a sub-agent through Sun's daemon.
If Sun's daemons fail, you will need to shut down the snmpd daemons by typing:
pkill snmpd
Then do the following:
/etc/rc3.d/S76snmpdx stop (assuming you haven't renamed it)
/etc/rc3.d/S77dmi stop (assuming you haven't renamed it)
/etc/rc3.d/S76snmpdx start (assuming you haven't renamed it)
/etc/rc3.d/S77dmi start (assuming you haven't renamed it)
rather than trying to individually clobber all the various Sun daemons.
This configuration appears to deal properly with snmpgets
and handle mistakes gracefully.
Beyond this, your mileage may vary.
You may wish to modify the subtrees in net-snmp.reg as you find things
that do and don't work. Remember to keep backup copies of working
configurations.
-- Bruce Shaw <Bruce.Shaw at shaw.ca> from notes by Stefan Radman and C Wells
------------------------------------------------------------
8. Monitoring disks, processes and execs (DISMAN-EVENT-MIB)
Important note: this section only applies to the old DISMAN-EVENT-MIB
implementation called "disman/event-mib", *not* the current "disman/event"
mib module which is active by default since net-snmp 5.3 and later.
For a full explanation of using DISMAN-EVENT-MIB, see:
http://www.net-snmp.org/man/snmpd.conf.html
To use this component, net-snmp must be compiled with the option..
--with-mib-modules="disman/event-mib"
This discussion concerns the use of DISMAN-EVENT-MIB with Solaris.
There is a bug preventing the use of some of its functionality. This
discussion will document what is known to work and how to use it.
The problem revolves around the use of monitors. The...
defaultMonitors yes
token will NOT work for reasons discussed below. I suspect that the
notificationEvent tokens will not work for the same reason but this
has not been tested. Your mileage may vary. Same with includeAllDisks.
The documentation suggests using...
monitor -o prNames -o prErrMessage "process table" prErrorFlag != 0
to monitor all processes. This will fail with ambiguous results.
To monitor processes, put a separate monitor line for each process.
For example:
######
proc smail
proc mdlogd
monitor -r 30 -i -o prNames.1 -o prErrMessage.1 "Process smail" prErrorFlag.1 !=0
monitor -r 30 -i -o prNames.2 -o prErrMessage.2 "Process Solstice Disksuite SNMP trap" prErrorFlag.2 !=0
To monitor disks, do the same. An example:
########
# This example sends a trap if root has less than 10% available and /usr6 less t
han 90%
#
disk / 10%
disk /usr6 90%
monitor -i -r 30 -o dskPath.1 -o dskErrorMsg.1 "root file system" dskErrorFlag.1 !=0
monitor -i -r 30 -o dskPath.2 -o dskErrorMsg.2 "ORACLE file system" dskErrorFlag.2 != 0
#########
To implement an external program then monitor its results you need to set up your script.
Here is a sample script.
#!//usr/bin/ksh
xstatus=0
if [ $xstatus -eq 0 ];then
echo success: $0
else
echo FAILURE: $0
fi
exit $xstatus
###end of script tester##
Place this script in /usr/local/src and make it executable. Make copies called
tester1, tester2 etc.
and make them executable.
Here is a sample snmpd.conf snippet that makes use of the exec feature:
##############
exec tester1 /usr/local/src/tester1
exec tester2 /usr/local/src/tester2
exec tester3 /usr/local/src/tester3
exec tester4 /usr/local/src/tester4
exec tester5 /usr/local/src/tester5
monitor -i -r 60 -o extNames.1 -o extOutput.1 "status table 1" extResult.1 != 0
monitor -i -r 60 -o extNames.2 -o extOutput.2 "status table 2" extResult.2 != 0
monitor -i -r 60 -o extNames.3 -o extOutput.3 "status table 3" extResult.3 != 0
monitor -i -r 60 -o extNames.4 -o extOutput.4 "status table 4" extResult.4 != 0
monitor -i -r 60 -o extNames.5 -o extOutput.5 "status table 5" extResult.5 != 0
##############
While snmpd is running, go to /usr/local/src and modify one of the tester programs eg. tester1
xstatus=1
and save the file. Sometime in the next 60 seconds, a trap will be generated.
Change the value back to 0, then modify another file.
If you are unsure of the correct row number within a specific table, do an snmpwalk eg.
snmpwalk -v 2c -c public -m ALL localhost prNames
The same methodology can presumably be used for fileName and laNames. Your mileage may vary.
-- Bruce Shaw <Bruce.Shaw at shaw.ca> with Allan McIntosh and Wes Hardaker
------------------------------------------------------------
9. Monitoring CPU temp, fan and power supply sensors (LM-SENSORS-MIB)
Note: This module (ucd-snmp/lmSensors) works in "read only" mode to examine
sensors. It cannot change switch or fan settings.
It has been tested at least on the following platforms:
Enterprise 450
V880
280R
If you have information about other platforms this is desperately needed. For
example, the only "state" that I'm aware of for an i2c is "OK". The more
information we have, the richer the components.
Please report any performance statistics, bugs or omissions to the users list.
Please report any code suggestions to the coders list. See links below.
This component delivers information that you would normally see by typing:
/usr/platform/`uname -m`/sbin/prtdiag -v
At present this is only supported on the Ultra (sun4u) platform.
To display this information, net-snmp must be compiled with the option:
--with-mib-modules="ucd-snmp/lmSensors"
Early Ultra servers such as the Ultra 1 or Ultra 2 did not report
any sensor information at all. Later servers, such as the Enterprise 450
reported this information using kstat. Sun's latest servers make use
of the picld daemon to control system resources and report fan information.
This module reads in the information from picld. It cannot modify settings.
You can see this information by typing:
prtpicl -v | more
The following is typical output from net-snmp:
E450# snmpwalk -v 2c -c public -m ALL localhost lmSensors
LM-SENSORS-MIB::lmTempSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmTempSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmTempSensorsIndex.3 = INTEGER: 2
LM-SENSORS-MIB::lmTempSensorsIndex.4 = INTEGER: 3
LM-SENSORS-MIB::lmTempSensorsDevice.1 = STRING: Ambient
LM-SENSORS-MIB::lmTempSensorsDevice.2 = STRING: CPU1
LM-SENSORS-MIB::lmTempSensorsDevice.3 = STRING: CPU2
LM-SENSORS-MIB::lmTempSensorsDevice.4 = STRING: CPU3
LM-SENSORS-MIB::lmTempSensorsValue.1 = Gauge32: 22
LM-SENSORS-MIB::lmTempSensorsValue.2 = Gauge32: 45
LM-SENSORS-MIB::lmTempSensorsValue.3 = Gauge32: 46
LM-SENSORS-MIB::lmTempSensorsValue.4 = Gauge32: 49
LM-SENSORS-MIB::lmFanSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmFanSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmFanSensorsIndex.3 = INTEGER: 2
LM-SENSORS-MIB::lmFanSensorsDevice.1 = STRING: fan type CPU number 0
LM-SENSORS-MIB::lmFanSensorsDevice.2 = STRING: fan type PWR number 0
LM-SENSORS-MIB::lmFanSensorsDevice.3 = STRING: fan type AFB number 0
LM-SENSORS-MIB::lmFanSensorsValue.1 = Gauge32: 33
LM-SENSORS-MIB::lmFanSensorsValue.2 = Gauge32: 31
LM-SENSORS-MIB::lmFanSensorsValue.3 = Gauge32: 63
LM-SENSORS-MIB::lmVoltSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmVoltSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmVoltSensorsIndex.3 = INTEGER: 2
LM-SENSORS-MIB::lmVoltSensorsDevice.1 = STRING: power supply 0
LM-SENSORS-MIB::lmVoltSensorsDevice.2 = STRING: power supply 1
LM-SENSORS-MIB::lmVoltSensorsDevice.3 = STRING: power supply 2
LM-SENSORS-MIB::lmVoltSensorsValue.1 = Gauge32: 38
LM-SENSORS-MIB::lmVoltSensorsValue.2 = Gauge32: 39
LM-SENSORS-MIB::lmVoltSensorsValue.3 = Gauge32: 39
LM-SENSORS-MIB::lmMiscSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmMiscSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmMiscSensorsIndex.3 = INTEGER: 2
LM-SENSORS-MIB::lmMiscSensorsDevice.1 = STRING: FSP
LM-SENSORS-MIB::lmMiscSensorsDevice.2 = STRING: Backplane4
LM-SENSORS-MIB::lmMiscSensorsDevice.3 = STRING: Backplane8
LM-SENSORS-MIB::lmMiscSensorsValue.1 = Gauge32: 192
LM-SENSORS-MIB::lmMiscSensorsValue.2 = Gauge32: 0
LM-SENSORS-MIB::lmMiscSensorsValue.3 = Gauge32: 0
V880# snmpwalk -v 2c -c public -m ALL localhost lmSensors
LM-SENSORS-MIB::lmTempSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmTempSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmTempSensorsIndex.3 = INTEGER: 2
LM-SENSORS-MIB::lmTempSensorsIndex.4 = INTEGER: 3
LM-SENSORS-MIB::lmTempSensorsIndex.5 = INTEGER: 4
LM-SENSORS-MIB::lmTempSensorsIndex.6 = INTEGER: 5
LM-SENSORS-MIB::lmTempSensorsIndex.7 = INTEGER: 6
LM-SENSORS-MIB::lmTempSensorsIndex.8 = INTEGER: 7
LM-SENSORS-MIB::lmTempSensorsIndex.9 = INTEGER: 8
LM-SENSORS-MIB::lmTempSensorsIndex.10 = INTEGER: 9
LM-SENSORS-MIB::lmTempSensorsDevice.1 = STRING: CPU0_DIE_TEMPERATURE_SENSOR
LM-SENSORS-MIB::lmTempSensorsDevice.2 = STRING: CPU2_DIE_TEMPERATURE_SENSOR
LM-SENSORS-MIB::lmTempSensorsDevice.3 = STRING: CPU1_DIE_TEMPERATURE_SENSOR
LM-SENSORS-MIB::lmTempSensorsDevice.4 = STRING: CPU3_DIE_TEMPERATURE_SENSOR
LM-SENSORS-MIB::lmTempSensorsDevice.5 = STRING: CPU4_DIE_TEMPERATURE_SENSOR
LM-SENSORS-MIB::lmTempSensorsDevice.6 = STRING: CPU6_DIE_TEMPERATURE_SENSOR
LM-SENSORS-MIB::lmTempSensorsDevice.7 = STRING: MB_AMB_TEMPERATURE_SENSOR
LM-SENSORS-MIB::lmTempSensorsDevice.8 = STRING: IOB_AMB_TEMPERATURE_SENSOR
LM-SENSORS-MIB::lmTempSensorsDevice.9 = STRING: DBP0_AMB_TEMPERATURE_SENSOR
LM-SENSORS-MIB::lmTempSensorsDevice.10 = STRING: DBP1_AMB_TEMPERATURE_SENSOR
LM-SENSORS-MIB::lmTempSensorsValue.1 = Gauge32: 71
LM-SENSORS-MIB::lmTempSensorsValue.2 = Gauge32: 60
LM-SENSORS-MIB::lmTempSensorsValue.3 = Gauge32: 66
LM-SENSORS-MIB::lmTempSensorsValue.4 = Gauge32: 59
LM-SENSORS-MIB::lmTempSensorsValue.5 = Gauge32: 65
LM-SENSORS-MIB::lmTempSensorsValue.6 = Gauge32: 69
LM-SENSORS-MIB::lmTempSensorsValue.7 = Gauge32: 28
LM-SENSORS-MIB::lmTempSensorsValue.8 = Gauge32: 25
LM-SENSORS-MIB::lmTempSensorsValue.9 = Gauge32: 25
LM-SENSORS-MIB::lmTempSensorsValue.10 = Gauge32: 24
LM-SENSORS-MIB::lmFanSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmFanSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmFanSensorsIndex.3 = INTEGER: 2
LM-SENSORS-MIB::lmFanSensorsIndex.4 = INTEGER: 3
LM-SENSORS-MIB::lmFanSensorsIndex.5 = INTEGER: 4
LM-SENSORS-MIB::lmFanSensorsIndex.6 = INTEGER: 5
LM-SENSORS-MIB::lmFanSensorsIndex.7 = INTEGER: 6
LM-SENSORS-MIB::lmFanSensorsIndex.8 = INTEGER: 7
LM-SENSORS-MIB::lmFanSensorsIndex.9 = INTEGER: 8
LM-SENSORS-MIB::lmFanSensorsIndex.10 = INTEGER: 9
LM-SENSORS-MIB::lmFanSensorsDevice.1 = STRING: CPU0_PFAN_TACH
LM-SENSORS-MIB::lmFanSensorsDevice.2 = STRING: CPU1_PFAN_TACH
LM-SENSORS-MIB::lmFanSensorsDevice.3 = STRING: CPU0_SFAN_TACH
LM-SENSORS-MIB::lmFanSensorsDevice.4 = STRING: CPU1_SFAN_TACH
LM-SENSORS-MIB::lmFanSensorsDevice.5 = STRING: IO_BRIDGE_PFAN_TACH
LM-SENSORS-MIB::lmFanSensorsDevice.6 = STRING: IO_BRIDGE_SFAN_TACH
LM-SENSORS-MIB::lmFanSensorsDevice.7 = STRING: IO0_PFAN_TACH
LM-SENSORS-MIB::lmFanSensorsDevice.8 = STRING: IO1_PFAN_TACH
LM-SENSORS-MIB::lmFanSensorsDevice.9 = STRING: IO0_SFAN_TACH
LM-SENSORS-MIB::lmFanSensorsDevice.10 = STRING: IO1_SFAN_TACH
LM-SENSORS-MIB::lmFanSensorsValue.1 = Gauge32: 2439
LM-SENSORS-MIB::lmFanSensorsValue.2 = Gauge32: 2586
LM-SENSORS-MIB::lmFanSensorsValue.3 = Gauge32: 2459
LM-SENSORS-MIB::lmFanSensorsValue.4 = Gauge32: 2564
LM-SENSORS-MIB::lmFanSensorsValue.5 = Gauge32: 3409
LM-SENSORS-MIB::lmFanSensorsValue.6 = Gauge32: 0
LM-SENSORS-MIB::lmFanSensorsValue.7 = Gauge32: 3947
LM-SENSORS-MIB::lmFanSensorsValue.8 = Gauge32: 3896
LM-SENSORS-MIB::lmFanSensorsValue.9 = Gauge32: 4000
LM-SENSORS-MIB::lmFanSensorsValue.10 = Gauge32: 3896
LM-SENSORS-MIB::lmVoltSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmVoltSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmVoltSensorsIndex.3 = INTEGER: 2
LM-SENSORS-MIB::lmVoltSensorsIndex.4 = INTEGER: 3
LM-SENSORS-MIB::lmVoltSensorsIndex.5 = INTEGER: 4
LM-SENSORS-MIB::lmVoltSensorsIndex.6 = INTEGER: 5
LM-SENSORS-MIB::lmVoltSensorsIndex.7 = INTEGER: 6
LM-SENSORS-MIB::lmVoltSensorsIndex.8 = INTEGER: 7
LM-SENSORS-MIB::lmVoltSensorsIndex.9 = INTEGER: 8
LM-SENSORS-MIB::lmVoltSensorsIndex.10 = INTEGER: 9
LM-SENSORS-MIB::lmVoltSensorsIndex.11 = INTEGER: 10
LM-SENSORS-MIB::lmVoltSensorsIndex.12 = INTEGER: 11
LM-SENSORS-MIB::lmVoltSensorsDevice.1 = STRING: PS0_3_3V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.2 = STRING: PS0_5V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.3 = STRING: PS0_12V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.4 = STRING: PS0_48V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.5 = STRING: PS1_3_3V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.6 = STRING: PS1_5V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.7 = STRING: PS1_12V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.8 = STRING: PS1_48V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.9 = STRING: PS2_3_3V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.10 = STRING: PS2_5V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.11 = STRING: PS2_12V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsDevice.12 = STRING: PS2_48V_I_SENSOR
LM-SENSORS-MIB::lmVoltSensorsValue.1 = Gauge32: 6
LM-SENSORS-MIB::lmVoltSensorsValue.2 = Gauge32: 4
LM-SENSORS-MIB::lmVoltSensorsValue.3 = Gauge32: 3
LM-SENSORS-MIB::lmVoltSensorsValue.4 = Gauge32: 4
LM-SENSORS-MIB::lmVoltSensorsValue.5 = Gauge32: 6
LM-SENSORS-MIB::lmVoltSensorsValue.6 = Gauge32: 4
LM-SENSORS-MIB::lmVoltSensorsValue.7 = Gauge32: 3
LM-SENSORS-MIB::lmVoltSensorsValue.8 = Gauge32: 4
LM-SENSORS-MIB::lmVoltSensorsValue.9 = Gauge32: 6
LM-SENSORS-MIB::lmVoltSensorsValue.10 = Gauge32: 4
LM-SENSORS-MIB::lmVoltSensorsValue.11 = Gauge32: 3
LM-SENSORS-MIB::lmVoltSensorsValue.12 = Gauge32: 4
This component also reports information for switches, LEDs
and i2c's (devices accessing the i2c bus).
Because the MIB only allows us to display numeric
information a certain amount of translation has been done.
Switches:
0 = OFF
1 = ON
2 = NORMAL
3 = LOCKED
4 = UNKNOWN
5 = DIAG
6 = SECURE
99 = other
LEDs:
0 = OFF
1 = ON
2 = BLINK (this may not exist)
99 = other
i2c's:
0 = OK
99 = other
In order to prevent inordinant consumption of machine resources,
some sensor information is cached. Currently, information
retrieved from picld is cached for six seconds.
-- Bruce Shaw <Bruce.Shaw at shaw.ca>
------------------------------------------------------------
10. MIB rewrites for IF-MIB, TCP-MIB and UDP-MIB
net-snmp 5.4 has started to include rewrites for the IF-MIB, TCP-MIB and
UDP-MIB implementations. They need to be explicitely enabled, though:
./configure --enable-mfd-rewrites ...
See the Net-SNMP Wiki (http://www.net-snmp.org/wiki/index.php/IF-MIB_rewrite)
for further details.
Thanks to Sun for the excellent patches.
-- Thomas Anders <[email protected]>
------------------------------------------------------------
11. Files descriptors and fopen
Solaris has a limitation on the number of file descriptors (255)
available in stdio, so that fopen() fails if more than
255 file descriptors (sockets) are open. This prevents mibs from
being loaded after 250 sockets are open, since parse.c uses stdio.
SEan <[email protected]> investigated this problem, and had this
report on using the SFIO package to solve this problem.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The SFIO package ( http://www.research.att.com/sw/tools/sfio/ )
is a buffered streams IO package that is much more more sophisticated
than stdio, but it does support stdio API's for backward compatibility,
and that's the aspect that is important here.
To compile with SFIO, we simply add -I/usr/local/sfio/include to the
$CPPFLAGS before compiling net-snmp. This causes SFIO's stdio.h to
preempt Solaris stdio, mapping calls like fopen() and fprintf() to
the SFIO implementations. This produces a libnetsnmp that does not
have the fopen() limitation. Any application that links to this
libnetsnmp must also be linked to libsfio.
Here are the two caveats:
A. libsfio exports the functions 'getc' and 'putc', for reasons that
are not clear. These are the only symbols it exports that conflict
with stdio. While getc and putc are traditionally macros, Solaris
makes them functions in multithreaded code (compiled with -mt,
-pthread, or -D_REENTRANT). If your native stdio code links to the
libsfio versions, a crash will result.
There are two solutions to this problem. You may remove getc and putc
from libsfio, since SFIO defines getc and putc as macros, by doing:
ar d libsfio.a getc.o
ar d libsfio.a putc.o
or link to SFIO's stdio compatibility library, libstdio, ahead of
libsfio. This library wraps all of the native stdio calls with
versions that are safe for native or sfio streams, in case you
need to share streams between SFIO and native stdio codes.
B. libsfio provides 64-bit offsets in fseek(), ftell(). This is
a good thing, since SFIO is intended to avoid needless limitations,
but it means that SFIO's stdio.h defines off_t to be a 64-bit offset.
Net-SNMP uses readdir(), which returns a struct dirent containing
a 32-bit off_t, so the code compiled for SFIO doesn't access
struct dirent's correctly.
There are two solutions to this problem, as well. The first is to
include <dirent.h> at the start of SFIO's stdio.h. Since SFIO
defines a macro substitution for off_t, this leaves struct dirent's
definition unchanged.
An alternative, which I haven't verified, is to define _FILE_OFFSET_BITS
to be 64 when compiling libnetsnmp. According to what I see in Solaris's
/usr/include/sys/feature_tests.h, you can select a 64-bit off_t at
compile time with this setting, which should make readdir()'s off_t
compatible with SFIO's ftell(), fseek().
[[ We have received reports that this approach does not in fact work
(see Perl discussion below)]]
Finally, thanks to Phong Vo and AT&T Labs for a fast, robust and
portable package that solves this headache very neatly.
-SEan <[email protected]>
------------------------------------------------------------
12. Perl
Net-SNMP may be compiled with Perl support by configuring like:
./configure -enable-embedded-perl ...
This should only be done if you are sure you really need Perl,
for the following reasons:
Solaris 8 and later ship with a version of Perl compiled using Sun's cc.