diff --git a/collector/src/main/java/org/apache/hertzbeat/collector/collect/imap/ImapCollectImpl.java b/collector/src/main/java/org/apache/hertzbeat/collector/collect/imap/ImapCollectImpl.java new file mode 100644 index 00000000000..4e2e547b857 --- /dev/null +++ b/collector/src/main/java/org/apache/hertzbeat/collector/collect/imap/ImapCollectImpl.java @@ -0,0 +1,169 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +package org.apache.hertzbeat.collector.collect.imap; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.net.imap.IMAPClient; +import org.apache.commons.net.imap.IMAPSClient; +import org.apache.hertzbeat.collector.collect.AbstractCollect; +import org.apache.hertzbeat.collector.dispatch.DispatchConstants; +import org.apache.hertzbeat.collector.util.CollectUtil; +import org.apache.hertzbeat.common.constants.CommonConstants; +import org.apache.hertzbeat.common.entity.job.Metrics; +import org.apache.hertzbeat.common.entity.job.protocol.ImapProtocol; +import org.apache.hertzbeat.common.entity.message.CollectRep; +import org.apache.hertzbeat.common.util.CommonUtil; +import org.springframework.util.Assert; + +/** + * imap collect + */ +@Slf4j +public class ImapCollectImpl extends AbstractCollect { + + private static final String UTF_7_X = "X-MODIFIED-UTF-7"; + private static final String STATUS = "STATUS"; + private static final String STATUS_COMMAND = "(MESSAGES RECENT UNSEEN)"; + private static final String MESSAGES = "MESSAGES"; + private static final String RECENT = "RECENT"; + private static final String UNSEEN = "UNSEEN"; + private static final String RESPONSETIME = "responseTime"; + private static final String totalMessageCount = "TotalMessageCount"; + private static final String recentMessageCount = "RecentMessageCount"; + private static final String unseenMessageCount = "UnseenMessageCount"; + + @Override + public void preCheck(Metrics metrics) throws IllegalArgumentException { + ImapProtocol imapProtocol = metrics.getImap(); + Assert.notNull(metrics, "IMAP collect must has Imap params"); + Assert.notNull(metrics.getImap(), "IMAP collect must has Imap params"); + Assert.hasText(imapProtocol.getHost(), "IMAP host is required"); + Assert.hasText(imapProtocol.getPort(), "IMAP port is required"); + Assert.hasText(imapProtocol.getEmail(), "IMAP email is required"); + Assert.hasText(imapProtocol.getAuthorize(), "IMAP authorize code is required"); + Assert.hasText(imapProtocol.getFolderName(), "IMAP folder name is required"); + } + + @Override + public void collect(CollectRep.MetricsData.Builder builder, long monitorId, String app, Metrics metrics) { + long startTime = System.currentTimeMillis(); + ImapProtocol imapProtocol = metrics.getImap(); + IMAPClient imapClient = null; + boolean ssl = Boolean.parseBoolean(imapProtocol.getSsl()); + + try { + imapClient = createImapClient(imapProtocol, ssl); + // if Connected, then collect metrics + if (imapClient.isConnected()) { + long responseTime = System.currentTimeMillis() - startTime; + String folderName = imapProtocol.getFolderName(); + collectImapMetrics(builder, imapClient, metrics.getAliasFields(), folderName, responseTime); + } else { + builder.setCode(CollectRep.Code.UN_CONNECTABLE); + builder.setMsg("Peer connect failed,Timeout " + imapProtocol.getTimeout() + "ms"); + } + } catch (Exception e) { + String errorMsg = CommonUtil.getMessageFromThrowable(e); + log.error(errorMsg); + builder.setCode(CollectRep.Code.FAIL); + builder.setMsg(errorMsg); + } finally { + if (imapClient != null) { + try { + imapClient.logout(); + imapClient.disconnect(); + } catch (IOException e) { + String errorMsg = CommonUtil.getMessageFromThrowable(e); + log.error(errorMsg); + builder.setCode(CollectRep.Code.FAIL); + builder.setMsg(errorMsg); + } + } + } + } + + @Override + public String supportProtocol() { + return DispatchConstants.PROTOCOL_IMAP; + } + + private IMAPClient createImapClient(ImapProtocol imapProtocol, boolean ssl) throws Exception { + IMAPClient imapClient = null; + // determine whether to use SSL-encrypted connections + imapClient = new IMAPSClient(true); + if (!ssl) { + imapClient = new IMAPClient(); + } + // set timeout + int timeout = Integer.parseInt(imapProtocol.getTimeout()); + if (timeout > 0) { + imapClient.setConnectTimeout(timeout); + } + //set Charset + imapClient.setCharset(StandardCharsets.US_ASCII); + // connect to the IMAP server + String host = imapProtocol.getHost(); + int port = Integer.parseInt(imapProtocol.getPort()); + imapClient.connect(host, port); + // validate credentials + String email = imapProtocol.getEmail(); + String authorize = imapProtocol.getAuthorize(); + boolean isAuthenticated = imapClient.login(email, authorize); + if (!isAuthenticated) { + throw new Exception("IMAP client authentication failed"); + } + return imapClient; + + } + + private void collectImapMetrics(CollectRep.MetricsData.Builder builder, IMAPClient imapClient, List aliasFields, + String folderName, long responseTime) throws Exception { + Map resultsMap = new HashMap<>(); + resultsMap.put(RESPONSETIME, String.valueOf(responseTime)); + imapClient.sendCommand(STATUS + " \"" + CollectUtil.stringEncodeUtf7String(folderName, UTF_7_X) + "\" " + STATUS_COMMAND); + String[] response = imapClient.getReplyString().split("\\s+|\\(|\\)"); + for (int i = 0; i < response.length; i++) { + switch (response[i]) { + case MESSAGES: + resultsMap.put(folderName + totalMessageCount, response[i + 1]); + break; + case RECENT: + resultsMap.put(folderName + recentMessageCount, response[i + 1]); + break; + case UNSEEN: + resultsMap.put(folderName + unseenMessageCount, response[i + 1]); + break; + default: + break; + } + } + + CollectRep.ValueRow.Builder valueRowBuilder = CollectRep.ValueRow.newBuilder(); + for (String field : aliasFields) { + String fieldValue = resultsMap.get(field); + valueRowBuilder.addColumns(Objects.requireNonNullElse(fieldValue, CommonConstants.NULL_VALUE)); + } + builder.addValues(valueRowBuilder.build()); + } +} diff --git a/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/DispatchConstants.java b/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/DispatchConstants.java index 12967ccf017..5fb285ed5d5 100644 --- a/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/DispatchConstants.java +++ b/collector/src/main/java/org/apache/hertzbeat/collector/dispatch/DispatchConstants.java @@ -127,6 +127,10 @@ public interface DispatchConstants { * protocol redfish */ String PROTOCOL_REDFISH = "redfish"; + /** + * protocol imap + */ + String PROTOCOL_IMAP = "imap"; // Protocol type related - end diff --git a/collector/src/main/java/org/apache/hertzbeat/collector/util/CollectUtil.java b/collector/src/main/java/org/apache/hertzbeat/collector/util/CollectUtil.java index 5e7249bdf0f..487a2e26897 100644 --- a/collector/src/main/java/org/apache/hertzbeat/collector/util/CollectUtil.java +++ b/collector/src/main/java/org/apache/hertzbeat/collector/util/CollectUtil.java @@ -17,12 +17,14 @@ package org.apache.hertzbeat.collector.util; +import com.beetstra.jutf7.CharsetProvider; import com.fasterxml.jackson.core.type.TypeReference; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonNull; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Iterator; import java.util.List; @@ -455,4 +457,24 @@ public static byte[] fromHexString(String hexString) { } return bytes; } + + /** + * convert original string to UTF-7 String + * @param original original text + * @param charset encode charset + * @return String + */ + public static String stringEncodeUtf7String(String original, String charset) { + return new String(original.getBytes(new CharsetProvider().charsetForName(charset)), StandardCharsets.US_ASCII); + } + + /** + * convert UTF-7 string to original String + * @param encoded encoded String + * @param charset encode charset + * @return String + */ + public static String utf7StringDecodeString(String encoded, String charset) { + return new String(encoded.getBytes(StandardCharsets.US_ASCII), new CharsetProvider().charsetForName(charset)); + } } diff --git a/collector/src/main/resources/META-INF/services/org.apache.hertzbeat.collector.collect.AbstractCollect b/collector/src/main/resources/META-INF/services/org.apache.hertzbeat.collector.collect.AbstractCollect index 38545f57d9d..b033c4f2a1d 100644 --- a/collector/src/main/resources/META-INF/services/org.apache.hertzbeat.collector.collect.AbstractCollect +++ b/collector/src/main/resources/META-INF/services/org.apache.hertzbeat.collector.collect.AbstractCollect @@ -23,3 +23,4 @@ org.apache.hertzbeat.collector.collect.pop3.Pop3CollectImpl org.apache.hertzbeat.collector.collect.httpsd.HttpsdImpl org.apache.hertzbeat.collector.collect.redfish.RedfishCollectImpl org.apache.hertzbeat.collector.collect.nebulagraph.NgqlCollectImpl +org.apache.hertzbeat.collector.collect.imap.ImapCollectImpl diff --git a/collector/src/test/java/org/apache/hertzbeat/collector/collect/imap/ImapCollectImplTest.java b/collector/src/test/java/org/apache/hertzbeat/collector/collect/imap/ImapCollectImplTest.java new file mode 100644 index 00000000000..eae79039afc --- /dev/null +++ b/collector/src/test/java/org/apache/hertzbeat/collector/collect/imap/ImapCollectImplTest.java @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +package org.apache.hertzbeat.collector.collect.imap; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import java.util.List; +import org.apache.commons.net.imap.IMAPClient; +import org.apache.commons.net.imap.IMAPSClient; +import org.apache.hertzbeat.common.entity.job.Metrics; +import org.apache.hertzbeat.common.entity.job.protocol.ImapProtocol; +import org.apache.hertzbeat.common.entity.message.CollectRep; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockedConstruction; +import org.mockito.Mockito; +import org.mockito.junit.jupiter.MockitoExtension; + +/** + * Test case for {@link ImapCollectImpl} + */ +@ExtendWith(MockitoExtension.class) +public class ImapCollectImplTest { + private Metrics metrics; + private CollectRep.MetricsData.Builder builder; + @Mock + private ImapProtocol imapProtocol; + @InjectMocks + private ImapCollectImpl imapCollect; + + @BeforeEach + void setUp() { + imapProtocol = ImapProtocol.builder() + .host("0.0.0.0") + .port("993") + .ssl("true") + .email("test@test.email.com") + .authorize("test") + .folderName("testFolder") + .timeout("6000") + .build(); + metrics = new Metrics(); + metrics.setName("testMailboxInfo"); + metrics.setImap(imapProtocol); + metrics.setAliasFields(List.of("responseTime", "testFolderTotalMessageCount", "testFolderRecentMessageCount", "testFolderUnseenMessageCount")); + builder = CollectRep.MetricsData.newBuilder(); + } + + @Test + void preCheck() { + assertDoesNotThrow(() -> { + imapCollect.preCheck(metrics); + }); + assertThrows(NullPointerException.class, () -> { + imapCollect.preCheck(null); + }); + metrics.setImap(null); + assertThrows(NullPointerException.class, () -> { + imapCollect.preCheck(null); + }); + } + + @Test + void enableSslCollect() { + String response = "* STATUS \"testFolder\" (MESSAGES 3 RECENT 2 UNSEEN 1)"; + MockedConstruction mocked = Mockito.mockConstruction(IMAPSClient.class, + (imapsClient, context) -> { + Mockito.doNothing().when(imapsClient).connect(Mockito.anyString(), Mockito.anyInt()); + Mockito.doAnswer(invocationOnMock -> true).when(imapsClient).login(Mockito.anyString(), Mockito.anyString()); + Mockito.doAnswer(invocationOnMock -> true).when(imapsClient).isConnected(); + Mockito.when(imapsClient.sendCommand(Mockito.anyString())).thenReturn(0); + Mockito.when(imapsClient.getReplyString()).thenReturn(response); + Mockito.doAnswer(invocationOnMock -> true).when(imapsClient).logout(); + Mockito.doNothing().when(imapsClient).disconnect(); + }); + + imapCollect.preCheck(metrics); + imapCollect.collect(builder, 1L, "testIMAP", metrics); + assertEquals(1, builder.getValuesCount()); + for (CollectRep.ValueRow valueRow : builder.getValuesList()) { + assertNotNull(valueRow.getColumns(0)); + assertEquals("3", valueRow.getColumns(1)); + assertEquals("2", valueRow.getColumns(2)); + assertEquals("1", valueRow.getColumns(3)); + + } + mocked.close(); + } + + @Test + void disableSslCollect() { + metrics.getImap().setSsl("false"); + String response = "* STATUS \"testFolder\" (MESSAGES 3 RECENT 2 UNSEEN 1)"; + MockedConstruction mocked = Mockito.mockConstruction(IMAPClient.class, + (imapClient, context) -> { + Mockito.doNothing().when(imapClient).connect(Mockito.anyString(), Mockito.anyInt()); + Mockito.doAnswer(invocationOnMock -> true).when(imapClient).login(Mockito.anyString(), Mockito.anyString()); + Mockito.doAnswer(invocationOnMock -> true).when(imapClient).isConnected(); + Mockito.when(imapClient.sendCommand(Mockito.anyString())).thenReturn(0); + Mockito.when(imapClient.getReplyString()).thenReturn(response); + Mockito.doAnswer(invocationOnMock -> true).when(imapClient).logout(); + Mockito.doNothing().when(imapClient).disconnect(); + }); + + imapCollect.preCheck(metrics); + imapCollect.collect(builder, 1L, "testIMAP", metrics); + assertEquals(1, builder.getValuesCount()); + for (CollectRep.ValueRow valueRow : builder.getValuesList()) { + assertNotNull(valueRow.getColumns(0)); + assertEquals("3", valueRow.getColumns(1)); + assertEquals("2", valueRow.getColumns(2)); + assertEquals("1", valueRow.getColumns(3)); + + } + mocked.close(); + } + + @Test + void supportProtocol() { + assertEquals("imap", imapCollect.supportProtocol()); + } +} diff --git a/common/pom.xml b/common/pom.xml index 4b8f2a12a2f..42a483ee239 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -116,5 +116,12 @@ org.apache.commons commons-collections4 + + + + com.beetstra.jutf7 + jutf7 + 1.0.0 + diff --git a/common/src/main/java/org/apache/hertzbeat/common/entity/job/Metrics.java b/common/src/main/java/org/apache/hertzbeat/common/entity/job/Metrics.java index ef36438aaa0..dcde28bdb8e 100644 --- a/common/src/main/java/org/apache/hertzbeat/common/entity/job/Metrics.java +++ b/common/src/main/java/org/apache/hertzbeat/common/entity/job/Metrics.java @@ -33,6 +33,7 @@ import org.apache.hertzbeat.common.entity.job.protocol.HttpProtocol; import org.apache.hertzbeat.common.entity.job.protocol.HttpsdProtocol; import org.apache.hertzbeat.common.entity.job.protocol.IcmpProtocol; +import org.apache.hertzbeat.common.entity.job.protocol.ImapProtocol; import org.apache.hertzbeat.common.entity.job.protocol.JdbcProtocol; import org.apache.hertzbeat.common.entity.job.protocol.JmxProtocol; import org.apache.hertzbeat.common.entity.job.protocol.MemcachedProtocol; @@ -200,7 +201,7 @@ public class Metrics { */ private NginxProtocol nginx; /** - * Monitoring configuration information using the public Nginx protocol + * Monitoring configuration information using the public pop3 protocol */ private Pop3Protocol pop3; /** @@ -212,9 +213,13 @@ public class Metrics { */ private RedfishProtocol redfish; /** - * Monitoring configuration information using the public redfish protocol + * Monitoring configuration information using the public ngql protocol */ private NgqlProtocol ngql; + /** + * Monitoring configuration information using the public imap protocol + */ + private ImapProtocol imap; /** * collector use - Temporarily store subTask metrics response data diff --git a/common/src/main/java/org/apache/hertzbeat/common/entity/job/protocol/ImapProtocol.java b/common/src/main/java/org/apache/hertzbeat/common/entity/job/protocol/ImapProtocol.java new file mode 100644 index 00000000000..55444f7aeec --- /dev/null +++ b/common/src/main/java/org/apache/hertzbeat/common/entity/job/protocol/ImapProtocol.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +package org.apache.hertzbeat.common.entity.job.protocol; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * imap protocol + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ImapProtocol { + /** + * Receiving server address + */ + private String host; + + /** + * Receiving server port + */ + private String port; + + /** + * TIME OUT PERIOD + */ + private String timeout; + + /** + * Whether to enable SSL encryption [Email Transmission] + */ + private String ssl = "false"; + + /** + * IMAP Email address + */ + private String email; + + /** + * Authorization code + */ + private String authorize; + /** + * Mailbox folder name + */ + private String folderName; + +} diff --git a/home/docs/help/imap.md b/home/docs/help/imap.md new file mode 100644 index 00000000000..9a4a9904897 --- /dev/null +++ b/home/docs/help/imap.md @@ -0,0 +1,47 @@ +--- +id: imap +title: Monitoring detailed mailbox info +sidebar_label: mailbox Monitor +keywords: [Open Source Monitoring System, Open Source Network Monitoring, mailbox Monitor] +--- + +> IMAP, or Internet Message Access Protocol, allows you to retrieve detailed information from your email server. +> You can click on `Create New QQ Email Monitoring` or `Create New Netease Email Monitoring` to configure, or select `More Actions` to import existing configurations. + +### Enable IMAP Service + +If you want to use this monitoring type to monitor your email information, please first enable the IMAP service in your email: + +For example, in QQ Mail (other emails are similar): + +1. Go to `Mail Settings` +2. Find and enable the `IMAP/SMTP option` in `General` +3. Obtain the IMAP server domain, port number, whether to use SSL, and authorization code from the help section +4. Use the above information to configure in HertzBeat and collect monitoring metrics + +### Configuration Parameters + +| Parameter Name | Parameter Help Description | +|:--------------------|------------------------------------------------------------------------------------------------------------| +| Monitoring Host | IMAP mail server domain. Note ⚠️ do not include protocol headers (e.g., https://, http://). | +| Task Name | The name that identifies this monitoring task, which needs to be unique. | +| Enable SSL | Whether to enable SSL. | +| Port | The port provided by the website. | +| Connection Timeout | The wait timeout for the port connection, in milliseconds, default is 6000 ms. | +| IMAP Email Address | The email address to be monitored. | +| Authorization Code | The authorization code provided by the email server. | +| Monitoring Interval | The interval time for periodic data collection, in seconds, the minimum interval can be set to 30 seconds. | +| Binding Tags | Classification management tags for monitoring resources. | +| Description Notes | Additional identification and description notes for this monitoring task, users can leave notes here. | + +### Collection Metrics + +Collect information on each folder in the email (custom folders can be configured), as the metrics collected for each folder are the same, only a common set of metrics is listed below + +#### Metrics Collection: (Folder Name in Email) + +| Metric Name | Metric Unit | Metric Help Description | +|----------------------|-------------|-------------------------------------------------------| +| Total message count | None | The total number of emails in this folder | +| Recent message count | None | The number of recently received emails in this folder | +| Unseen message count | None | The number of unread emails in this folder | diff --git a/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/help/imap.md b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/help/imap.md new file mode 100644 index 00000000000..4b04a003ed6 --- /dev/null +++ b/home/i18n/zh-cn/docusaurus-plugin-content-docs/current/help/imap.md @@ -0,0 +1,47 @@ +--- +id: imap +title: 监控:邮箱详细信息监控 +sidebar_label: 邮箱信息监控 +keywords: [开源监控系统, 开源网络监控, 邮箱信息监控] +--- + +> IMAP,即Internet Message Access Protocol(互联网邮件访问协议),您可以通过这种协议从邮件服务器上获取邮箱的详细信息 +> 您可以点击`新建 QQ 邮箱监控`或`新建网易邮箱监控`并进行配置,或者选择`更多操作`,导入已有配置。 + +### 启用 IMAP 服务 + +如果您想使用此监控类型来监控您的邮箱信息,请先在您的邮箱上开启 IMAP 服务: + +以 QQ 邮箱为例 (其它邮箱类似): + +1. 进入`邮箱设置` +2. 在`常规`中找到开启 `IMAP/SMTP选项` +3. 在帮助中得到 IMAP 服务器域名,端口号,是否使用 SSL,以及授权码 +4. 使用以上信息在 HertzBeat 中进行配置,采集监控指标 + +### 配置参数 + +| 参数名称 | 参数帮助描述 | +|:----------|--------------------------------------------------| +| 监控Host | IMAP 邮件服务器域名。注意⚠️不带协议头 (例如: https://, http://) 。 | +| 任务名称 | 标识此监控的名称,名称需要保证唯一性。 | +| 启动 SSL | 是否启用 SSL。 | +| 端口 | 网站对外提供的端口。 | +| 连接超时时间 | 端口连接的等待超时时间,单位毫秒,默认6000毫秒。 | +| IMAP 邮箱地址 | 要进行监控的邮箱地址。 | +| 授权码 | 邮箱服务器提供的授权码。 | +| 监控周期 | 监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒。 | +| 绑定标签 | 对监控资源的分类管理标签。 | +| 描述备注 | 更多标识和描述此监控的备注信息,用户可以在这里备注信息。 | + +### 采集指标 + +对邮箱中各文件夹信息进行采集(可自行配置自定义的文件夹),由于各文件夹采集的指标相同,以下只列出一组通用的指标集合 + +#### 指标集合:(邮箱中文件夹名称) + +| 指标名称 | 指标单位 | 指标帮助描述 | +|----------|------|---------------| +| 邮件总数 | | 该文件夹下所有邮件数量 | +| 最近收到邮件总数 | | 该文件夹下最近收到邮件数量 | +| 未读邮件总数 | | 该文件夹下未读邮件数量 | diff --git a/home/sidebars.json b/home/sidebars.json index 4544b2403cb..9f15749657c 100755 --- a/home/sidebars.json +++ b/home/sidebars.json @@ -153,6 +153,7 @@ "help/fullsite", "help/ssl_cert", "help/nginx", + "help/imap", "help/pop3", "help/smtp", "help/ntp", diff --git a/manager/src/main/resources/define/app-netease_mailbox.yml b/manager/src/main/resources/define/app-netease_mailbox.yml new file mode 100644 index 00000000000..0088fa23ff1 --- /dev/null +++ b/manager/src/main/resources/define/app-netease_mailbox.yml @@ -0,0 +1,418 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# The monitoring type category:service-application service monitoring db-database monitoring mid-middleware custom-custom monitoring os-operating system monitoring +category: service +# Monitoring application type name (consistent with file name) eg: linux windows tomcat mysql aws... +app: netease_mailbox +# The app api i18n name +name: + zh-CN: 网易邮箱监控 + en-US: NetEase Mailbox +# The description and help of this monitoring type +help: + zh-CN: HertzBeat 使用 IMAP 协议对网易邮箱的详细信息进行采集监控。
您可以点击“新建 POP3”并进行配置,或者选择“更多操作”,导入已有配置。 + en-US: HertzBeat uses IMAP protocol to collect detailed metrics of NetEase mailbox.
You can click "New POP3" and configure it, or select "More Operations" to import the existing configuration. + zh-TW: HertzBeat 使用 IMAP 協議對網易郵箱的詳細信息進行採集監控。
您可以點擊“新建 POP3”並進行配置,或者選擇“更多操作”,導入已有配置。 +helpLink: + zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/imap + en-US: https://hertzbeat.apache.org/docs/help/imap +# Input params define for app api(render web ui by the definition) +params: + # field-param field key + - field: host + # name-param field display i18n name + name: + zh-CN: 目标Host + en-US: Target Host + # type-param field type(most mapping the html input type) + type: host + # required-true or false + required: true + # field-param field key + - field: ssl + # name-param field display i18n name + name: + zh-CN: 启动SSL + en-US: SSL + # When the type is boolean, the frontend will display a switch for it. + type: boolean + # required-true or false + required: false + - field: port + # name-param field display i18n name + name: + zh-CN: 端口 + en-US: Port + # type-param field type(most mapping the html input type) + type: number + # when type is number, range is required + range: '[0,65535]' + # required-true or false + required: true + # field-param field key + - field: timeout + # name-param field display i18n name + name: + zh-CN: 连接超时时间(ms) + en-US: Connect Timeout(ms) + # type-param field type(most mapping the html input type) + type: number + # when type is number, range is required + range: '[0,100000]' + # required-true or false + required: true + # default value 6000 + defaultValue: 6000 + # field-param field key + - field: email + # name-param field display i18n name + name: + zh-CN: IMAP 邮箱地址 + en-US: Email + # type-param field type(most mapping the html input type) The type "text" belongs to a text input field. + type: text + # required-true or false + required: true + # field-param field key + - field: authorize + # name-param field display i18n name + name: + zh-CN: 授权码 + en-US: Authorize Code + # type-param field type(most mapping the html input type) The type "text" belongs to a text input field. + type: text + # required-true or false + required: true + +# collect metrics config list +metrics: + # metrics - available + - name: available + i18n: + zh-CN: 可用性 + en-US: Available + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 0 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: responseTime + type: 0 + unit: ms + i18n: + zh-CN: 响应时间 + en-US: Response Time + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: placeholder + + - name: inboxInfo + i18n: + zh-CN: 收件箱信息 + en-US: Inbox info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + - field: recentMessageCount + type: 0 + i18n: + zh-CN: 最近收到邮件总数 + en-US: Recent message count + - field: unseenMessageCount + type: 0 + i18n: + zh-CN: 未读邮件总数 + en-US: Unseen message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - INBOXTotalMessageCount + - INBOXRecentMessageCount + - INBOXUnseenMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = INBOXTotalMessageCount + - recentMessageCount = INBOXRecentMessageCount + - unseenMessageCount = INBOXUnseenMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: INBOX + + - name: sentInfo + i18n: + zh-CN: 已发送信息 + en-US: Sent info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - 已发送TotalMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = 已发送TotalMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: 已发送 + + - name: draftsInfo + i18n: + zh-CN: 草稿箱信息 + en-US: Drafts info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - 草稿箱TotalMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = 草稿箱TotalMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: 草稿箱 + + - name: deletedMessagesInfo + i18n: + zh-CN: 已删除信息 + en-US: Deleted Messages info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - 已删除TotalMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = 已删除TotalMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: 已删除 + + - name: JunkInfo + i18n: + zh-CN: 垃圾箱信息 + en-US: Junk info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + - field: recentMessageCount + type: 0 + i18n: + zh-CN: 最近收到邮件总数 + en-US: Recent message count + - field: unseenMessageCount + type: 0 + i18n: + zh-CN: 未读邮件总数 + en-US: Unseen message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - 垃圾邮件TotalMessageCount + - 垃圾邮件RecentMessageCount + - 垃圾邮件UnseenMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = 垃圾邮件TotalMessageCount + - recentMessageCount = 垃圾邮件RecentMessageCount + - unseenMessageCount = 垃圾邮件UnseenMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: 垃圾邮件 + + - name: virusInfo + i18n: + zh-CN: 病毒邮件信息 + en-US: Virus Info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + - field: recentMessageCount + type: 0 + i18n: + zh-CN: 最近收到邮件总数 + en-US: Recent message count + - field: unseenMessageCount + type: 0 + i18n: + zh-CN: 未读邮件总数 + en-US: Unseen message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - 病毒邮件TotalMessageCount + - 病毒邮件RecentMessageCount + - 病毒邮件UnseenMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = 病毒邮件TotalMessageCount + - recentMessageCount = 病毒邮件RecentMessageCount + - unseenMessageCount = 病毒邮件UnseenMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: 病毒邮件 diff --git a/manager/src/main/resources/define/app-qq_mailbox.yml b/manager/src/main/resources/define/app-qq_mailbox.yml new file mode 100644 index 00000000000..785708c57f2 --- /dev/null +++ b/manager/src/main/resources/define/app-qq_mailbox.yml @@ -0,0 +1,418 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# The monitoring type category:service-application service monitoring db-database monitoring mid-middleware custom-custom monitoring os-operating system monitoring +category: service +# Monitoring application type name (consistent with file name) eg: linux windows tomcat mysql aws... +app: qq_mailbox +# The app api i18n name +name: + zh-CN: QQ 邮箱监控 + en-US: QQ Mailbox +# The description and help of this monitoring type +help: + zh-CN: HertzBeat 使用 IMAP 协议对 QQ 邮箱的详细信息进行采集监控。
您可以点击“新建 POP3”并进行配置,或者选择“更多操作”,导入已有配置。 + en-US: HertzBeat uses IMAP protocol to collect detailed metrics of QQ mailbox.
You can click "New POP3" and configure it, or select "More Operations" to import the existing configuration. + zh-TW: HertzBeat 使用 IMAP 協議對 QQ 郵箱的詳細信息進行採集監控。
您可以點擊“新建 POP3”並進行配置,或者選擇“更多操作”,導入已有配置。 +helpLink: + zh-CN: https://hertzbeat.apache.org/zh-cn/docs/help/imap + en-US: https://hertzbeat.apache.org/docs/help/imap +# Input params define for app api(render web ui by the definition) +params: + # field-param field key + - field: host + # name-param field display i18n name + name: + zh-CN: 目标Host + en-US: Target Host + # type-param field type(most mapping the html input type) + type: host + # required-true or false + required: true + # field-param field key + - field: ssl + # name-param field display i18n name + name: + zh-CN: 启动SSL + en-US: SSL + # When the type is boolean, the frontend will display a switch for it. + type: boolean + # required-true or false + required: false + - field: port + # name-param field display i18n name + name: + zh-CN: 端口 + en-US: Port + # type-param field type(most mapping the html input type) + type: number + # when type is number, range is required + range: '[0,65535]' + # required-true or false + required: true + # field-param field key + - field: timeout + # name-param field display i18n name + name: + zh-CN: 连接超时时间(ms) + en-US: Connect Timeout(ms) + # type-param field type(most mapping the html input type) + type: number + # when type is number, range is required + range: '[0,100000]' + # required-true or false + required: true + # default value 6000 + defaultValue: 6000 + # field-param field key + - field: email + # name-param field display i18n name + name: + zh-CN: IMAP 邮箱地址 + en-US: Email + # type-param field type(most mapping the html input type) The type "text" belongs to a text input field. + type: text + # required-true or false + required: true + # field-param field key + - field: authorize + # name-param field display i18n name + name: + zh-CN: 授权码 + en-US: Authorize Code + # type-param field type(most mapping the html input type) The type "text" belongs to a text input field. + type: text + # required-true or false + required: true + +# collect metrics config list +metrics: + # metrics - available + - name: available + i18n: + zh-CN: 可用性 + en-US: Available + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 0 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: responseTime + type: 0 + unit: ms + i18n: + zh-CN: 响应时间 + en-US: Response Time + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: placeholder + + - name: inboxInfo + i18n: + zh-CN: 收件箱信息 + en-US: Inbox info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + - field: recentMessageCount + type: 0 + i18n: + zh-CN: 最近收到邮件总数 + en-US: Recent message count + - field: unseenMessageCount + type: 0 + i18n: + zh-CN: 未读邮件总数 + en-US: Unseen message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - INBOXTotalMessageCount + - INBOXRecentMessageCount + - INBOXUnseenMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = INBOXTotalMessageCount + - recentMessageCount = INBOXRecentMessageCount + - unseenMessageCount = INBOXUnseenMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: INBOX + + - name: sentInfo + i18n: + zh-CN: 已发送信息 + en-US: Sent info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - Sent MessagesTotalMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = Sent MessagesTotalMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: Sent Messages + + - name: draftsInfo + i18n: + zh-CN: 草稿箱信息 + en-US: Drafts info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - DraftsTotalMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = DraftsTotalMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: Drafts + + - name: deletedMessagesInfo + i18n: + zh-CN: 已删除信息 + en-US: Deleted Messages info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - Deleted MessagesTotalMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = Deleted MessagesTotalMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: Deleted Messages + + - name: JunkInfo + i18n: + zh-CN: 垃圾箱信息 + en-US: Junk info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + - field: recentMessageCount + type: 0 + i18n: + zh-CN: 最近收到邮件总数 + en-US: Recent message count + - field: unseenMessageCount + type: 0 + i18n: + zh-CN: 未读邮件总数 + en-US: Unseen message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - JunkTotalMessageCount + - JunkRecentMessageCount + - JunkUnseenMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = JunkTotalMessageCount + - recentMessageCount = JunkRecentMessageCount + - unseenMessageCount = JunkUnseenMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: Junk + + - name: QQMailInfo + i18n: + zh-CN: QQ邮件订阅信息 + en-US: QQ Mail Subscribe Info + # metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel + # priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue + priority: 1 + # collect metrics content + fields: + # field-metric name, type-metric type(0-number,1-string), instance-is instance primary key, unit-metric unit + - field: allMessageCount + type: 0 + i18n: + zh-CN: 邮件总数 + en-US: Total message count + - field: recentMessageCount + type: 0 + i18n: + zh-CN: 最近收到邮件总数 + en-US: Recent message count + - field: unseenMessageCount + type: 0 + i18n: + zh-CN: 未读邮件总数 + en-US: Unseen message count + # (optional)metrics field alias name, it is used as an alias field to map and convert the collected data and metrics field + aliasFields: + - 其他文件夹/QQ邮件订阅TotalMessageCount + - 其他文件夹/QQ邮件订阅RecentMessageCount + - 其他文件夹/QQ邮件订阅UnseenMessageCount + # mapping and conversion expressions, use these and aliasField above to calculate metrics value + calculates: + - allMessageCount = 其他文件夹/QQ邮件订阅TotalMessageCount + - recentMessageCount = 其他文件夹/QQ邮件订阅RecentMessageCount + - unseenMessageCount = 其他文件夹/QQ邮件订阅UnseenMessageCount + # the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk + protocol: imap + # Specific collection configuration when protocol is http protocol + imap: + # http host: ipv4 ipv6 domain + host: ^_^host^_^ + # http port + port: ^_^port^_^ + # timeout + timeout: ^_^timeout^_^ + # enable SSL/TLS, that is, whether it is http or https, the default is false + ssl: ^_^ssl^_^ + # email + email: ^_^email^_^ + # authorize code + authorize: ^_^authorize^_^ + # mailbox folder name + folderName: 其他文件夹/QQ邮件订阅