**これは、[InterSystems FAQサイト](https://faq.intersystems.co.jp/)の記事です。** データベースの空き容量は、システムモニタを使用して監視することができます。 システムモニタは、システム開始時に自動開始され、予め設定された閾値に対してアラートが通知されます。 システムの閾値については以下ドキュメントをご参照ください。 [システム・モニタのステータスおよびリソース・メトリック【IRIS】](https://docs.intersystems.com/irislatestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_sysmon_alerts) [システム・モニタのステータスおよびリソース・メトリック](https://docs.intersystems.com/latestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_sysmon_alerts)   データベースの空き容量については、システムデフォルトでは 50 MBを下回る場合にアラートが通知され、メッセージログ(コンソールログ)にアラート(深刻度 2)として記録され、alerts.log ファイルにも出力されます。 データベースの空き容量を任意サイズで監視したい場合、システムモニタに含まれる「アプリケーションモニタ」を利用して設定します。 注意:アプリケーションモニタでは、アラート対象となる情報があってもメッセージログ(コンソールログ)に出力しないため、メール通知/メソッド実行 を使用して通知するように設定します。   例えば、空き容量が 100MB を下回った時にアラートを通知したい場合は、アプリケーションモニタが提供する **%Monitor.System.Sample.Freespace**(空き容量メトリック)を利用します。 その他のアプリケーションモニタの閾値(メトリック)については、以下ドキュメントをご参照ください。 [アプリケーション・モニタのメトリック【IRIS】](https://docs.intersystems.com/irislatestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_appmon_metrics) [アプリケーション・モニタのメトリック](https://docs.intersystems.com/latestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_appmon_metrics)   システム提供のアプリケーションモニタは、デフォルトでは全て無効化されています。使用を開始するためには、対象のモニタを有効化し、システムモニタを再起動します。 アプリケーションモニタの有効/無効やシステムモニタの停止/開始は、システムルーチン ^%SYSMONMGR を利用します。 以下の例では、データベースの空き容量が 100MB を下回る場合にメール通知を行う設定手順について説明します。 手順は以下の通りです。 **1) ^%SYSMONMGR を起動し、アプリケーションモニタから %Monitor.System.Freespace を有効化する** **2) アラート対象とする閾値を変更する(例では、通知は最初の1回のみとしています)** **3) Email通知設定を行う** **4) システムモニタを再起動する** * * *   **1) ^%SYSMONMGR を起動し、アプリケーションモニタから %Monitor.System.Freespace を有効化する** ドキュメントは以下ご参照ください。 [Manage Monitor Classes【IRIS】](https://docs.intersystems.com/irislatestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_appmon_appClassactivation) [Manage Monitor Classes](https://docs.intersystems.com/latestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_appmon_appClassactivation) %SYS><span style="color:#16a085;"><strong>do ^%SYSMONMGR</strong></span> 1) Start/Stop System Monitor 2) Set System Monitor Options 3) Configure System Monitor Classes 4) View System Monitor State 5) Manage Application Monitor 6) Manage Health Monitor 7) View System Data 8) Exit Option? <span style="color:#16a085;"><strong>5   → 5 を入力してEnter押下</strong></span> 1) Set Sample Interval 2) Manage Monitor Classes 3) Change Default Notification Method 4) Manage Email Options 5) Manage Alerts 6) Exit Option? <span style="color:#16a085;"><strong>2   → 2 を入力してEnter押下</strong></span> 1) Activate/Deactivate Monitor Class 2) List Monitor Classes 3) Register Monitor System Classes 4) Remove/Purge Monitor Class 5) Set Class Sample Interval 6) Debug Monitor Classes 7) Exit Option? <span style="color:#16a085;"><strong>1   → 1 を入力してEnter押下</strong></span> Class? <strong><span style="color:#16a085;">?   → ? を入力してEnter押下</span></strong>  Num  MetricsClassName               Activated   1)  %Monitor.System.HistoryMemory  N   2)  %Monitor.System.HistoryPerf    N   3)  %Monitor.System.HistorySys     N   4)  %Monitor.System.HistoryUser    N   5)  %Monitor.System.AuditCount     N   6)  %Monitor.System.AuditEvents    N   7)  %Monitor.System.Clients        N   8)  %Monitor.System.Diskspace      N   9)  %Monitor.System.Freespace      N  10)  %Monitor.System.Globals        N  11)  %Monitor.System.Journals       N  12)  %Monitor.System.License        N  13)  %Monitor.System.LockTable      N  14)  %Monitor.System.Processes      N  15)  %Monitor.System.Routines       N  16)  %Monitor.System.Servers        N  17)  %Monitor.System.SystemMetrics  N  18)  %Monitor.System.CSPGateway     N Class? <span style="color:#16a085;"><strong>9</strong></span> %Monitor.System.Freespace  <strong><span style="color:#16a085;"> →上のリストの 9 を指定してEnter押下</span></strong> Activate class? Yes => <span style="color:#16a085;"><strong>yes   → yes を入力してEnter押下</strong></span> 1) Activate/Deactivate Monitor Class 2) List Monitor Classes 3) Register Monitor System Classes 4) Remove/Purge Monitor Class 5) Set Class Sample Interval 6) Debug Monitor Classes 7) Exit Option?  →Enter押下(前のメニューに戻ります) 1) Set Sample Interval 2) Manage Monitor Classes 3) Change Default Notification Method 4) Manage Email Options 5) Manage Alerts 6) Exit Option?   **2) アラート対象とする閾値を変更する(例では、通知は最初の1回のみとしています)** ※以下実行例は、**1) **の続きで記述しています。^%SYSMONMGRの実行から始めている場合は、**5) Manage Application Monitor** 選択後の画面から開始してください。   ドキュメントは以下ご参照ください。 [Manage Alerts【IRIS】](https://docs.intersystems.com/irislatestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_appmon_appAlertoptions) [Manage Alerts](https://docs.intersystems.com/latestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_appmon_appAlertoptions) 1) Set Sample Interval 2) Manage Monitor Classes 3) Change Default Notification Method 4) Manage Email Options 5) Manage Alerts 6) Exit Option? <span style="color:#16a085;"><strong>5   → 5 を入力してEnter押下 </strong></span> 1) Create Alert 2) Edit Alert 3) List Alerts 4) Delete Alert 5) Enable/Disable Alert 6) Clear NotifyOnce Alert 7) Exit Option?<strong><span style="color:#16a085;"> 1   → 1 を入力してEnter押下</span></strong> Alert name?<strong><span style="color:#16a085;"> test database free space alert    → 任意のアラート名を入力してEnter押下</span></strong> Application? %SYS (Enter '-' to reset) =>   <span style="color:#16a085;"><strong>→ Enter押下</strong></span> Action (0=default,1=email,2=method)? 0 => <strong><span style="color:#16a085;">1   → 1 を入力してEnter押下</span></strong> Raise this alert during sampling? Yes => <strong><span style="color:#16a085;">yes   → yes を入力してEnter押下</span></strong> Class? <strong><span style="color:#16a085;">?   → ? を入力してEnter押下 </span></strong>  Num  MetricsClassName               Activated   1)  %Monitor.System.HistoryMemory  N   2)  %Monitor.System.HistoryPerf    N   3)  %Monitor.System.HistorySys     N   4)  %Monitor.System.HistoryUser    N   5)  %Monitor.System.AuditCount     N   6)  %Monitor.System.AuditEvents    N   7)  %Monitor.System.Clients        N   8)  %Monitor.System.Diskspace      N   9)  %Monitor.System.Freespace      Y  10)  %Monitor.System.Globals        N  11)  %Monitor.System.Journals       N  12)  %Monitor.System.License        N  13)  %Monitor.System.LockTable      N  14)  %Monitor.System.Processes      N  15)  %Monitor.System.Routines       N  16)  %Monitor.System.Servers        N  17)  %Monitor.System.SystemMetrics  N  18)  %Monitor.System.CSPGateway     N Class? <span style="color:#16a085;"><strong>9</strong></span> %Monitor.System.Freespace    <strong><span style="color:#16a085;">→ 上のリストの 9 を指定してEnter押下</span></strong> Property? <strong><span style="color:#16a085;">?    → ? を入力してEnter押下 </span></strong>  Num  Name                           Activated   1)  CurSize                        Y   2)  DBName                         Y   3)  Directory                      Y   4)  DiskFreeSpace                  Y   5)  FreeSpace                      Y   6)  MaxSize                        Y Property? <span style="color:#16a085;"><strong>5</strong></span> FreeSpace   <strong><span style="color:#16a085;">→ 上のリストの 5 を指定してEnter押下</span></strong> Property? Properties list: FreeSpace Evaluation expression (e.g., "%1=99")? <span style="color:#16a085;"><strong>%1<100   ←MB単位に指定します。例では「100MB未満の場合アラート」を指定してEnter押下</strong></span> Expression expands to: If FreeSpace<100. OK? Yes =><strong><span style="color:#16a085;"> Yes   → Yes を入力してEnter押下</span></strong> Notify once only? No => <strong><span style="color:#16a085;">yes   → yes を入力してEnter押下</span></strong> 1) Create Alert 2) Edit Alert 3) List Alerts 4) Delete Alert 5) Enable/Disable Alert 6) Clear NotifyOnce Alert 7) Exit Option?  <strong><span style="color:#1abc9c;">→Enter押下(前のメニューに戻ります)</span></strong> 1) Set Sample Interval 2) Manage Monitor Classes 3) Change Default Notification Method 4) Manage Email Options 5) Manage Alerts 6) Exit Option?  <strong><span style="color:#16a085;">→Enter押下(前のメニューに戻ります)</span></strong>   **3) Email通知設定を行う** 以下の例では、gmail を利用する例をご紹介しています。gmail は SSL構成を事前に作成する必要があります。管理ポータルの以下メニューから事前に作成してください。 **管理ポータル > システム管理 > セキュリティ管理 > SSL/TLS構成** ![](./images/20210310074234.png)![](/sites/default/files/inline/images/images/image(3672).png) ※以下実行例は、**2)**の続きで記述しています。^%SYSMONMGR の実行から始めている場合は、**5) Manage Application Monitor** 選択後の画面から開始してください。 ドキュメントは以下ご参照ください。 [Manage Email Options【IRIS】](https://docs.intersystems.com/irislatestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_appmon_appEmailoptions) [Manage Email Options](https://docs.intersystems.com/latestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_appmon_appEmailoptions)   1) Start/Stop System Monitor 2) Set System Monitor Options 3) Configure System Monitor Classes 4) View System Monitor State 5) Manage Application Monitor 6) Manage Health Monitor 7) View System Data 8) Exit Option? <span style="color:#16a085;"><strong>5   → 5 を入力してEnter押下</strong></span> 1) Set Sample Interval 2) Manage Monitor Classes 3) Change Default Notification Method 4) Manage Email Options 5) Manage Alerts 6) Exit   Option? <strong><span style="color:#16a085;">4   → 4 を入力してEnter押下</span></strong> 1) Enable/Disable Email 2) Set Sender 3) Set Server 4) Manage Recipients 5) Set Authorization 6) Test Email 7) Exit Option? <strong><span style="color:#16a085;">3   → 3 を入力してEnter押下</span></strong> Mail server? <strong><span style="color:#16a085;">smtp.gmail.com   → メールサーバを入力してEnter押下</span></strong> Mail server port?<strong><span style="color:#16a085;"> 587   → メールサーバのポート番号を入力してEnter押下</span></strong> Mail server SSLConfiguration? <strong><span style="color:#16a085;">gmail   → 管理ポータルで設定したSSL構成名を入力してEnter押下</span></strong> Mail server UseSTARTTLS? 0 =><strong><span style="color:#16a085;"> 1   → 1を入力してEnter押下</span></strong> 1) Enable/Disable Email 2) Set Sender 3) Set Server 4) Manage Recipients 5) Set Authorization 6) Test Email 7) Exit Option? <strong><span style="color:#16a085;">2   → 2 を入力してEnter押下</span></strong> Sender?<strong><span style="color:#16a085;"> sendertest@gmail.com   → 差出人のメールアドレスを入力してEnter押下 </span></strong> 1) Enable/Disable Email 2) Set Sender 3) Set Server 4) Manage Recipients 5) Set Authorization 6) Test Email 7) Exit Option? <strong><span style="color:#16a085;">5   → 5 を入力してEnter押下 </span></strong> User name? <strong><span style="color:#16a085;">xxxabctestaccount@gmail.com   → 認証用アカウント名を入力してEnter押下</span></strong> Password?  <strong><span style="color:#16a085;"> → パスワードを入力してEnter押下</span></strong> 1) Enable/Disable Email 2) Set Sender 3) Set Server 4) Manage Recipients 5) Set Authorization 6) Test Email 7) Exit Option?<strong><span style="color:#16a085;"> 4   → 4 を入力してEnter押下</span></strong> 1) List Recipients 2) Add Recipient 3) Remove Recipient 4) Exit Option? <strong><span style="color:#16a085;">2   → 2 を入力してEnter押下</span></strong> Email Address? <strong><span style="color:#16a085;">abc@testcorp.com   → 送信先メールアドレスを入力してEnter押下</span></strong> 1) List Recipients 2) Add Recipient 3) Remove Recipient 4) Exit Option?  <strong><span style="color:#16a085;">→Enter押下(前のメニューに戻ります)</span></strong> 1) Enable/Disable Email 2) Set Sender 3) Set Server 4) Manage Recipients 5) Set Authorization 6) Test Email 7) Exit Option? <strong><span style="color:#16a085;">1   → 1 を入力してEnter押下</span></strong> Email is currently OFF Change Email setting? No => <strong><span style="color:#16a085;">yes   → yes を入力してEnter押下 </span></strong> 1) Enable/Disable Email 2) Set Sender 3) Set Server 4) Manage Recipients 5) Set Authorization 6) Test Email 7) Exit Option?<strong><span style="color:#16a085;"> 6   → 6 を入力してEnter押下</span></strong> Sending email on Mail Server smtp.gmail.com From: sendertest@gmail.com To: abc@testcorp.com 1) Enable/Disable Email 2) Set Sender 3) Set Server 4) Manage Recipients 5) Set Authorization 6) Test Email 7) Exit Option?  <strong><span style="color:#16a085;">→Enter押下(前のメニューに戻ります) </span></strong> 1) Set Sample Interval 2) Manage Monitor Classes 3) Change Default Notification Method 4) Manage Email Options 5) Manage Alerts 6) Exit Option?  <strong><span style="color:#16a085;">→Enter押下(前のメニューに戻ります)</span></strong> 1) Start/Stop System Monitor 2) Set System Monitor Options 3) Configure System Monitor Classes 4) View System Monitor State 5) Manage Application Monitor 6) Manage Health Monitor 7) View System Data 8) Exit Option?  <strong><span style="color:#16a085;">→Enter押下(前のメニューに戻ります)</span></strong>   **4) システムモニタを再起動する** 設定を反映させるため、システムモニタを一度停止し、開始します。 ドキュメントは以下ご参照ください。 [Start/Stop System Monitor【IRIS】](https://docs.intersystems.com/irislatestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_sysmon_sysmonmgr1) [Start/Stop System Monitor](https://docs.intersystems.com/latestj/csp/docbook/Doc.View.cls?KEY=GCM_healthmon#GCM_healthmon_sysmon_sysmonmgr1) %SYS><strong><span style="color:#16a085;">do ^%SYSMONMGR</span></strong> 1) Start/Stop System Monitor 2) Set System Monitor Options 3) Configure System Monitor Classes 4) View System Monitor State 5) Manage Application Monitor 6) Manage Health Monitor 7) View System Data 8) Exit Option? <strong><span style="color:#16a085;">1   → 1 を入力してEnter押下 </span></strong> 1) Start System Monitor 2) Stop System Monitor 3) Exit Option? 2  <strong><span style="color:#16a085;"> → 2 を入力してEnter押下</span></strong> Stopping System Monitor... System Monitor stopped 1) Start System Monitor 2) Stop System Monitor 3) Exit Option? <strong><span style="color:#16a085;">1   → 1 を入力してEnter押下</span></strong> Starting System Monitor... System Monitor started 1) Start System Monitor 2) Stop System Monitor 3) Exit Option?  <strong><span style="color:#16a085;">→Enter押下(前のメニューに戻ります) </span></strong> 1) Start/Stop System Monitor 2) Set System Monitor Options 3) Configure System Monitor Classes 4) View System Monitor State 5) Manage Application Monitor 6) Manage Health Monitor 7) View System Data 8) Exit Option? <strong><span style="color:#16a085;"> →Enter押下(ネームスペースのプロンプトに戻ります)</span></strong> %SYS>