UJP - 技術情報2 バックアップ : MacOSX/HigiSierra/snmpd のバックアップの現在との差分(No.2)

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

2: 2019-05-25 (土) 18:14:10 nobuaki ソース バックアップ No.2 を復元して編集 現: 2020-08-16 (日) 02:12:00 nobuaki ソース 編集
Line 1: Line 1:
-*macOSでSNMPDが利用できるまで [#f79dc999]+*macOSでSNMPDが利用できるまで [#q8f51c74]
-**はじめに [#qfd28db1]+**はじめに [#vf627a42]
 macOSをサーバとして運用するので,SNMPによって性能などの監視を行いたい.SNMPはSNMPDで情報を得ることができるが,macOSはデフォルトではSNMPDが起動してないので,その起動や,諸設定を行う.  macOSをサーバとして運用するので,SNMPによって性能などの監視を行いたい.SNMPはSNMPDで情報を得ることができるが,macOSはデフォルトではSNMPDが起動してないので,その起動や,諸設定を行う.
 今回は,macOS 10.13.6のHigh Sierraで動作確認した.  今回は,macOS 10.13.6のHigh Sierraで動作確認した.
-**現状確認. [#e466386e]+**現状確認. [#z5458eb9]
 まずは,現在SNMPプロセスが起動してない事を確認.  まずは,現在SNMPプロセスが起動してない事を確認.
Line 42: Line 42:
 </plist>  </plist>
 $  $
- Disabled担っているので,起動してないのかな.+ Disabledになっているので,起動してないのかな.
 LaunchDaemonでSNMPDをroot権限で起動する.  LaunchDaemonでSNMPDをroot権限で起動する.
 $ sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist🆑  $ sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist🆑
Line 54: Line 54:
 稼働確認できた.  稼働確認できた.
-**SNMPで接続してみる [#wc20b48c]+**SNMPで接続してみる [#pf2a6ed7]
 SNMPDプロセスが起動したので,次はsnmpwalkコマンドを使って,SNMPで接続して情報を取得する.  SNMPDプロセスが起動したので,次はsnmpwalkコマンドを使って,SNMPで接続して情報を取得する.
Line 69: Line 69:
-**snmpd.confをsnmpconfコマンドを使って対話的に設定する [#e81854ac]+**snmpd.confをsnmpconfコマンドを使って対話的に設定する [#rc84f469]
-***snmpd.confファイルを確認 [#fc05a79a]+***snmpd.confファイルを確認 [#w7647ece]
 snmpconfコマンドを使うと,/usr/share/snmp/snmpd.confが作成されるが,現在存在しているか確認する.  snmpconfコマンドを使うと,/usr/share/snmp/snmpd.confが作成されるが,現在存在しているか確認する.
Line 108: Line 108:
 snmpd.confは存在しなかった.  snmpd.confは存在しなかった.
-***snmpconfのコマンドヘルプの確認 [#l645bb8a]+***snmpconfのコマンドヘルプの確認 [#u37b09c6]
 sndmpdは,snmpd.confで設定を制御するが,まずは/usr/bin/snmpconfコマンドを使ってカスタマイズする.  sndmpdは,snmpd.confで設定を制御するが,まずは/usr/bin/snmpconfコマンドを使ってカスタマイズする.
Line 132: Line 132:
 $  $
 新しいファイルを/usr/share/snmp以下に作成するのでiオプションをつけて実行する.  新しいファイルを/usr/share/snmp以下に作成するのでiオプションをつけて実行する.
- $ sudo /usr/bin/snmpconf -f🆑+ $ sudo /usr/bin/snmpconf -i🆑
 Password:🆑  Password:🆑
 + 
 The following installed configuration files were found:  The following installed configuration files were found:
 + 
   1:  ./snmpd.conf    1:  ./snmpd.conf
   2:  /etc/snmp/snmpd.conf🈁    2:  /etc/snmp/snmpd.conf🈁
 + 
 Would you like me to read them in?  Their content will be merged with the  Would you like me to read them in?  Their content will be merged with the
 output files created by this session.  output files created by this session.
 + 
 Valid answer examples: "all", "none","3","1,2,5"  Valid answer examples: "all", "none","3","1,2,5"
 + 
 Read in which (default = all):🈁  Read in which (default = all):🈁
Line 151: Line 151:
 Read in which (default = all): none🆑  Read in which (default = all): none🆑
 + 
 I can create the following types of configuration files for you.  I can create the following types of configuration files for you.
 Select the file type you wish to create:  Select the file type you wish to create:
 (you can create more than one as you run this program)  (you can create more than one as you run this program)
 + 
   1:  snmp.conf    1:  snmp.conf
   2:  snmptrapd.conf    2:  snmptrapd.conf
   3:  snmpd.conf    3:  snmpd.conf
 + 
 Other options: quit  Other options: quit
 + 
 Select File:  Select File:
Line 167: Line 167:
 Select File: 3🆑  Select File: 3🆑
 + 
 The configuration information which can be put into snmpd.conf is divided  The configuration information which can be put into snmpd.conf is divided
 into sections.  Select a configuration section for snmpd.conf  into sections.  Select a configuration section for snmpd.conf
 that you wish to create:  that you wish to create:
 + 
   1:  Agent Operating Mode    1:  Agent Operating Mode
   2:  Monitor Various Aspects of the Running Host    2:  Monitor Various Aspects of the Running Host
Line 178: Line 178:
   5:  Extending the Agent    5:  Extending the Agent
   6:  Access Control Setup    6:  Access Control Setup
 + 
 Other options: finished🈁  Other options: finished🈁
 + 
 Select section:  Select section:
Line 186: Line 186:
 Select section: finished🆑  Select section: finished🆑
 + 
 I can create the following types of configuration files for you.  I can create the following types of configuration files for you.
 Select the file type you wish to create:  Select the file type you wish to create:
 (you can create more than one as you run this program)  (you can create more than one as you run this program)
 + 
   1:  snmp.conf    1:  snmp.conf
   2:  snmptrapd.conf    2:  snmptrapd.conf
   3:  snmpd.conf    3:  snmpd.conf
 + 
 Other options: quit🈁  Other options: quit🈁
 + 
 Select File:  Select File:
   
Line 202: Line 202:
 Select File: quit🆑  Select File: quit🆑
 + 
 Error: An snmpd.conf file already exists in this directory.  Error: An snmpd.conf file already exists in this directory.
 + 
 'overwrite', 'skip', 'rename' or 'append'? :  'overwrite', 'skip', 'rename' or 'append'? :
Line 210: Line 210:
 'overwrite', 'skip', 'rename' or 'append'? : overwrite🆑  'overwrite', 'skip', 'rename' or 'append'? : overwrite🆑
- +  
 + 
 The following files were created:  The following files were created:
 + 
   snmpd.conf installed in /usr/share/snmp    snmpd.conf installed in /usr/share/snmp
 + 
 $  $
 ファイルができたようなので,中身を確認.  ファイルができたようなので,中身を確認.
Line 225: Line 225:
 #  - created by the snmpconf configuration program  #  - created by the snmpconf configuration program
 #  #
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
 + 
 $  $
 何も設定してないので,何もないね.  何も設定してないので,何もないね.
-***snmpd.confにシステム情報を設定する [#fa90f29a]+***snmpd.confにシステム情報を設定する [#reb77aaa]
 snmpconfを実行.  snmpconfを実行.
Line 252: Line 252:
 $ sudo /usr/bin/snmpconf -i🆑  $ sudo /usr/bin/snmpconf -i🆑
 Password:🆑  Password:🆑
 + 
 The following installed configuration files were found:  The following installed configuration files were found:
 + 
   1:  /etc/snmp/snmpd.conf    1:  /etc/snmp/snmpd.conf
   2:  /usr/share/snmp/snmpd.conf    2:  /usr/share/snmp/snmpd.conf
 + 
 Would you like me to read them in?  Their content will be merged with the  Would you like me to read them in?  Their content will be merged with the
 output files created by this session.  output files created by this session.
 + 
 Valid answer examples: "all", "none","3","1,2,5"  Valid answer examples: "all", "none","3","1,2,5"
 + 
 Read in which (default = all):  Read in which (default = all):
 2番の設定をマージするので2を選択.  2番の設定をマージするので2を選択.
 Read in which (default = all): 2🆑  Read in which (default = all): 2🆑
 + 
 I can create the following types of configuration files for you.  I can create the following types of configuration files for you.
 Select the file type you wish to create:  Select the file type you wish to create:
 (you can create more than one as you run this program)  (you can create more than one as you run this program)
 + 
   1:  snmptrapd.conf    1:  snmptrapd.conf
   2:  snmp.conf    2:  snmp.conf
   3:  snmpd.conf    3:  snmpd.conf
 + 
 Other options: quit  Other options: quit
 + 
 Select File:  Select File:
 3番を選択.  3番を選択.
 Select File: 3🆑  Select File: 3🆑
 + 
 The configuration information which can be put into snmpd.conf is divided  The configuration information which can be put into snmpd.conf is divided
 into sections.  Select a configuration section for snmpd.conf  into sections.  Select a configuration section for snmpd.conf
 that you wish to create:  that you wish to create:
 + 
   1:  Agent Operating Mode    1:  Agent Operating Mode
   2:  Monitor Various Aspects of the Running Host    2:  Monitor Various Aspects of the Running Host
Line 293: Line 293:
   5:  Extending the Agent    5:  Extending the Agent
   6:  Access Control Setup    6:  Access Control Setup
 + 
 Other options: finished  Other options: finished
 + 
 Select section:  Select section:
Line 301: Line 301:
 Select section: 4🆑  Select section: 4🆑
 + 
 Section: System Information Setup  Section: System Information Setup
 Description:  Description:
   This section defines some of the information reported in    This section defines some of the information reported in
   the "system" mib group in the mibII tree.    the "system" mib group in the mibII tree.
 + 
 Select from:  Select from:
 + 
   1:  The [typically physical] location of the system.🈁    1:  The [typically physical] location of the system.🈁
   2:  The contact information for the administrator    2:  The contact information for the administrator
   3:  The proper value for the sysServices object.    3:  The proper value for the sysServices object.
 + 
 Other options: finished, list  Other options: finished, list
 + 
 Select section:  Select section:
-****syslocationの設定 [#df51d017]+****syslocationの設定 [#w2fc92a6]
 最初は,物理的な場所を設定するので,1を選択.  最初は,物理的な場所を設定するので,1を選択.
 Select section: 1🆑  Select section: 1🆑
 + 
 Configuring: syslocation  Configuring: syslocation
 Description:  Description:
Line 332: Line 332:
     the variable.      the variable.
     arguments:  location_string      arguments:  location_string
 + 
 The location of the system:  The location of the system:
Line 338: Line 338:
 The location of the system: BCP🆑  The location of the system: BCP🆑
 + 
 Finished Output: syslocation  BCP🈁  Finished Output: syslocation  BCP🈁
 + 
 Section: System Information Setup  Section: System Information Setup
 Description:  Description:
   This section defines some of the information reported in    This section defines some of the information reported in
   the "system" mib group in the mibII tree.    the "system" mib group in the mibII tree.
 + 
 Select from:  Select from:
 + 
   1:  The [typically physical] location of the system.    1:  The [typically physical] location of the system.
   2:  The contact information for the administrator🈁    2:  The contact information for the administrator🈁
   3:  The proper value for the sysServices object.    3:  The proper value for the sysServices object.
 + 
 Other options: finished, list  Other options: finished, list
 + 
 Select section:  Select section:
-****syscontactの設定 [#q1ebc60e]+****syscontactの設定 [#teb84fdc]
 次に,管理者の連絡先を入力するために2を選択.  次に,管理者の連絡先を入力するために2を選択.
 Select section: 2🆑  Select section: 2🆑
 + 
 Configuring: syscontact  Configuring: syscontact
 Description:  Description:
Line 371: Line 371:
     the variable.      the variable.
     arguments:  contact_string      arguments:  contact_string
 + 
 The contact information:  The contact information:
Line 377: Line 377:
 The contact information: 管理者メールアドレス  The contact information: 管理者メールアドレス
 + 
 Finished Output: syscontact  管理者メールアドレス  Finished Output: syscontact  管理者メールアドレス
 + 
 Section: System Information Setup  Section: System Information Setup
 Description:  Description:
   This section defines some of the information reported in    This section defines some of the information reported in
   the "system" mib group in the mibII tree.    the "system" mib group in the mibII tree.
 + 
 Select from:  Select from:
 + 
   1:  The [typically physical] location of the system.    1:  The [typically physical] location of the system.
   2:  The contact information for the administrator    2:  The contact information for the administrator
   3:  The proper value for the sysServices object.🈁    3:  The proper value for the sysServices object.🈁
 + 
 Other options: finished, list  Other options: finished, list
 + 
 Select section:  Select section:
-****sysservicesの設定 [#o32f3a58]+****sysservicesの設定 [#x8794139]
 sysServices Objectの設定を行うので,3を入力.  sysServices Objectの設定を行うので,3を入力.
 Select section: 3🆑  Select section: 3🆑
 + 
 Configuring: sysservices  Configuring: sysservices
 Description:  Description:
   The proper value for the sysServices object.    The proper value for the sysServices object.
     arguments:  sysservices_number      arguments:  sysservices_number
 + 
 does this host offer physical services (eg, like a repeater) [answer 0 or 1]:🈁  does this host offer physical services (eg, like a repeater) [answer 0 or 1]:🈁
Line 425: Line 425:
 Finished Output: sysservices 76🈁  Finished Output: sysservices 76🈁
 + 
 Section: System Information Setup  Section: System Information Setup
 Description:  Description:
   This section defines some of the information reported in    This section defines some of the information reported in
   the "system" mib group in the mibII tree.    the "system" mib group in the mibII tree.
 + 
 Select from:  Select from:
 + 
   1:  The [typically physical] location of the system.    1:  The [typically physical] location of the system.
   2:  The contact information for the administrator    2:  The contact information for the administrator
   3:  The proper value for the sysServices object.    3:  The proper value for the sysServices object.
 + 
 Other options: finished, list  Other options: finished, list
 + 
 Select section:  Select section:
-****設定を確認し保存する [#kc760eb9]+****設定を確認し保存する [#n06770c9]
 これまで設定した内容を確認するのでlistと入力.  これまで設定した内容を確認するのでlistと入力.
Line 450: Line 450:
   syscontact  管理者メールアドレス🈁    syscontact  管理者メールアドレス🈁
   sysservices 76🈁    sysservices 76🈁
 + 
 Section: System Information Setup  Section: System Information Setup
 Description:  Description:
   This section defines some of the information reported in    This section defines some of the information reported in
   the "system" mib group in the mibII tree.    the "system" mib group in the mibII tree.
 + 
 Select from:  Select from:
 + 
   1:  The [typically physical] location of the system.    1:  The [typically physical] location of the system.
   2:  The contact information for the administrator    2:  The contact information for the administrator
   3:  The proper value for the sysServices object.    3:  The proper value for the sysServices object.
 + 
 Other options: finished, list  Other options: finished, list
 + 
 Select section:  Select section:
Line 469: Line 469:
 Select section: finished🆑  Select section: finished🆑
 + 
 The configuration information which can be put into snmpd.conf is divided  The configuration information which can be put into snmpd.conf is divided
 into sections.  Select a configuration section for snmpd.conf  into sections.  Select a configuration section for snmpd.conf
 that you wish to create:  that you wish to create:
 + 
   1:  Agent Operating Mode    1:  Agent Operating Mode
   2:  Monitor Various Aspects of the Running Host    2:  Monitor Various Aspects of the Running Host
Line 480: Line 480:
   5:  Extending the Agent    5:  Extending the Agent
   6:  Access Control Setup    6:  Access Control Setup
 + 
 Other options: finished  Other options: finished
 + 
 Select section: finished🆑  Select section: finished🆑
 + 
 I can create the following types of configuration files for you.  I can create the following types of configuration files for you.
 Select the file type you wish to create:  Select the file type you wish to create:
 (you can create more than one as you run this program)  (you can create more than one as you run this program)
 + 
   1:  snmptrapd.conf    1:  snmptrapd.conf
   2:  snmpd.conf    2:  snmpd.conf
   3:  snmp.conf    3:  snmp.conf
 + 
 Other options: quit🆑  Other options: quit🆑
 + 
 Select File: quit  Select File: quit
- +  
 + 
 The following files were created:  The following files were created:
 + 
   snmpd.conf installed in /usr/share/snmp    snmpd.conf installed in /usr/share/snmp
 $  $
Line 511: Line 511:
 #  - created by the snmpconf configuration program  #  - created by the snmpconf configuration program
 #  #
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
 + 
 ###########################################################################  ###########################################################################
 # SECTION: System Information Setup  # SECTION: System Information Setup
Line 525: Line 525:
 #  This section defines some of the information reported in  #  This section defines some of the information reported in
 #  the "system" mib group in the mibII tree.  #  the "system" mib group in the mibII tree.
 + 
 # syslocation: The [typically physical] location of the system.  # syslocation: The [typically physical] location of the system.
 #  Note that setting this value here means that when trying to  #  Note that setting this value here means that when trying to
Line 533: Line 533:
 #  the variable.  #  the variable.
 #  arguments:  location_string  #  arguments:  location_string
 + 
 syslocation  BCP  syslocation  BCP
 + 
 # syscontact: The contact information for the administrator  # syscontact: The contact information for the administrator
 #  Note that setting this value here means that when trying to  #  Note that setting this value here means that when trying to
Line 543: Line 543:
 #  the variable.  #  the variable.
 #  arguments:  contact_string  #  arguments:  contact_string
 + 
 syscontact  管理者メールアドレス  syscontact  管理者メールアドレス
 + 
 # sysservices: The proper value for the sysServices object.  # sysservices: The proper value for the sysServices object.
 #  arguments:  sysservices_number  #  arguments:  sysservices_number
 + 
 sysservices 76  sysservices 76
- +  
- +  
- +  
- +  
- +  
- +  
- +  
- +  
 + 
 $  $
 設定が保存されていることを確認.  設定が保存されていることを確認.
-**監視設定を定義する [#n33fcb26]+**監視設定を定義する [#u5bc4e3e]
 プロセス,ディスク容量,ロードアベレージ,ファイルサイズなどの監視を行う設定を行う.  プロセス,ディスク容量,ロードアベレージ,ファイルサイズなどの監視を行う設定を行う.
 + まずは,サイド編集モードまで.
 $ sudo /usr/bin/snmpconf -i🆑  $ sudo /usr/bin/snmpconf -i🆑
 Password:🆑  Password:🆑
 + 
 The following installed configuration files were found:  The following installed configuration files were found:
 + 
   1:  /etc/snmp/snmpd.conf    1:  /etc/snmp/snmpd.conf
   2:  /usr/share/snmp/snmpd.conf🈁    2:  /usr/share/snmp/snmpd.conf🈁
 + 
 Would you like me to read them in?  Their content will be merged with the  Would you like me to read them in?  Their content will be merged with the
 output files created by this session.  output files created by this session.
 + 
 Valid answer examples: "all", "none","3","1,2,5"  Valid answer examples: "all", "none","3","1,2,5"
 + 
 Read in which (default = all): 2🆑  Read in which (default = all): 2🆑
 + 
 I can create the following types of configuration files for you.  I can create the following types of configuration files for you.
 Select the file type you wish to create:  Select the file type you wish to create:
 (you can create more than one as you run this program)  (you can create more than one as you run this program)
 + 
   1:  snmp.conf    1:  snmp.conf
   2:  snmptrapd.conf    2:  snmptrapd.conf
   3:  snmpd.conf🈁    3:  snmpd.conf🈁
 + 
 Other options: quit  Other options: quit
 + 
 Select File: 3🆑  Select File: 3🆑
 + 
 The configuration information which can be put into snmpd.conf is divided  The configuration information which can be put into snmpd.conf is divided
 into sections.  Select a configuration section for snmpd.conf  into sections.  Select a configuration section for snmpd.conf
 that you wish to create:  that you wish to create:
 + 
   1:  Agent Operating Mode    1:  Agent Operating Mode
   2:  Monitor Various Aspects of the Running Host🈁    2:  Monitor Various Aspects of the Running Host🈁
Line 604: Line 605:
   5:  Extending the Agent    5:  Extending the Agent
   6:  Access Control Setup    6:  Access Control Setup
 + 
 Other options: finished  Other options: finished
 + 
 Select section: 2🆑  Select section: 2🆑
 + 
 Section: Monitor Various Aspects of the Running Host  Section: Monitor Various Aspects of the Running Host
 Description:  Description:
   The following check up on various aspects of a host.    The following check up on various aspects of a host.
 + 
 Select from:  Select from:
 + 
   1:  Check for processes that should be running.🈁    1:  Check for processes that should be running.🈁
   2:  Check for disk space usage of a partition.    2:  Check for disk space usage of a partition.
   3:  Check for unreasonable load average values.    3:  Check for unreasonable load average values.
   4:  Check on the size of a file.    4:  Check on the size of a file.
 + 
 Other options: finished, list  Other options: finished, list
 + 
 Select section:  Select section:
 + ここから先は,メニューを順番に選んでいく.
- +***プロセスの監視を行う [#i3914a34]
-***プロセスの監視を行う [#o288cf0a]+
 Check for processes that should be running.を選択する.  Check for processes that should be running.を選択する.
 Select section: 1🆑  Select section: 1🆑
- +  
- Configuring: proc+ Configuring: proc🈁
 Description:  Description:
   Check for processes that should be running.    Check for processes that should be running.
       proc NAME [MAX=0] [MIN=0]        proc NAME [MAX=0] [MIN=0]
 + 
       NAME:  the name of the process to check for.  It must match        NAME:  the name of the process to check for.  It must match
             exactly (ie, http will not find httpd processes).              exactly (ie, http will not find httpd processes).
       MAX:  the maximum number allowed to be running.  Defaults to 0.        MAX:  the maximum number allowed to be running.  Defaults to 0.
       MIN:  the minimum number to be running.  Defaults to 0.        MIN:  the minimum number to be running.  Defaults to 0.
 + 
     The results are reported in the prTable section of the UCD-SNMP-MIB tree      The results are reported in the prTable section of the UCD-SNMP-MIB tree
     Special Case:  When the min and max numbers are both 0, it assumes      Special Case:  When the min and max numbers are both 0, it assumes
     you want a max of infinity and a min of 1.      you want a max of infinity and a min of 1.
 + 
 Name of the process you want to check on:  Name of the process you want to check on:
 ここでは,Sambaのプロセスを監視する.プロセス名はsmbd.  ここでは,Sambaのプロセスを監視する.プロセス名はsmbd.
 + 単純にプロセス名だけを指定する.
- Name of the process you want to check on: /usr/sbin/smbd🆑 + Name of the process you want to check on: smbd🆑 
- Maximum number of processes named '/usr/sbin/smbd' that should be running [default = 0]:🆑 + Maximum number of processes named 'smbd' that should be running [default = 0]:🆑 
- Minimum number of processes named '/usr/sbin/smbd' that should be running [default = 0]:🆑 + Minimum number of processes named 'smbd' that should be running [default = 0]:🆑 
- +  
- Finished Output: proc  /usr/sbin/smbd + Finished Output: proc  smbd 
 + 
 Section: Monitor Various Aspects of the Running Host  Section: Monitor Various Aspects of the Running Host
 Description:  Description:
   The following check up on various aspects of a host.    The following check up on various aspects of a host.
 + 
 Select from:  Select from:
 + 
   1:  Check for processes that should be running.    1:  Check for processes that should be running.
   2:  Check for disk space usage of a partition.    2:  Check for disk space usage of a partition.
   3:  Check for unreasonable load average values.    3:  Check for unreasonable load average values.
   4:  Check on the size of a file.    4:  Check on the size of a file.
 + 
 Other options: finished, list  Other options: finished, list
 + 
 Select section:  Select section:
-***ディスクの空き容量の監視を行う [#lff26ec6]+ 今回は,プロセス数をmaxもminも,何も指定しないで0(ゼロ)とした.こういう指定をすると,プロセスが1つ以上起動してないとエラーという設定となる.
- /Volumes/RAID0_12TBというボリュームが95%を超えるかどうかを監視する.+***ディスクの空き容量の監視を行う [#dbd4165a]
-select section: 2🆑+ 今回は,例として/Volumes/RAID0_12TBというボリュームが95%を超えるかどうかを監視する.
- Configuring: disk+ select section: 2🆑 
 +  
 +  Configuring: disk🈁 
 +  Description: 
 +   Check for disk space usage of a partition. 
 +     The agent can check the amount of available disk space, and make 
 +     sure it is above a set limit. 
 +  
 +       disk PATH [MIN=100000] 
 +  
 +       PATH:  mount path to the disk in question. 
 +       MIN:  Disks with space below this value will have the Mib's errorFlag set. 
 +             Can be a raw integer value (units of kB) or a percentage followed by the % 
 +             symbol.  Default value = 100000. 
 +  
 +     The results are reported in the dskTable section of the UCD-SNMP-MIB tree 
 +  
 +  Enter the mount point for the disk partion to be checked on: /Volumes/RAID0_12TB🆑 
 +  Enter the minimum amount of space that should be available on /Volumes/RAID0_12TB: 95%🆑 
 +  
 + Finished Output: disk  /Volumes/RAID0_12TB 95%🈁 
 +  
 + Section: Monitor Various Aspects of the Running Host
 Description:  Description:
-   Check for disk space usage of a partition. +  The following check up on various aspects of a host. 
-    The agent can check the amount of available disk space, and make +  
-    sure it is above a set limit.+ Select from: 
 +  
 +   1:  Check for processes that should be running. 
 +   2: Check for disk space usage of a partition. 
 +    3:  Check for unreasonable load average values. 
 +   4:  Check on the size of a file. 
 +  
 + Other options: finished, list 
 +  
 + Select section:
-     disk PATH [MIN=100000]+ システムドライブを指定する場合は,70%くらいが良いのだと思う.大量にエラーがでたら急激に増えるものだしね.
-     PATH:  mount path to the disk in question. +***ロードアベレージを監視する [#b1853029]
-     MIN:  Disks with space below this value will have the Mib's errorFlag set. +
-             Can be a raw integer value (units of kB) or a percentage followed by the % +
-             symbol.  Default value = 100000. +
- +
-     The results are reported in the dskTable section of the UCD-SNMP-MIB tree +
- +
- Enter the mount point for the disk partion to be checked on: /Volumes/RAID0_12TB🆑 +
- Enter the minimum amount of space that should be available on /Volumes/RAID0_12TB: 95%🆑 +
- +
-Finished Output: disk  /Volumes/RAID0_12TB 95%🈁 +
- +
-Section: Monitor Various Aspects of the Running Host +
-Description: +
-  The following check up on various aspects of a host. +
- +
-Select from: +
- +
-   1:  Check for processes that should be running. +
-   2:  Check for disk space usage of a partition. +
-   3:  Check for unreasonable load average values. +
-   4:  Check on the size of a file. +
- +
-Other options: finished, list +
- +
-Select section: +
- +
-***ロードアベレージを監視する [#h7027a1b]+
 ロードアベレージは,CPU1つがビジー状態だと1なので,今回は4coreマシンなので,4の倍数で値を設定した.  ロードアベレージは,CPU1つがビジー状態だと1なので,今回は4coreマシンなので,4の倍数で値を設定した.
 Select section: 3🆑  Select section: 3🆑
 + 
 Configuring: load  Configuring: load
 Description:  Description:
   Check for unreasonable load average values.    Check for unreasonable load average values.
     Watch the load average levels on the machine.      Watch the load average levels on the machine.
 + 
     load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]      load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]
 + 
     1MAX:  If the 1 minute load average is above this limit at query      1MAX:  If the 1 minute load average is above this limit at query
             time, the errorFlag will be set.              time, the errorFlag will be set.
     5MAX:  Similar, but for 5 min average.      5MAX:  Similar, but for 5 min average.
     15MAX:  Similar, but for 15 min average.      15MAX:  Similar, but for 15 min average.
 + 
     The results are reported in the laTable section of the UCD-SNMP-MIB tree      The results are reported in the laTable section of the UCD-SNMP-MIB tree
 + 
 Enter the maximum allowable value for the 1 minute load average: 12🆑  Enter the maximum allowable value for the 1 minute load average: 12🆑
 Enter the maximum allowable value for the 5 minute load average: 8🆑  Enter the maximum allowable value for the 5 minute load average: 8🆑
 Enter the maximum allowable value for the 15 minute load average: 4🆑  Enter the maximum allowable value for the 15 minute load average: 4🆑
 + 
 Finished Output: load  12 8 4🈁  Finished Output: load  12 8 4🈁
 + 
 Section: Monitor Various Aspects of the Running Host  Section: Monitor Various Aspects of the Running Host
 Description:  Description:
   The following check up on various aspects of a host.    The following check up on various aspects of a host.
 + 
 Select from:  Select from:
 + 
   1:  Check for processes that should be running.    1:  Check for processes that should be running.
   2:  Check for disk space usage of a partition.    2:  Check for disk space usage of a partition.
   3:  Check for unreasonable load average values.    3:  Check for unreasonable load average values.
   4:  Check on the size of a file.    4:  Check on the size of a file.
 + 
 Other options: finished, list  Other options: finished, list
 + 
 Select section:  Select section:
-***ファイルサイズの監視 [#hc53d10b]+ 一旦はこれで.
- 継続することで大きくなるファイルを監視する.ここではsyslog.logとしている.+***ファイルサイズの監視 [#qfe8128e] 
 + 
 + 継続することで大きくなるファイルを監視する.ここではmacosなので,system.logとしている.Linuxだと/var/log/messagesになる.
 ファイルサイズは30000KB(30Mbyte)とした.  ファイルサイズは30000KB(30Mbyte)とした.
 Select section: 4🆑  Select section: 4🆑
 + 
 Configuring: file  Configuring: file
 Description:  Description:
Line 765: Line 773:
     Display a files size statistics.      Display a files size statistics.
     If it grows to be too large, report an error about it.      If it grows to be too large, report an error about it.
 + 
     file /path/to/file [maxsize_in_kilobytes]      file /path/to/file [maxsize_in_kilobytes]
 + 
       if maxsize is not specified, assume only size reporting is needed.        if maxsize is not specified, assume only size reporting is needed.
 + 
     The results are reported in the fileTable section of the UCD-SNMP-MIB tree      The results are reported in the fileTable section of the UCD-SNMP-MIB tree
 + 
 Enter the path to the file you wish to monitor: /var/log/system.log🆑  Enter the path to the file you wish to monitor: /var/log/system.log🆑
 Enter the maximum size (in kilobytes) allowable for /var/log/system.log: 30000🆑  Enter the maximum size (in kilobytes) allowable for /var/log/system.log: 30000🆑
 + 
 Finished Output: file  /var/log/system.log 30000  Finished Output: file  /var/log/system.log 30000
 + 
 Section: Monitor Various Aspects of the Running Host  Section: Monitor Various Aspects of the Running Host
 Description:  Description:
   The following check up on various aspects of a host.    The following check up on various aspects of a host.
 + 
 Select from:  Select from:
 + 
   1:  Check for processes that should be running.    1:  Check for processes that should be running.
   2:  Check for disk space usage of a partition.    2:  Check for disk space usage of a partition.
   3:  Check for unreasonable load average values.    3:  Check for unreasonable load average values.
   4:  Check on the size of a file.    4:  Check on the size of a file.
 + 
 Other options: finished, list  Other options: finished, list
 + 
 Select section:  Select section:
 + ここまでで一通り終了.
-設定を確認し,終了する.+****設定を確認し,終了する. [#o7dd07a1]
- Select section: list+ これまで設定した内容を確認するために,listコマンドを実行. 
 + 
 + Select section: list🆑
 Lines defined for section "Monitor Various Aspects of the Running Host" so far:  Lines defined for section "Monitor Various Aspects of the Running Host" so far:
-   proc  /usr/sbin/smbd+   proc  smbd
   disk  /Volumes/RAID0_12TB 95%    disk  /Volumes/RAID0_12TB 95%
-   disk  /Volumes/zeusHD 80% 
   load  12 8 4    load  12 8 4
   file  /var/log/system.log 30000    file  /var/log/system.log 30000
 + 
 Section: Monitor Various Aspects of the Running Host  Section: Monitor Various Aspects of the Running Host
 Description:  Description:
   The following check up on various aspects of a host.    The following check up on various aspects of a host.
 + 
 Select from:  Select from:
 + 
   1:  Check for processes that should be running.    1:  Check for processes that should be running.
   2:  Check for disk space usage of a partition.    2:  Check for disk space usage of a partition.
   3:  Check for unreasonable load average values.    3:  Check for unreasonable load average values.
   4:  Check on the size of a file.    4:  Check on the size of a file.
 + 
 Other options: finished, list  Other options: finished, list
- Select section: finished+ 問題ないので,finishedやquitで終了.
 + Select section: finished🆑
 + 
 The configuration information which can be put into snmpd.conf is divided  The configuration information which can be put into snmpd.conf is divided
 into sections.  Select a configuration section for snmpd.conf  into sections.  Select a configuration section for snmpd.conf
 that you wish to create:  that you wish to create:
 + 
   1:  Agent Operating Mode    1:  Agent Operating Mode
   2:  Monitor Various Aspects of the Running Host    2:  Monitor Various Aspects of the Running Host
Line 828: Line 840:
   5:  Extending the Agent    5:  Extending the Agent
   6:  Access Control Setup    6:  Access Control Setup
- +  
- Other options: finished + Other options: finished🈁 
- +  
- Select section: finished + Select section: finished🆑 
 + 
 I can create the following types of configuration files for you.  I can create the following types of configuration files for you.
 Select the file type you wish to create:  Select the file type you wish to create:
 (you can create more than one as you run this program)  (you can create more than one as you run this program)
 + 
   1:  snmp.conf    1:  snmp.conf
   2:  snmptrapd.conf    2:  snmptrapd.conf
   3:  snmpd.conf    3:  snmpd.conf
 + 
 + Other options: quit🈁
 + 
 + Select File: quit🆑
 + 
 + 
 + The following files were created:
 + 
 +   snmpd.conf installed in /usr/share/snmp🈁
 + $
- Other options: quit+ 設定ファイルが書き出された模様.
- Select File: quit+****snmpd.confファイルを確認する [#u0726cb5]
 + ここまでで設定されたsnmpd.confファイルを確認する.
- The following files were created:+ $ cat /usr/share/snmp/snmpd.conf🆑 
 + ########################################################################### 
 + # 
 + # snmpd.conf 
 + # 
 + #  - created by the snmpconf configuration program 
 + # 
 +  
 +  
 +  
 + ########################################################################### 
 + # SECTION: Monitor Various Aspects of the Running Host 
 + # 
 + #  The following check up on various aspects of a host. 
 +  
 + # proc: Check for processes that should be running. 
 + #    proc NAME [MAX=0] [MIN=0] 
 + # 
 + #    NAME:  the name of the process to check for.  It must match 
 + #            exactly (ie, http will not find httpd processes). 
 + #    MAX:  the maximum number allowed to be running.  Defaults to 0. 
 + #    MIN:  the minimum number to be running.  Defaults to 0. 
 + # 
 + #  The results are reported in the prTable section of the UCD-SNMP-MIB tree 
 + #  Special Case:  When the min and max numbers are both 0, it assumes 
 + #  you want a max of infinity and a min of 1. 
 +  
 + proc  smbd🈁 
 +  
 + # disk: Check for disk space usage of a partition. 
 + #  The agent can check the amount of available disk space, and make 
 + #  sure it is above a set limit. 
 + # 
 + #    disk PATH [MIN=100000] 
 + # 
 + #    PATH:  mount path to the disk in question. 
 + #    MIN:  Disks with space below this value will have the Mib's errorFlag set. 
 + #          Can be a raw integer value (units of kB) or a percentage followed by the % 
 + #          symbol.  Default value = 100000. 
 + # 
 + #  The results are reported in the dskTable section of the UCD-SNMP-MIB tree 
 +  
 + disk  /Volumes/RAID0_12TB 95%🈁 
 +  
 + # load: Check for unreasonable load average values. 
 + #  Watch the load average levels on the machine. 
 + # 
 + #    load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0] 
 + # 
 + #    1MAX:  If the 1 minute load average is above this limit at query 
 + #            time, the errorFlag will be set. 
 + #    5MAX:  Similar, but for 5 min average. 
 + #    15MAX:  Similar, but for 15 min average. 
 + # 
 + #  The results are reported in the laTable section of the UCD-SNMP-MIB tree 
 +  
 + load  12 8 4🈁 
 +  
 + # file: Check on the size of a file. 
 + #  Display a files size statistics. 
 + #  If it grows to be too large, report an error about it. 
 + # 
 + #    file /path/to/file [maxsize_in_kilobytes] 
 + # 
 + #      if maxsize is not specified, assume only size reporting is needed. 
 + # 
 + #  The results are reported in the fileTable section of the UCD-SNMP-MIB tree 
 +  
 + file  /var/log/system.log 30000🈁 
 +  
 +  
 +  
 +  
 +  
 +  
 + ########################################################################### 
 + # SECTION: System Information Setup 
 + # 
 + #  This section defines some of the information reported in 
 + #  the "system" mib group in the mibII tree. 
 +  
 + # syslocation: The [typically physical] location of the system. 
 + #  Note that setting this value here means that when trying to 
 + #  perform an snmp SET operation to the sysLocation.0 variable will make 
 + #  the agent return the "notWritable" error code.  IE, including 
 + #  this token in the snmpd.conf file will disable write access to 
 + #  the variable. 
 + #  arguments:  location_string 
 +  
 + syslocation  BCP🈁 
 +  
 + # syscontact: The contact information for the administrator 
 + #  Note that setting this value here means that when trying to 
 + #  perform an snmp SET operation to the sysContact.0 variable will make 
 + #  the agent return the "notWritable" error code.  IE, including 
 + #  this token in the snmpd.conf file will disable write access to 
 + #  the variable. 
 + #  arguments:  contact_string 
 +  
 + syscontact  管理者メールアドレス 
 +  
 + # sysservices: The proper value for the sysServices object. 
 + #  arguments: sysservices_number 
 +  
 + sysservices 76🈁 
 +  
 +  
 +  
 +  
 +  
 +  
 +  
 +  
 +  
 + $
-   snmpd.conf installed in /usr/share/snmp+ コメントとかが多い... 
 + シンプルに書き直す. 
 + 
 + $ cat /usr/share/snmp/snmpd.conf🆑 
 + syslocation BCP 
 + syscontact  管理者メールアドレス 
 + sysservices 76 
 +  
 + proc  smbd 
 + disk  /Volumes/RAID0_12TB 95% 
 + disk  /Volumes/zeusHD 80% 
 + load  12 8 4 
 + file  /var/log/system.log 30000 
 +  
 + $ 
 + 
 + たくさん書いてきたけれど,これだけ. 
 + 
 +**監視設定を有効化する [#u1340869] 
 + 
 + 今回設定した内容を反映させる. 
 + HUPシグナルをsnmpdプロセスに送ることで,反映させる. 
 + 
 + $ ps -ef|grep snmpd🆑 
 +     0 66808🈁    1  0 17 519  ??        3:22.25 /usr/libexec/snmpd -f 
 +   501 43526 42924  0  6:38PM ttys003    0:00.01 grep snmpd 
 + $ sudo kill -HUP 66808🆑 
 + $ ps -ef|grep snmpd🆑 
 +     0 66808    1  0 17 519  ??        3:22.27 /usr/libexec/snmpd -f 
 +   501 43533 42924  0  6:39PM ttys003    0:00.00 grep snmpd 
 + $ 
 + 
 + 設定した内容が反映されているか確認. 
 + 
 + $ snmpwalk -v 2c -c public localhost🆑 
 + SNMPv2-MIB::sysContact.0 = STRING: 管理者メールアドレス 
 + SNMPv2-MIB::sysContact.0 = No more variables left in this MIB View (It is past the end of the MIB tree) 
 + $ 
 + 
 + メールアドレスが出てきたから,正しく設定された模様.ただし,最後にNo more variablesとでている.これはアクセス権限がないから. 
 + 
 +**セキュリティ設定を行う [#k6bbc64f] 
 + 
 + com2secパラメータを設定して,アクセス制御を行う. 
 + 
 + まずは,デフォルトのsnmpd.confを確認.(コメントを外して) 
 + 
 + $ cat /etc/snmp/snmpd.conf|grep -v -e '^#'|grep -v -e '^$'🆑 
 + com2sec local    localhost      COMMUNITY🈁 
 + com2sec mynetwork NETWORK/24      COMMUNITY🈁 
 + group MyRWGroup v1        local 
 + group MyRWGroup v2c        local 
 + group MyRWGroup usm        local 
 + group MyROGroup v1        mynetwork 
 + group MyROGroup v2c        mynetwork 
 + group MyROGroup usm        mynetwork 
 + view all    included  .1                              80 
 + access MyROGroup ""      any      noauth    exact  all    none  none 
 + access MyRWGroup ""      any      noauth    exact  all    all    none 
 + rwuser  admin 
 + rocommunity  public default .1.3.6.1.2.1.1.4🈁 
 + syslocation Right here, right now. 
 + syscontact Administrator <postmaster@example.com> 
 + sysservices 76 
 + proc httpd 
 + exec echotest /bin/echo hello world 
 + exec web_status /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin status web 
 + exec netboot /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin status netboot 
 + disk / 10000 
 + $ 
 + 
 + macOSの場合,execの以降の部分がついている模様.Server.appをインストールしているか否かに依存しない. 
 + 今回は com2sec local にprivate,com2sec mynetworkにpublicを設定する. 
 + また,mibのノードは,.1.3.6.1.2.1.1.4となっているが,最上位を解放する. 
 + まずはオリジナルのファイルをバックアップ. 
 + 
 + $ sudo cp -p /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.v00🆑 
 + $ 
 + 
 + 変更後の差分を確認. 
 + 
 + $ diff /etc/snmp/snmpd.conf.v00 /etc/snmp/snmpd.conf🆑 
 + 61,62c61,62 
 + < com2sec local    localhost      COMMUNITY 
 + < com2sec mynetwork NETWORK/24      COMMUNITY 
 + --- 
 + > com2sec local    localhost      private 
 + > com2sec mynetwork NETWORK/24      public 
 + 98c98,99 
 + < rocommunity  public default .1.3.6.1.2.1.1.4 
 + --- 
 + > #rocommunity  public default .1.3.6.1.2.1.1.4 
 + > rocommunity  public default .1 
 + 103c104 
 + < #rwcommunity  private 
 + --- 
 + > rwcommunity  private 
 + $ 
 + rwcommunity,rwなので書き込みを,privateのコミュニティに許可をする. 
 + これで設定完了. 
 + 
 +**snmpwalkでMIB情報を取得 [#a8bfcabd] 
 + 
 + snmpd.confを変更したので,SNMPDを再起動して反映させる. 
 + 
 + $ sudo launchctl unload -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist🆑 
 + Password:🆑 
 + $ ps -ef|grep snmpd🆑 
 +   501 62844 61321  0  8:02PM ttys003    0:00.00 grep snmpd 
 + $ sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist🆑 
 + $ ps -ef|grep snmpd🆑 
 +     0 62848    1  0  8:03PM ??        0:00.20 /usr/libexec/snmpd -f 
 +   501 62851 61321  0  8:03PM ttys003    0:00.00 grep snmpd 
 + $ 
 + 情報が取得できるようになったか,確認する. 
 + 
 + $ snmpwalk -v 2c -c public localhost|head -n 10🆑 
 + SNMPv2-MIB::sysDescr.0 = STRING: Darwin zeus.local 17.7.0 Darwin Kernel Version 17.7.0: 
 +  Wed Feb 27 00:43:23 PST 2019; root:xnu-4570.71.35~1/RELEASE_X86_64 x86_64 
 + SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.255 
 + DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (9626) 0:01:36.26 
 + SNMPv2-MIB::sysContact.0 = STRING: 管理者メールアドレス 
 + SNMPv2-MIB::sysName.0 = STRING: zeus.local 
 + SNMPv2-MIB::sysLocation.0 = STRING: BCP 
 + SNMPv2-MIB::sysServices.0 = INTEGER: 76 
 + SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00 
 + SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1 
 + SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance 
 + $ 
 + 
 + データ取得ができた. 
 + 
 +**おさらい [#f57bec1a] 
 + 
 + 今回,設定した内容を整理. 
 + 
 + $ cat /etc/snmp/snmpd.conf|grep -v -e '^#'|grep -v -e '^$'🆑 
 + com2sec local    localhost      private 
 + com2sec mynetwork NETWORK/24      public 
 + group MyRWGroup v1        local 
 + group MyRWGroup v2c        local 
 + group MyRWGroup usm        local 
 + group MyROGroup v1        mynetwork 
 + group MyROGroup v2c        mynetwork 
 + group MyROGroup usm        mynetwork 
 + view all    included  .1                              80 
 + access MyROGroup ""      any      noauth    exact  all    none  none 
 + access MyRWGroup ""      any      noauth    exact  all    all    none 
 + rwuser  admin 
 + rocommunity  public default .1 
 + rwcommunity  private 
 + syslocation Right here, right now. 
 + syscontact Administrator <postmaster@example.com> 
 + sysservices 76 
 + proc httpd 
 + exec echotest /bin/echo hello world 
 + exec web_status /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin status web 
 + exec netboot /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin status netboot 
 + disk / 10000 
 + $ 
 + $ cat /usr/share/snmp/snmpd.conf|grep -v -e '^#'|grep -v -e '^$'🆑 
 + syslocation  BCP 
 + syscontact  管理者メールアドレス 
 + syslocation  BCP 
 + sysservices 76 
 + proc  smbd 
 + disk  /Volumes/RAID0_12TB 95% 
 + disk  /Volumes/zeusHD 80% 
 + load  12 8 4 
 + file  /var/log/system.log 30000
 $  $


トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   ページ新規作成 全ページ一覧 単語検索 最新ページの一覧   ヘルプ   最新ページのRSS 1.0 最新ページのRSS 2.0 最新ページのRSS Atom
Counter: 2957, today: 3, yesterday: 1

広告スペース
Google