summaryrefslogtreecommitdiff
path: root/lib/os_mon/doc/src/disksup.xml
blob: 97872c9f3bf178e90590572d5d4f5c606fa80939 (plain)
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
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1996</year><year>2023</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    
    </legalnotice>

    <title>disksup</title>
    <prepared></prepared>
    <docno></docno>
    <date></date>
    <rev></rev>
  </header>
  <module since="">disksup</module>
  <modulesummary>A Disk Supervisor Process</modulesummary>
  <description>
    <p><c>disksup</c> is a process which supervises the available disk
      space in the system. It is part of the OS_Mon application, see
      <seeapp marker="os_mon_app">os_mon(6)</seeapp>. Available for Unix
      and Windows.</p>
    <p>Periodically checks the disks. For each disk or partition which
      uses more than a certain amount of the available space, the alarm
      <c>{{disk_almost_full, MountedOn}, []}</c> is set.</p>
    <taglist>
      <tag>On Unix</tag>
      <item>
        <p>All (locally) mounted disks are checked, including the swap
          disk if it is present.</p>
      </item>
      <tag>On WIN32</tag>
      <item>
        <p>All logical drives of type "FIXED_DISK" are checked.</p>
      </item>
    </taglist>
    <p>Alarms are reported to the SASL alarm handler, see
      <seeerl marker="sasl:alarm_handler">alarm_handler(3)</seeerl>.
      To set an alarm, <c>alarm_handler:set_alarm(Alarm)</c> is called
      where <c>Alarm</c> is the alarm specified above.</p>
    <p>The alarms are cleared automatically when the alarm cause is no
      longer valid.</p>
  </description>

  <datatypes>
    <datatype>
      <name>time()</name>
      <desc>
        <p>Supported units:</p>
        <taglist>
          <tag><c>integer() >= 1</c></tag>
          <item>
            <p>The time interval in minutes.</p>
          </item>
          <tag><c>{TimeUnit, Time}</c></tag>
          <item>
            <p>
              The time interval <c>Time</c> in a time unit specified by <c>TimeUnit</c> where
              <c>TimeUnit</c> is of the type
              <seetype marker="erts:erlang#time_unit"><c>erlang:time_unit()</c></seetype>
              and <c>Time</c> is a positive integer. The time interval needs to be at least one
              millisecond long.
            </p>
          </item>
        </taglist>
      </desc>
    </datatype>
  </datatypes>

  <section>
    <marker id="config"></marker>
    <title>Configuration</title>
    <p>The following configuration parameters can be used to change
      the default values for time interval and threshold:</p>
    <taglist>
      <tag>
        <c>disk_space_check_interval = </c><seetype marker="#time"><c>time()</c></seetype>
      </tag>
      <item>
        <p>The time interval for the periodic disk space
          check. The default is 30 minutes.</p>
      </item>
      <tag><c>disk_almost_full_threshold = float()</c></tag>
      <item>
        <p>The threshold, as percentage of total disk space, for how
          much disk can be utilized before the <c>disk_almost_full</c>
          alarm is set. The default is 0.80 (80%).</p>
      </item>
      <tag><c>disksup_posix_only = bool()</c></tag>
      <item>
        <p>Specifies whether the <c>disksup</c> helper process should only
          use POSIX conformant commands (<c>true</c>) or not. The default is
          <c>false</c>. Setting this parameter to <c>true</c> can be
          necessary on embedded systems with stripped-down versions
          of Unix tools like <c>df</c>. The returned disk data and alarms
          can be different when using this option.</p>
        <p>The parameter is ignored on platforms that are known to not be
          POSIX compatible (Windows and SunOS).</p>
      </item>
    </taglist>
    <p>See <seefile marker="kernel:config">config(4)</seefile> for
      information about how to change the value of configuration
      parameters.</p>
  </section>
  <funcs>
    <func>
      <name since="">get_disk_data() -> [DiskData]</name>
      <fsummary>Get data for the disks in the system</fsummary>
      <type>
        <v>DiskData = {Id, TotalKiB, Capacity}</v>
        <v>&nbsp;Id = string()</v>
        <v>&nbsp;TotalKiB = int()</v>
        <v>&nbsp;Capacity = int()</v>
      </type>
      <desc>
        <p>Returns the result of the latest disk check. <c>Id</c> is a
          string that identifies the disk or partition. <c>TotalKiB</c> is
          the total size of the disk or partition in kibibytes.
          <c>Capacity</c> is the percentage of disk space used.</p>
        <p>The function is asynchronous in the sense that it does not
          invoke a disk check, but returns the latest available value.</p>
        <p>Returns <c>[{"none",0,0}]</c> if <c>disksup</c> is not
          available.</p>
      </desc>
    </func>
    <func>
      <name since="OTP 26.0">get_disk_info() -> [DiskData]</name>
      <fsummary>Immediately get information for the disks in the system</fsummary>
      <type>
        <v>DiskData = {Id, TotalKiB, AvailableKiB, Capacity}</v>
        <v>&nbsp;Id = string()</v>
        <v>&nbsp;TotalKiB = int()</v>
        <v>&nbsp;AvailableKiB = int()</v>
        <v>&nbsp;Capacity = int()</v>
      </type>
      <desc>
        <p>Immediately fetches total space, available space and capacity for local disks.
          <c>Id</c> is a string that identifies the disk or partition.
          <c>TotalKiB</c> is the total size of the disk or partition in kibibytes.
          <c>AvailableKiB</c> is the disk space used in kibibytes.
          <c>Capacity</c> is the percentage of disk space used.</p>
        <p>Returns <c>[{"none",0,0,0}]</c> if <c>disksup</c> is not
          available.</p>
      </desc>
    </func>
    <func>
      <name since="OTP 26.0">get_disk_info(Path) -> DiskData</name>
      <fsummary>Immediately get information for a single path</fsummary>
      <type>
        <v>DiskData = [{Id, TotalKiB, AvailableKiB, Capacity}]</v>
        <v>&nbsp;Id = string()</v>
        <v>&nbsp;TotalKiB = int()</v>
        <v>&nbsp;AvailableKiB = int()</v>
        <v>&nbsp;Capacity = int()</v>
      </type>
      <desc>
        <p>Immediately fetches total space, available space and capacity for a path.
          <c>Id</c> is a string that identifies the disk or partition.
          <c>TotalKiB</c> is the total size of the disk or partition in kibibytes.
          <c>AvailableKiB</c> is the disk space used in kibibytes.
          <c>Capacity</c> is the percentage of disk space used.</p>
        <p>Returns <c>[{Path,0,0,0}]</c> if the <c>Path</c> is invalid or space
          can't be determined. Returns <c>[{"none",0,0,0}]</c> if <c>disksup</c> is not
          available.</p>
      </desc>
    </func>
    <func>
      <name since="">get_check_interval() -> MS</name>
      <fsummary>Get time interval, in milliseconds, for the periodic disk space check</fsummary>
      <type>
        <v>MS = int()</v>
      </type>
      <desc>
        <p>Returns the time interval, in milliseconds, for the periodic
          disk space check.</p>
      </desc>
    </func>
    <func>
      <name since="">set_check_interval(Time) -> ok</name>
      <fsummary>Set time interval for the periodic disk space check</fsummary>
      <type>
        <v>Time = <seetype marker="#time">time()</seetype></v>
      </type>
      <desc>
        <p>Changes the time interval for the periodic
          disk space check.</p>
        <p>The change will take effect after the next disk space check
          and is non-persist. That is, in case of a process restart,
          this value is forgotten and the default value will be used.
          See <seeerl marker="#config">Configuration</seeerl> above.</p>
      </desc>
    </func>
    <func>
      <name since="">get_almost_full_threshold() -> Percent</name>
      <fsummary>Get threshold, in percent, for disk space utilization</fsummary>
      <type>
        <v>Percent = int()</v>
      </type>
      <desc>
        <p>Returns the threshold, in percent, for disk space utilization.</p>
      </desc>
    </func>
    <func>
      <name since="">set_almost_full_threshold(Float) -> ok</name>
      <fsummary>Set threshold, as percentage represented by a float, for disk space utilization</fsummary>
      <type>
        <v>Float = float(), 0=&lt;Float=&lt;1</v>
      </type>
      <desc>
        <p>Changes the threshold, given as a float, for disk space
          utilization.</p>
        <p>The change will take effect during the next disk space check
          and is non-persist. That is, in case of a process restart,
          this value is forgotten and the default value will be used.
          See <seeerl marker="#config">Configuration</seeerl> above.</p>
      </desc>
    </func>
  </funcs>

  <section>
    <title>See Also</title>
    <p><seeerl marker="sasl:alarm_handler">alarm_handler(3)</seeerl>,
      <seeapp marker="os_mon_app">os_mon(3)</seeapp></p>
  </section>
</erlref>