*SNMPD のインストール[#aaaf4c90]
# cd /usr/ports/net-mgmt/net-snmp/
# make install
**** This port installs snmp daemon, header files and libraries but don't
invokes snmpd by default.
If you want to invoke snmpd and/or snmptrapd at startup, put these
lines into /etc/rc.conf.
snmpd_enable="YES"
snmpd_flags="-a -p /var/run/snmpd.pid"
snmptrapd_enable="YES"
snmptrapd_flags="-a -p /var/run/snmptrapd.pid"
**** You may specify the following make variables:
NET_SNMP_SYS_CONTACT="kuriyama@FreeBSD.org"
NET_SNMP_SYS_LOCATION="Tokyo, Japan"
DEFAULT_SNMP_VERSION=3
NET_SNMP_MIB_MODULES="host smux mibII/mta_sendmail ucd-snmp/diskio"
NET_SNMP_LOGFILE=/var/log/snmpd.log
NET_SNMP_PERSISTENTDIR=/var/net-snmp
to define default values (or overwriting defaults). At least
setting first two variables, you will not be prompted during
configuration process. You may also set
BATCH="yes"
to avoid interactive configuration.
===> Installing rc.d startup script(s)
===> Compressing manual pages for net-snmp-5.3.1_3
===> Running ldconfig
/sbin/ldconfig -m /usr/local/lib
===> Registering installation for net-snmp-5.3.1_3
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/lib/libnetsnmp.so.10
/usr/local/lib/libnetsnmpagent.so.10
This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/snmpd
/usr/local/etc/rc.d/snmptrapd
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://net-snmp.sourceforge.net/
**/etc/rc.conf へ追加 [#te9d91a3]
snmpd_enable="YES"
snmpd_flags="-a -p /var/run/snmpd.pid"
snmptrapd_enable="YES"
snmptrapd_flags="-a -p /var/run/snmptrapd.pid"
**snmpd の確認 [#zba79dc1]
mail# snmpd -v
NET-SNMP version: 5.3.1
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net
mail# snmpd -h
Usage: snmpd [OPTIONS] [LISTENING ADDRESSES]
Version: 5.3.1
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net
-a log addresses
-A append to the logfile rather than truncating it
-c FILE[,...] read FILE(s) as configuration file(s)
-C do not read the default configuration files
-d dump sent and received SNMP packets
-D TOKEN[,...] turn on debugging output for the given TOKEN(s)
(try ALL for extremely verbose output)
-f do not fork from the shell
-g GID change to this numeric gid after opening
transport endpoints
-h, --help display this usage message
-H display configuration file directives understood
-I [-]INITLIST list of mib modules to initialize (or not)
(run snmpd with -Dmib_init for a list)
-L <LOGOPTS> toggle options controlling where to log to
e: log to standard error
o: log to standard output
n: don't log at all
f file: log to the specified file
s facility: log to syslog (via the specified facility)
(variants)
[EON] pri: log to standard error, output or /dev/null for level 'pri' and above
[EON] p1-p2: log to standard error, output or /dev/null for levels 'p1' to 'p2'
[FS] pri token: log to file/syslog for level 'pri' and above
[FS] p1-p2 token: log to file/syslog for levels 'p1' to 'p2'
-m MIBLIST use MIBLIST instead of the default MIB list
-M DIRLIST use DIRLIST as the list of locations
to look for MIBs
-p FILE store process id in FILE
-q print information in a more parsable format
-r do not exit if files only accessible to root
cannot be opened
-u UID change to this uid (numeric or textual) after
opening transport endpoints
-v, --version display version information
-V verbose display
-x ADDRESS use ADDRESS as AgentX address
-X run as an AgentX subagent rather than as an
SNMP master agent
Deprecated options:
-l FILE use -Lf <FILE> instead
-P use -p instead
-s use -Lsd instead
-S d|i|0-7 use -Ls <facility> instead
**TIPs [#k1c0a6fa]
***snmpd -H [#yb025439]
>設定の確認
No log handling enabled - turning on stderr logging
/usr/local/share/snmp/snmpd.conf: line 61: Error: example config COMMUNITY not properly configured
/usr/local/share/snmp/snmpd.conf: line 63: Error: example config COMMUNITY not properly configured
net-snmp: 2 error(s) in config file(s)
&edit;
**DISK情報 [#b33c7990]
>snmpwalkでデータの確認
CoolMaster:root {54} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.9
UCD-SNMP-MIB::dskIndex.1 = INTEGER: 1
UCD-SNMP-MIB::dskPath.1 = STRING: /
UCD-SNMP-MIB::dskDevice.1 = STRING: /dev/ar0s1a
UCD-SNMP-MIB::dskMinimum.1 = INTEGER: 10000
UCD-SNMP-MIB::dskMinPercent.1 = INTEGER: -1
UCD-SNMP-MIB::dskTotal.1 = INTEGER: 507630
UCD-SNMP-MIB::dskAvail.1 = INTEGER: 346360
UCD-SNMP-MIB::dskUsed.1 = INTEGER: 120660
UCD-SNMP-MIB::dskPercent.1 = INTEGER: 26
UCD-SNMP-MIB::dskPercentNode.1 = INTEGER: 5
UCD-SNMP-MIB::dskErrorFlag.1 = INTEGER: 0
UCD-SNMP-MIB::dskErrorMsg.1 = STRING:
**Memory [#u07a99c1]
### Memory Free / ns ####
Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0:PRIVATE@127.0.0.1
MaxBytes1[mem]: 483228
MaxBytes2[mem]: 983032
Unscaled[mem]: dwmy
Options[mem]: gauge, absolute, noinfo
YLegend[mem]: Mem Free(Bytes)
ShortLegend[mem]: Bytes
kilo[mem]: 2047
kMG[mem]: k,M,G,T,P
LegendI[mem]: Real
LegendO[mem]: Swap
Legend1[mem]: 空き物理メモリ[MBytes]
Legend2[mem]: 空きスワップメモリ[MBytes]
Title[mem]: 空きメモリ量 -- ns
PageTop[mem]: <H1>Memory Free -- GUARD</H1>
**CPU Load [#nffa4d16]
CoolMaster:root {55} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 2
CoolMaster:root {56} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 1
CoolMaster:root {55} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 2
CoolMaster:root {56} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 1
CoolMaster:root {57} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 1
CoolMaster:root {58} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 32
CoolMaster:root {59} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 85
CoolMaster:root {60} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 133
CoolMaster:root {61} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 130
CoolMaster:root {62} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 130
CoolMaster:root {63} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 130
CoolMaster:root {64} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 179
CoolMaster:root {65} % snmpwalk -c PRIVATE -v 1 localhost .1.3.6.1.4.1.2021.10.1.5.1
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 179
----
&edit;
&lastmod;