xStats 通用 CSV 适配器快速入门指南

关于

本文档描述了使用 SevOne 网络管理系统(NMS)安装 xStats 通用 CSV 适配器的过程。 同样的程序应适用于以前的版本,但尚未进行测试。 本文件讨论了以下主题。

  • 为通用 CSV 适配器安装 xStats 软件包
  • 启动/停止每个适配器的模拟器
  • 为每个适配器配置采集器
重要: /opt/sevone-xstats 的所有权是 1003:1003 (UID:GID).

先决条件

在安装 xStats 适配器之前,您需要准备以下材料。

要求 描述
vPAS 的快照 如果使用虚拟化设备,请在开始之前创建 vPAS 的快照。 如果您需要从头开始,这将非常有用。
PAS 的 IP 地址或主机名 确保有 PAS 的 IP 地址或主机名,以便通过 SSH 连接到它。
热备用设备 (HSA) 对的 IP 地址 只有当您有一对 HSA 时才适用。
支持使用考绩制度 您需要为 SSH 会话输入支持用户名和密码。
重要: NMS 容器
要运行本指南中的命令,您必须在 NMS 容器中。 要进入 NMS 容器,请执行以下命令。

nms
SSH 客户端 要通过 SSH 进入 PAS,您需要使用 SSH 客户端,例如 PuTTY
PAS 版本 最好了解 PAS 上安装的 SevOne NMS 版本。
GenericCSVTransform-<version>.phar.spk

适用于 xStats 通用 CSV 适配器的安装包,即 IBM -SevOne-NPM-Solution-xStats-GenericCSVTransform-v <最新可用版本>。例如 IBM-SevOne-NPM-Solution-xStats-GenericCSVTransform-v7.0.0.phar.spk

可下载最新的. phar.spk 文件 IBM Passport Advantage ( https://www.ibm.com/software/passportadvantage/pao_download_software.html ) 通过 Passport Advantage Online 下载。 但是,如果您持有传统/灵活的 SevOne 合同,并且无法访问 IBM Passport Advantage 但持有 active 支持合同、请联系 SevOne 支持团队 以获取文件。

下载软件包后,请解压修复/升级包,获取所需文件。

请注意: 关键 xStats 条款
键 xStats 术语 描述
收款人 负责从远程或国外主机收集数据文件的脚本。
文件收集器聚合器守护进程 (fcad) 一个守护进程,负责收集数据文件并将其处理为可将数据插入 SevOne数据数据库的格式。
打包 安装在客户 PAS 上的组件,包含 xStats 适配器和 xStats 配置信息,包括解析器源代码和所有 对象 指标 设备-对象-指标设置。
注意:如果您有一个群集,并且只在其中一个对等体上安装 xStats 适配器,SevOne 建议安装在使用率最低的对等体上。 您也可以在 " 多对等安装 "中安装适配器。

下载通用 CSV 适配器

本节说明如何下载通用 CSV 适配器,该适配器可通过以下途径获取: - 访问 IBM Passport Advantage - 联系 Passport Advantage 在线支持团队- 或联系 SevOne 技术支持团队

  1. 使用 sshsupport 的身份登录 SevOne NMS 设备。
    ssh support@<NMS appliance>
    重要:从 NMS 容器运行以下命令。
  2. 您需要安装最新的通用 CSV 适配器软件包(. phar.spk )。 下载最新版本的. phar.spk 文件 IBMPassport Advantage 通过 Passport Advantage 在线获取或直接联系 SevOne 支持团队使用 wget 将文件下载至您的 SevOne NMS 设备 /var/support 目标目录:
    wget <location to download .phar.spk files from> -P /var/support

    例如 IBM-SevOne-NPM-Solution-xStats-GenericCSVTransform-v7.0.0.phar.spk 文件。

  3. 确保已成功下载. phar.spk 文件,且无任何错误。
    
    cd /var/support
    
    ls -al
    

通用 CSV 适配器

使用 sshsupport 的身份登录 SevOne NMS 设备。

ssh support@<NMS appliance>
重要: 安装命令 必须从 NMS 容器运行。
注意 :如果您已将 SevOne NMS从版本 6.x 升级到版本 7.x , 则必须在运行 /opt/sevone-xstats/GenericCSVTransform/bin/console.php脚本之前从命令行界面设置以下变量。

PHPRC=/config/php.d/php-cli.ini

HOME=/

安装通用 CSV 适配器

  1. 解压 CSV 软件包。

    示例

    
    cd /var/support
    
    
    php IBM-SevOne-NPM-Solution-xStats-GenericCSVTransform-v7.0.0.phar.spk
    
    #!/usr/bin/php
    更新了 ADK 共享库!
    软件包源移至 /opt/sevone-xstats/GenericCSVTransform
    同步 ADK 共享目录。[ 确定 ]
    同步适配器目录。[ 确定 ]
    
  2. 将目录更改为适配器提取文件的位置。

    示例

    cd /opt/sevone-xstats/GenericCSVTransform
  3. 检查以确保可以安装分析程序源。 选项 -c 只执行检查。

    示例

    
    php bin/console.php install -c
    
    适配器版本要求与 NMS 版本兼容
    可将适配器源插入数据库。
    可将对象类型插入数据库。
    
  4. 安装解析器存根

    示例

    php bin/console.php install
    
    适配器版本要求与 NMS 版本兼容
    可将适配器源插入数据库。
    可将对象类型插入数据库。
    适配器源已成功安装。
    对象已插入数据库。
    注意:要查看 console.php 脚本的可用命令,请输入以下命令。 代码块 outputclass="language-bourne">php bin/console.php
  5. (仅供参考) - 目前, SevOne NMS 中尚未创建 CSV 适配器的 xStats 收集源。 然而,在添加/编辑源的弹出窗口中, GenericCSVTransform 源类型是可用的。 执行以下操作即可查看。
    1. 从您选择的网络浏览器登录 SevOne NMS。
    2. 转到管理工具 > 监控配置 > xStats 源管理器。 您会注意到, CSV 适配器没有 xStats 集合源。

      xStatsCSVNoStats

    3. 单击添加来源按钮,弹出添加来源窗口。

      xStatsCSVAddSource

    4. 单击 源类型下拉菜单,查看可用的源类型。 您应该只看到一种源类型 GenericCSVTransform.

      xStatsCSVAddSourceType 通用 CSV

    5. 单击 Cancel 关闭。
  6. 如果使用 跳转 框,则此步骤适用于 只是 框。 您已为本地文件系统安装了 GenericCSVTransform 源类型,该类型显示为 GenericCSVTransform 显示在上面的弹出截图中。 如果计划使用本地文件系统而不是 SFTP,则可以跳过此步骤。 不过,如果您打算使用 SFTP 源类型,也需要安装它。

    输入以下命令安装 SFTP 源类型。

    
    php /opt/sevone-xstats/GenericCSVTransform/bin/console.php install-sftp
    
    已插入解析器源代码
    对象类型已插入/更新
    

    执行该命令后,单击 " 源类型 "下拉菜单时,SFTP 源类型 GenericCSVTransform SFTP 将出现在弹出窗口中。 您可能需要点击右上角的 刷新 ,才能从下拉列表中看到 GenericCSVTransform SFTP

    xStatsCSVAddSourceType 通用 CSV 与SFTP

运行模拟器并添加源代码

对于计划用于适配器的每种源类型,都需要三个 .json 文件,其中包含以下信息。

  1. 源的采集器配置设置
  2. 源的解析器配置设置
  3. 源的对象类型指标类型信息

请参阅准备.json 配置文件了解如何准备.json 文件。

启动模拟器

重要:模拟器用于测试目的。 在真实环境中,必须停止模拟器才能开始收集实际数据。 有关如何停止模拟器的详细信息,请参阅 " 停止/删除模拟器数据 "
ssh 客户端输入以下命令启动模拟器。

php /opt/sevone-xstats/GenericCSVTransform/bin/console.php start-simulator
设置模拟器配置!
添加模拟器 cron 作业!
为 localhost 添加 ssh 密钥!
模拟器已配置并启动!
要配置新的模拟器数据源,可以使用以下命令:

-----------------------------
用于轮廓l:
php bin/console.php configure --sourceName GenericCSVSimulator.
简介l --file simulator/config/simulator.collector.sample.lfs.profilel.json--parserConfigs
imulator/config/output-dir-1.config.parser.json --objectIndicatorTypes simulator/config/output-dir-1.object_indicator_type_info.json

-----------------------------
对于 Profile2:
php bin/console.php configure --sourceName GenericCSVSimulator Profile2 --file simulator/config/simulator.collector.sample.lfs.profile2.json --parserConfig s imulator/config/output-dir-2.config.parser.json --objectIndicatorTypes simulator/config/output-dir-2.object _indicator。
_type_info.json

-----------------------------
对于 Profile3:
php bin/console.php configure --sourceName GenericCSVSimulator_Profile3 --file simulator/config/simulator.collector.sample.lfs.profile3.json --parserConfig s imulator/config/output-dir-3.config-parser.json --objectIndicatorTypes simulator/config/output-dir-3.object
指示器 type_info.json
注意:运行上述命令启动模拟器时,输出将包含添加三个信号源的命令。 这些信号源专门用于模拟器。
现在您可以添加数据源了。

添加来源

要添加数据源,请执行以下操作。

  1. 添加第一个信息源。
    
    php /opt/sevone-xstats/GenericCSVTransform/bin/console.php \
    configure --sourceName GenericCSVSimulator_Profile1 \
    --file /opt/sevone-xstats/GenericCSVTransform/simulator/config/simulator.collector.sample.lfs.profile1.json \
    --parserConfig /opt/sevone-xstats/GenericCSVTransform/simulator/config/output-dir-1.config.parser.json \
    --objectIndicatorTypes /opt/sevone-xstats/GenericCSVTransform/simulator/config/output-dir-1.object_indicator_type_info.json
    
    objectIndicatorTypes 已验证
    parserConfig 是一个有效的解析器配置!!!
    可以创建源名称。
    配置文件似乎没问题。
    可以创建 Cron 条目。
    可创建日志和轮换。
    将数据源添加到数据库。
    数据源已插入数据库。
    收集器配置保存到 /opt/sevone-xstats/GenericCSVTransform/sources/source_1/config/collector.json.
    已配置收集器。
    已配置日志目录和轮换。
    配置成功。
    objectIndicatorTypes 已安装
    parserConfig 已安装
    
    注: 命令解释:
    • php /opt/sevone-xstats/GenericCSVTransform/bin/console.php configure - 这是添加源代码的命令,然后再添加必要的参数。
    • --sourceName GenericCSVSimulator_Profile1 - --sourceName 是第一个参数(也可以使用 -s) 指定源名称。 在本例中,源文件被命名为 GenericCSVSimulator_Profile1
    • -file /opt/sevone-xstats/GenericCSVTransform/simulator/config/simulator.collector.sample.lfs.profile1.json - 这是第二个参数。 参数 --file(也可以使用 -f),指向用于为该源配置收集器的 .json 文件。 参数后面是文件路径和文件名:/opt/sevone-xstats/GenericCSVTransform/simulator/config/simulator.collector.sample.lfs.profile1.json 。 您必须将路径替换为包含所添加源的采集器配置的 .json 文件的路径。
    • --parserConfig /opt/sevone-xstats/GenericCSVTransform/simulator/config/output-dir-1.config.parser.json - 这是第三个参数。 参数,--parserConfig,指向用于为该源码配置解析器的 .json 文件。 参数后面是文件路径和文件名:/opt/sevone-xstats/GenericCSVTransform/simulator/config/output-dir-1.config.parser.json 。 您必须将路径替换为包含所添加源的解析器配置的 .json 文件的路径。
    • --objectIndicatorTypes /opt/sevone-xstats/GenericCSVTransform/simulator/config/output-dir-1.object_indicator_type_info.json - 这是第四个参数。 参数 --objectIndicatorTypes, 指向 .json 文件,该文件包含此源代码的对象类型和指示器类型信息。 参数后面是文件路径和文件名:/opt/sevone-xstats/GenericCSVTransform/simulator/config/output-dir-1.object_indicator_type_info.json 。 您必须替换包含所添加源的对象类型和指示符类型信息的 .json 文件的路径。
  2. 添加第二个来源。
    
    php /opt/sevone-xstats/GenericCSVTransform/bin/console.php \
    configure --sourceName GenericCSVSimulator_Profile2 \
    --file /opt/sevone-xstats/GenericCSVTransform/simulator/config/simulator.collector.sample.lfs.profile2.json \
    --parserConfig /opt/sevone-xstats/GenericCSVTransform/simulator/config/output-dir-2.config.parser.json \
    --objectIndicatorTypes /opt/sevone-xstats/GenericCSVTransform/simulator/config/output-dir-2.object_indicator_type_info.json
    
  3. 添加第三个来源。
    
    php /opt/sevone-xstats/GenericCSVTransform/bin/console.php \
    configure --sourceName GenericCSVSimulator_Profile3 \
    --file /opt/sevone-xstats/GenericCSVTransform/simulator/config/simulator.collector.sample.lfs.profile3.json \
    --parserConfig /opt/sevone-xstats/GenericCSVTransform/simulator/config/output-dir-3.config.parser.json \
    --objectIndicatorTypes /opt/sevone-xstats/GenericCSVTransform/simulator/config/output-dir-3.object_indicator_type_info.json
    

返回已添加源的 SevOne NMS 设备。 从管理工具 > 监控配置 > xStats 源管理器 ,您将看到已为通过 ssh 客户端添加的每个源创建了 xStats 收集源。

xStatsCSVSourcesAdded

查看 Cron 文件、手动运行采集器及amp; 检查数据

  1. 您的SSH客户端中,输入以下命令以确认 CSV配器的cron文件已创建:
    
    ls -al /etc/cron.d
    
    total 8
    drwxr-xr-x.  2 root sevone 113 Aug 19 19:14.
    drwxr-xr-x. 80 root root 30 Aug 19 18:49.
    lrwxrwxrwx.  1 根 sevone 29 Aug 19 14:19 模式 -> /config/cron-available.d/mode
    lrwxrwxrwx.  1 根 sevone 35 Aug 19 14:19 sevone-nms -> /config/cron-available.d/sevone-nms
    -rw-r--r--. 1 root root 1045 Aug 19 19:14 xstats-GenericCSVTransform
    -rw-r--r--. 1 root root 436 Aug 19 19:12 xstats-GenericCSVTransformSimulator
    
  2. 要查看 cron 文件的内容,请输入以下命令。
    
    cat /etc/cron.d/xstats-GenericCSVTransform
    
    # SevOne xstats 适配卡 crontab 文件。
    # 全局变量
    外壳= /bin/bash
    PATH= /sbin : /bin : /usr/sbin:/usr/bin:/usr/local/bin
    MAILTO=""
    主页=/
    # crontab 格式:
    # <分钟> <小时> <月日> <星期> <用户> <要做什么
    
    
    */5 * * * 接收 php /opt/sevone-xstats/GenericCSVTransform/bin/console.php acquire-data --source 1 &>> /var/log/xstats/GenericCSVTransform/adapter.log
    #-------------------------------------------
    
    
    0 0 * * * 接收 php /opt/sevone-xstats/GenericCSVTransform/bin/console.php 清理 --source 1 &>> /var/log/xstats/GenericCSVTransform/adapter.log
    #-------------------------------------------
    
    
    
    */5 * * * 接收 php /opt/sevone-xstats/GenericCSVTransform/bin/console.php acquire-data --source 2 &>> /var/log/xstats/GenericCSVTransform/adapter.log
    #-------------------------------------------
    
    
    0 0 * * * 接收 php /opt/sevone-xstats/GenericCSVTransform/bin/console.php 清理 --source 2 &>> /var/log/xstats/GenericCSVTransform/adapter.log
    #-------------------------------------------
    
    
    */5 * * * 接收 php /opt/sevone-xstats/GenericCSVTransform/bin/console.php acquire-data --source 3 &>> /var/log/xstats/GenericCSVTransform/adapter.log
    #-------------------------------------------
    
    
    0 0 * * * 接收 php /opt/sevone-xstats/GenericCSVTransform/bin/console.php 清理 --source 3 &>> /var/log/xstats/GenericCSVTransform/adapter.log
    #-------------------------------------------
    

    每个源的 cron 作业计划每 5 分钟运行一次。 您将开始看到 /opt/sevone-xstats/GenericCSVTransform/sources/source_<id>/data/. 如果不想等待 cron 作业运行,可以通过输入以下命令手动运行每个源的收集器。

    示例:来源 1
    
    php /opt/sevone-xstats/GenericCSVTransform/bin/console.php acquire-data --source 1
    
    运行以下命令检查源 1 的数据目录中是否有文件。
    
    ls -la /opt/sevone-xstats/GenericCSVTransform/sources/source_1/data/
    
    示例:来源 2
    
    php /opt/sevone-xstats/GenericCSVTransform/bin/console.php acquire-data --source 2 
    
    运行以下命令检查源 2 的数据目录中是否有文件。
    
    ls -la /opt/sevone-xstats/GenericCSVTransform/sources/source_2/data/
    
    示例:来源 3
    
    php /opt/sevone-xstats/GenericCSVTransform/bin/console.php acquire-data --source 3 
    
    运行以下命令检查源 3 的数据目录中是否有文件。
    
    ls -la /opt/sevone-xstats/GenericCSVTransform/sources/source_3/data/
    
  3. 使用您选择的网络浏览器登录 SevOne NMS。
  4. 对于添加的三个源,您将看到 Administration > Monitoring Configuration > xStats 源管理器中的设备。
  5. 要查看 CSV 适配器的对象,请从" 设备 "菜单中选择 "对象管理器 "。
  6. Filter Options 弹出窗口中,单击 Plugin 下拉菜单并选择 xStats
  7. 点击 “对象类型 ”下拉菜单,选择所有 CSV 对象类型,或仅选择您要查看的特定源的对象类型。

    xStatsCSVObjectManagerFilterOptions

  8. 点击 “应用 ”以查看 CSV 对象列表。

    xStatsCSVObjectManager

注意: 要查看模拟器的 cron 文件,请输入以下命令。

cat /etc/cron.d/xstats-GenericCSVTransformSimulator
# Sevone xstats 适配卡 crontab 文件。
# 全局变量
外壳= /bin/bash
PATH= /sbin : /bin : /usr/sbin:/usr/bin:/usr/local/bin
MAILTO=""
主页=/
# crontab 格式:
# <分钟> <小时> <月日> <星期> <用户> <要做什么
*/5 * * * * root php /opt/sevone-xstats/GenericCSVTransform/simulator/simulator.php >> /var/10g/xstats/GenericCSVTransform/simulator.109 2>&1
# end of simulator cron[ root@quality532blank:/ ]

停止/删除模拟器数据

ssh 客户端输入以下命令删除模拟器 cron 文件。

rm /etc/cron.d/xstats-GenericCSVTransformSimulator
要删除每个源的.json 配置文件和数据文件,请运行以下命令。 这包括添加每个源时创建的 .json 文件。
示例:来源 1

rm -r /opt/sevone-xstats/GenericCSVTransform/sources/source_1/
示例:来源 2

rm -r /opt/sevone-xstats/GenericCSVTransform/sources/source_2/
示例:来源 3

rm -r /opt/sevone-xstats/GenericCSVTransform/sources/source_3/

输入以下命令删除模拟器数据输出文件。 这适用于为模拟器添加的所有三个信号源。

示例

rm -r /opt/sevone-xstats/GenericCSVTransform/simulator/simulatorData/

在 SevOne NMS 中执行以下操作以删除 设备

  1. 从导航栏 Administration > Monitoring Configuration > 选择 xStats Source Manager,您将看到与使用 xStats Source Manager 添加的每个源相关联的设备列表。 找到每个数据源的 xStats 采集源,然后单击 Devices 列下的链接。
  2. 从导航栏中,Devices > 选择 Device Manager
  3. 为与要删除的信号源相关联的每个设备选择复选框。
  4. 在页面顶部,单击 “将选定内容移至删除队列” 以将设备移动到删除队列。

    xStatsCSVDeviceManagerDeletion

准备.json 配置文件

创建要保存 .json 文件的目录。 例如,

cd /opt/sevone-xstats/GenericCsvTransform

mkdir prepared_json_files

cd prepared_json_files

mkdir source_1

cd source_1
您现在位于 /opt/sevone-xstats/GenericCsvTransform/prepared_json_files/source_1 目录中
  1. 准备 采集器配置文件。
    1. 复制 /opt/sevone-xstats/GenericCSVTransform/config/collector.sample.json 文件到目录 /opt/sevone-xstats/GenericCsvTransform/prepared_json_files/source_1.
      
      cp /opt/sevone-xstats/GenericCSVTransform/config/collector.sample.json \
      /opt/sevone-xstats/GenericCsvTransform/prepared_json_files/source_1/<filename>.json
      
      例如,
      
      cp /opt/sevone-xstats/GenericCSVTransform/config/collector.sample.json \
      /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/collector_source1.json
      
  2. 准备 解析器配置文件。
    1. 复制 /opt/sevone-xstats/GenericCSVTransform/config/parser.sample.json 文件到目录 /opt/sevone-xstats/GenericCsvTransform/prepared_json_files/source_1.
      
      cp /opt/sevone-xstats/GenericCSVTransform/config/parser.sample.json \
      /opt/sevone-xstats/GenericCsvTransform/prepared_json_files/source_1/<filename>.json
      
      例如,
      
      cp /opt/sevone-xstats/GenericCSVTransform/config/parser.sample.json \
      /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/parser_source1.json
      
  3. 准备对象类型指示器类型配置文件。
    1. 复制 /opt/sevone-xstats/GenericCSVTransform/config/object_types.sample.json 文件到目录 /opt/sevone-xstats/GenericCsvTransform/prepared_json_files/source_1.
      
      cp /opt/sevone-xstats/GenericCSVTransform/config/object_types.sample.json \
      /opt/sevone-xstats/GenericCsvTransform/prepared_json_files/source_1/<filename>.json
      
      例如,
      
      cp /opt/sevone-xstats/GenericCSVTransform/config/object_types.sample.json \
      /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/object_types_source1.json
      
  4. 准备 metadata 配置文件。
    1. 复制 /opt/sevone-xstats/GenericCSVTransform/config/metadata.sample.json 文件到目录 /opt/sevone-xstats/GenericCsvTransform/prepared_json_files/source_1.
      
      cp /opt/sevone-xstats/GenericCSVTransform/config/parser.sample.json \
      /opt/sevone-xstats/GenericCsvTransform/prepared_json_files/source_1/<filename>.json
      
      例如,
      
      cp /opt/sevone-xstats/GenericCSVTransform/config/metadata.sample.json \
      /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/metadata_source1.json
      
使用自己选择的文本编辑器,编辑每个 .json 文件,根据配置修改设置。 有关每个.json 文件配置变量的详细信息,请参见附录部分下的表格。
  1. 收集器 - 收集器.json 文件
  2. 解析器 - 解析.json 文件
  3. 对象类型和指标类型 - 对象类型和指标类型.json 文件
  4. 元数据 - 元数据配置.json 文件
更新.json 文件后,将其保存。

使用准备好的 .json 配置文件添加源代码

准备好三个 .json 文件后,就可以添加新源代码了。 以下添加源的命令包含四个主要部分。
  • 来源的名称。
  • 一个 .json 文件,包含用于配置采集器的设置。
  • 一个 .json 文件,包含用于配置解析器的设置。
  • .json 文件,其中包含用于配置对象类型和指标类型的设置。

php /opt/sevone-xstats/GenericCSVTransform/bin/console.php configure \
--sourceName GenericCSV_Source1 \
--file /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/collector_source1.json \
--parserConfig /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/parser_source1.json \
--objectIndicatorTypes \
/opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/object_types_source1.json
objectIndicatorTypes 已验证
parserConfig 是一个有效的解析器配置!!!
可以创建源名称。
配置文件似乎没问题。
可创建用于收集的 Crontab。
可创建日志和轮换。
将数据源添加到数据库。
数据源已插入数据库。
收集器配置保存到 /opt/sevone-xstats/GenericCSVTransform/sources/source_1/config/collector.json.
已配置收集器。
已配置日志目录和轮换。
配置成功。 objectIndicatorTypes 已安装 parserConfig 已安装
Administration > Monitoring Configuration > xStats Source Manager 中,您将看到新源已成功添加。

CSV 适配器安装指南

本节将详细介绍如何使用模拟器和不使用模拟器安装适配器。

带模拟器

计划在生产环境中使用 CSV 适配器前运行模拟器,请遵循以下步骤。

  1. 将 .spk 软件包上传到 PAS。
  2. 从 .spk 软件包中提取文件。
  3. 安装适配器。
  4. (可选) 添加 SFTP 源类型。 这仅适用于计划使用 SFTP(而非本地文件系统)的情况。
  5. 启动模拟器
  6. 为模拟器添加源代码。
  7. 在 SevOne NMS 中,从 Administration > Monitoring Configuration > xStats Source Manager 确认已添加源。
  8. 验证适配器的 cron 文件是否已创建,并查看 cron 文件的内容。
  9. (可选) 为每个源手动运行收集器。 如果不想等待 cron 作业自行运行,这将非常有用。
  10. 在 SevOne NMS 中,从 Administration > Monitoring Configuration > xStats 源管理器,确认设备显示为您添加的源。
  11. 在 SevOne NMS 中,从 Devices > Object Manager 确认对象存在。
  12. 停止模拟器并删除模拟器数据。
  13. 添加一个或多个源,供生产环境使用。 您需要为添加的每个源(即收集器、分析器和对象/指示器类型)准备三个预配置 .json 文件。
  14. 在 SevOne NMS 中,从 Administration > Monitoring Configuration > xStats Source Manager 确认已添加源。
  15. 为添加的每个源配置 metadata.json 文件,并将其复制到 /sources/source_<id>/ 中。
  16. (可选) 手动运行源的收集器。 如果您不想等待cron任务自行运行,这将非常有用。
  17. 在 SevOne NMS 中,从 Administration > Monitoring Configuration > xStats 源管理器,确认设备显示为您添加的源。
  18. 在 SevOne NMS 中,从 Devices > Object Manager 确认对象是否存在。

无模拟器

如果您计划在 生产环境 中使用适配器,而无需先运行模拟器,请按照以下步骤操作。

  1. 将 .spk 软件包上传到 PAS。
  2. 从 .spk 软件包中提取文件。
  3. 安装适配器。
  4. (可选) 添加 SFTP 源类型。 这仅适用于计划使用 SFTP(而非本地文件系统)的情况。
  5. 添加一个或多个源,供生产环境使用。 您需要为添加的每个源(即收集器、分析器和对象/指示器类型)准备三个预配置 .json 文件。
  6. 在 SevOne NMS 中,从 Administration > Monitoring Configuration > xStats Source Manager 确认已添加源。
  7. 为添加的每个源配置 metadata.json 文件,并将其复制到 /sources/source_<id>/ 中。
  8. 验证是否已创建适配器的 cron 文件,并查看 cron 文件的内容。
  9. (可选) 手动运行源的收集器。 如果不想等待 cron 作业自行运行,这将非常有用。
  10. 在 SevOne NMS 中,从 Administration > Monitoring Configuration > xStats 源管理器,确认设备显示为您添加的源。
  11. 在 SevOne NMS 中,从 Devices > Object Manager 确认对象存在。

常见问题

如何停止模拟器?

使用 sshsupport 的身份登录 SevOne NMS 设备。

ssh support@<NMS appliance>
  1. 获取模拟器的进程 ID (PID)。
    ps -ef | grep simulator
    root 5993 4748 0 06:29 pts/5 00:00:00 grep --color =auto simulator
    root 19058 1 0 Aug20? 00:00:00 SCREEN -dm php -S 0.0.0.0:8100 simulator.php
    root 19059 19058 0 Aug20 pts/0 00:00:43 php -S 0.0.0.0:8100 simulator.php
    root 24890 1 0 Aug20? 00:00:00 SCREEN -dm php -S 127.0.0.1:8081 /opt/sevone-xstats/GenericCSVTransform/simulator/simulator.php
    root 24891 24890 0 Aug20 pts/2 00:00:13 php -S 127.0.0.1:8081 /opt/sevone-xstats/GenericCSVTransform/simulator/simulator.php
    
  2. 选择要使用的 PID。 在上述命令的输出中,/opt/sevone-xstats/GenericCSVTransform/simulator/simulator.php 有两个列表。 您可以使用任一 PID。
  3. 输入以下命令停止模拟器。
    kill <PID>

    示例杀死 PID

    kill 24891
  4. 再次执行 grep 命令,确认模拟器已停止运行。 GenericCSVTransform simulator.php 的两个条目。
    ps -ef | grep simulator
    
    root 5993 4748 0 06:29 pts/5 00:00:00 grep --color =auto simulator
    root 19058 1 0 Sep30? 00:00:00 SCREEN -dm php -S 0.0.0.0:8100 simulator.php
    root 19059 19058 0 Sep30 pts/0 00:00:43 php -S 0.0.0.0:8100 simulator.php

如何删除 xStats 收集源?

执行以下步骤,从 SevOne 网络管理系统中删除通用 CSV 适配器 xStats 收集源。 请确保按以下 上市 的顺序执行步骤。

  1. 删除通用 CSV 适配器的cron文件。
    rm -r /config/cron.d/xstats-GenericCSVTransform
  2. 删除 SevOne NMS 中的 xStats 收集源。 从导航栏,转到管理工具 > 监控配置 > xStats 源管理器。 选择要删除的源,然后单击 trashCanIcon 将其删除。

    xStatsCSVDeleteSource

    您将看到以下弹出窗口。

    xStatsCSVDeleteOneSource

    如果要删除多个来源,可以选择要删除的来源的复选框。 单击 gearIcon 并选择 " 删除所选 ",删除所有要删除的选定来源。

    您将看到以下弹出窗口。

    xStatsCSVDeleteMultipleSources

    请注意: 您需要为此 xStats 采集源 删除 设备。 要在删除 xStats 集合源之前查看 devices 、在 xStats 源管理器中找到 GenericCSVTransform 并单击 Devices 下的链接。 这将显示需要删除的 设备列表。
  3. 删除日志文件。
    rm -r /config/cron.d/xstats-GenericCSVTransform
  4. 删除 SevOne NMS 中的 对象类型
    1. 从导航栏进入 Administration > Monitoring Configuration > Object Types
    2. 要删除通用适配器( CSV )的对象类型 ,请将光标置于左侧面板中的通用适配器( CSV )对象类型上,然后单击 trashCanIcon 以删除它。
      注: 要显示与 xStats 收集源相关的所有对象类型 (和指标类型 )列表,请通过 SSH 登录 PAS 并输入以下命令。
      more /opt/sevone-xstats/GenericCSVTransform/config/object_types.json
  5. 删除 SevOne NMS 中的 devices 。 请参阅 " 如何删除通用 xStats 适配器添加的设备 " 部分。
    1. 从导航栏进入 Devices > Device Manager
    2. 要删除通用 CSV 适配器的设备 ,请选择一个或多个设备,然后单击 “将选定项移至删除队列 ”。
  6. 删除 /opt/sevone-xstats/GenericCSVTransform 目录。
    rm -r /opt/sevone-xstats/GenericCSVTransform/

如何删除通用 xStats 适配器添加的设备?

在 SevOne NMS 中执行以下操作以删除 设备

  1. 您可以使用 xStats 源管理器查看与模拟器关联的 设备列表。 从导航栏进入 管理,选择 监控配置 > xStats 源管理器。 选择要删除设备的 xStats 源,然后单击 xStatsSourceDeleteDevices。 或者,单击要删除设备的 xStats 源的 Devices 下的链接。 这将显示需要删除的设备的列表。
  2. 您将弹出一个包含设备列表的窗口。 您可以选择要删除的设备。

    xStatsCSVChooseDevicesToDelete.

  3. 从导航栏进入 设备,然后选择 设备管理器
  4. 选中与要删除的模拟器关联的每个设备的复选框,然后单击 “将选定内容移至删除队列”

    xStatsCSVMoveDeviceToDeletion

    注意:除了停止模拟器之外,您还需要删除 /opt/sevone-xstats/GenericCSVTransform/config 中的模拟器收集器配置文件。

如何检查 xStats 适配器版本?

执行以下命令以验证通用 CSV 适配器的版本。

示例

php /opt/sevone-xstats/GenericCSVTransform/bin/console.php show-version --gitHash
版本: 8.1.0
Git 哈希 2a6fb977f4c783f5be51e3df0363426ebdca6304

如何检查采集器和解析器的状态?

您可以通过查看与之相关的心跳文件来了解收集器或分析器的状态。

  1. 要检查收集器状态,请输入以下命令查看收集器心跳文件。
    cat /var/log/xstats/GenericCSVTransform/collector_heartbeat.csv
    
    状态、时间戳、收集器、收集源、传输时间、数据量
    200,2024-08-20T14:15:15+0000,GenericCSVTransform,2::1270.0.1,1470,16440
    200,2024-08-20T14:15:15+0000,GenericCSVTransform,3::1270.0.1,1847,36324
    200,2024-08-20T14:15:16+0000,GenericCSVTransform,1::1270.0.1,1249,11352
    200,2024-08-20T14:20:16+0000,GenericCSVTransform,1::1270.0.1,704,0
    200,2024-08-20T14:20:16+0000,GenericCSVTransform,2::1270.0.1,486,0
    200,2024-08-20T14:20:16+0000,GenericCSVTransform,3::1270.0.1,534,0
    200,2024-08-20T14:25:14+0000,GenericCSVTransform,3::1270.0.1,1422,3026
    200,2024-08-20T14:25:14+0000,GenericCSVTransform,2::1270.0.1,957,1368
    200,2024-08-20T14:25:14+0000,GenericCSVTransform,1::1270.0.1,630,944
    200,2024-08-20T14:30:15+0000,GenericCSVTransform,2::1270.0.1,2736,2736
    200,2024-08-20T14:30:17+0000,GenericCSVTransform,1::1270.0.1,1861,1888
    200,2024-08-20T14:30:19+0000,GenericCSVTransform,3::1270.0.1,982,6052
    200,2024-08-20T14:35:13+0000,GenericCSVTransform,2::1270.0.1,730,0
    200,2024-08-20T14:35:13+0000,GenericCSVTransform,1::1270.0.1,664,0
    200,2024-08-20T14:35:13+0000,GenericCSVTransform,3::1270.0.1,599,0
    200,2024-08-20T14:40:20+0000,GenericCSVTransform,2::1270.0.1,1249,1372
    200,2024-08-20T14:40:20+0000,GenericCSVTransform,1::1270.0.1,1627,948
    ...
    ...

    每个适配器的采集器心跳文件提供以下信息。

    • 状态 HTTP状态代码。 200 表示请求成功,而 500 表示错误。
    • timestamp - 标记上次调用收集器的时间戳。
    • package - 采集器名称。
    • collection_source - xStats 集合源的名称
    • 转账时间 - 从 xStats 采集源 中检索文件或 物件 所需的时间。
    • data_volume - 传输的数据量。
  2. 要检查分析程序状态,请输入以下命令查看分析程序心跳文件。
    cat /var/log/xstats/GenericCSVTransform/parser_heartbeat.csv
    
    状态、时间戳、软件包、解析器、解析时间、已解析条目总数、已解析文件
    200,2024-08-20T14:15:18+0000,GenericCSVTransform,GenericCSVSimulator_Profile3,14,192,Device_30__1724163187.csv
    200,2024-08-20T14:15:18+0000,GenericCSVTransform,GenericCSVSimulator_Profile2,11,240,Device2_0__1724163187.csv
    200,2024-08-20T14:15:18+0000,GenericCSVTransform,GenericCSVSimulator_Profile1,13,336,Device1_0__1724163187.csv
    200,2024-08-20T14:15:19+0000,GenericCSVTransform,GenericCSVSimulator_Profile3,13,192,Device_31__1724163187.csv
    200,2024-08-20T14:15:19+0000,GenericCSVTransform,GenericCSVSimulator_Profile1,10,336,Device1_1__1724163187.csv
    200,2024-08-20T14:15:19+0000,GenericCSVTransform,GenericCSVSimulator_Profile2,11,240,Device2_1__1724163187.csv
    200,2024-08-20T14:25:16+0000,GenericCSVTransform,GenericCSVSimulator_Profile3,19,16,Device_30__1724163785.csv
    200,2024-08-20T14:25:16+0000,GenericCSVTransform,GenericCSVSimulator_Profile1,7,28,Device1_0__1724163785.csv
    200,2024-08-20T14:25:16+0000,GenericCSVTransform,GenericCSVSimulator_Profile2,8,20,Device2_0__1724163785.csv
    200,2024-08-20T14:25:17+0000,GenericCSVTransform,GenericCSVSimulator_Profile2,6,20,Device2_1__1724163785.csv
    200,2024-08-20T14:25:17+0000,GenericCSVTransform,GenericCSVSimulator_Profile1,7,28,Device1_1__1724163785.csv
    200,2024-08-20T14:25:17+0000,GenericCSVTransform,GenericCSVSimulator_Profile3,7,16,Device_31__1724163785.csv
    200,2024-08-20T14:30:20+0000,GenericCSVTransform,GenericCSVSimulator_Profile1,5,56,Device1_0__1724164087.csv
    200,2024-08-20T14:30:21+0000,GenericCSVTransform,GenericCSVSimulator_Profile2,7,40,Device2_0__1724164087.csv
    200,2024-08-20T14:30:21+0000,GenericCSVTransform,GenericCSVSimulator_Profile2,10,40,Device2_1__1724164087.csv
    200,2024-08-20T14:30:21+0000,GenericCSVTransform,GenericCSVSimulator_Profile3,8,32,Device_30__1724164087.csv
    200,2024-08-20T14:30:22+0000,GenericCSVTransform,GenericCSVSimulator_Profile1,5,56,Device1_1__1724164087.csv
    200,2024-08-20T14:30:22+0000,GenericCSVTransform,GenericCSVSimulator_Profile3,9,32,Device_31__1724164087.csv
    200,2024-08-20T14:40:23+0000,GenericCSVTransform,GenericCSVSimulator_Profile2,6,20,Device2_0__1724164686.csv
    ...
    ...

    每个适配器的解析器心跳文件提供以下信息

    • 状态 HTTP状态代码。 200 表示请求成功,而 500 表示错误。
    • timestamp - 调用解析器时的时间戳。
    • package - xStats 适配器的名称。
    • parser - 解析器的名称。
    • parse_time - 解析所需的时间。
    • total_parsed_entries - 指标值被翻译并发送摄取的次数。 这不包括忽略值和未知值。
    • parsed_file - 已解析文件的名称。

如果使用跳箱怎么办?

如果使用跳线盒,则需要在跳线盒上手动安装采集器,并通过 SFTP 连接到 SevOne 设备。

HSA 安装

请按照以下步骤在 HSA 配对上安装通用适配器。

  1. 将每个适配器的安装包(.phar.spk)复制到主动和被动设备上。
  2. 使用 ssh,以 support 的身份登录主动和被动设备。
  3. 在两个设备上执行以下命令。
    php IBM-SevOne-NPM-Solution-xStats-GenericCSVTransform-<version>.phar.spk
    
    示例
    php IBM-SevOne-NPM-Solution-xStats-GenericCSVTransform-v7.0.0.phar.spk
    
  4. 适配器必须仅安装在活动设备上。 如果尝试在被动设备上安装适配器,则会收到一条错误信息,说明设备未激活,因此无法继续此过程。
    注意: 尽管您不会在被动设备上安装适配器、xStats收集源将出现在 xStats源管理器中。(Administration > Monitoring Configuration > xStats Source Manager) 中、就像它们在主动设备上一样,这是数据库复制的结果。
  5. 为主动和被动设备上的每个适配器配置收集器。 此外,确保在两个设备上配置完全相同的收集器。
    注意: 对于通用 CSV 适配器,使用收集器是可选的
  6. 对于通用 CSV 适配器,您需要配置一项服务( 如SFTP 或SCP ),将文件推送到HSA对中的活动设备。
    注意: IP 地址必须是 HSA 对的 IP 地址,而不是单个 PAS 的 IP 地址。

    使用 HSA 对的 IP 地址将 .csv 文件从远程服务器复制到活动设备上的 /data 目录的 SCP 命令

    scp /<full_path_to_Generic_CSV_files>/*.csv \
    <user_name>@<IP_address_of_HSA_pair>:/opt/sevone-xstats/GenericCSVTransform/sources/source_<##>/data
    
    示例SCP 命令
    
    scp /Generic/CSV-files/*.csv \
    root@192.168.136.224:/opt/sevone-xstats/GenericCSVTransform/sources/source_1/data

多对等安装

在集群中的多个对等机上安装通用适配器不需要任何特殊要求。 您将以同样的方式在每个相关对等设备上安装适配器。

适配器可识别 Peer ID,该 ID 用于命名 xStats 采集源。 例如,

  • 在ID为1的对等节点上安装通用 CSV 适配器包,则通用 CSV 适配器的 xStats 集合源将命名为 GenericCSVTransform_1
  • 若在同一集群的另一对等节点上安装通用 CSV 适配器,且该节点 ID 为5,则通用 CSV 适配器的 xStats 集合源将为 GenericCSVTransform_5

示例:在多个对等设备上安装通用适配器

在本例中,Generic 适配器安装在集群中的两个对等设备上,每个对等设备都设置了 HSA。 执行以下步骤。

关于同行 1

对于适配器,通用 CSV ,在'活动'设备上

  1. 对每个适配器执行以下命令。
    php IBM-SevOne-NPM-Solution-xStats-GenericCSVTransform-<version>.phar.spk
  2. 安装每个适配器。
  3. 为每个适配器配置收集器。
    注: 通用 CSV 适配器可选配收集器。

对于适配器,通用 CSV ,在"被动"设备上

  1. 对每个适配器执行以下命令。
    php IBM-SevOne-NPM-Solution-xStats-GenericCSVTransform-<version>.phar.spk
    
  2. 为每个适配器配置收集器。
    注意:
    1. 通用 CSV 适配器可选配收集器。
    2. 在主动设备上配置收集器(每个适配器)所使用的规格必须与被动设备上的完全相同。

关于同行 2

对于适配器,通用 CSV ,在'活动'设备上

  1. 对每个适配器执行以下命令。
    php IBM-SevOne-NPM-Solution-xStats-GenericCSVTransform-<version>.phar.spk
    
  2. 安装每个适配器。
  3. 为每个适配器配置收集器。
    注: 通用 CSV 适配器可选配收集器。

对于适配器,通用 CSV ,在"被动"设备上

  1. 对每个适配器执行以下命令。
    php IBM-SevOne-NPM-Solution-xStats-GenericCSVTransform-<version>.phar.spk
    
  2. 为每个适配器配置收集器。
    注意:
    1. 通用 CSV 适配器可选配收集器。
    2. 在主动设备上配置收集器(每个适配器)所使用的规格必须与被动设备上的完全相同。

故障诊断

收藏家问题

无法连接到远程设备 - SFTP 问题

大多数采集器要求启用 SFTP。 如果您在连接到正在收集数据文件的 远程 设备时遇到问题,则可能需要在该设备上启用 SFTP。 测试方法之一是尝试使用 SFTP 连接 远程 设备。 如果您无法通过 SFTP 连接,这可能意味着 SFTP 服务器没有在 远程 设备上运行。 在这种情况下,您需要启用 SFTP 服务器。 如果采集器要求在远程设备上启用 SFTP,这很可能会解决问题。

无法连接到远程设备 - 身份验证问题

收集器需要成功验证 远程设备,然后才能收集数据文件。 如果您在验证时遇到困难,可能是以下问题之一造成的。

  • 用户名/密码组合不正确。
  • 远程 设备上的密码已过期。

xStats 问题

软件包无法正确安装

如果在软件包安装过程中遇到错误,请向 Expert Labs 报告。

xStats 收集源已创建,但未显示任何设备

设备只有在收集器将新文件传输到检索目录后才会显示。 例如,如果您的收集器每三十分钟运行一次,您就需要等待一段时间。 如果本地目录中已有文件,fcad可能无法立即获取它们。 在这种情况下,您可以使用 touch 命令来 trick 使 fcad 认为这些文件刚刚到达。

前往通用 CSV 适配器的/data目录 输入touch [文件名],然后按下回车键。 之后,请刷新 xStats 源管理器页面。 这时应该会出现一个或多个 设备

注: 通用 CSVxStats 适配器:默认检索目录
  • CSV 适配器:/opt/sevone-xstats/GenericCSVTransform/sources/source_<##>/data

即使触摸了文件,设备仍然不显示

xStats 源管理器,为没有显示 devices 的适配器编辑 xStats 集合源,并确保检索目录正确。 通用 xStats 适配卡的默认检索目录是:

  • CSV 适配器:/opt/sevone-xstats/GenericCSVTransform/sources/source_<##>/data

如果一切正常,可能是您安装的软件包有问题。 请联系专家实验室以解决问题。

设备显示出来,但没有对象出现

对象无法显示时,通常与发现过程有关。 以下步骤将指导您完成 SevOne NMS 的发现过程。

  1. 转到设备 > 设备管理器

    xStatsCSVDeviceDiscovery

  2. 选择有关设备。 做出选择后,单击 gearIcon 并选择 " 发现"。 然后选择 发现。 给 "发现 "号一个机会,让它顺其自然。 单击 刷新 刷新页面。 对象应开始显示。

显示设备的对象和指示器,但图表中未显示数据

这很可能是回填问题,首次运行适配器时如果有大量数据文件,就会出现这种问题。 数据应该很快就会显示出来。 在这种情况下,有时可能需要一个小时。

模拟器问题

如果运行模拟器后没有获得任何数据,请运行以下命令。

SevOne-act check xstats-permissions
此命令将检查本地对等设备上 xStats 的各种权限问题。 如果遇到任何权限问题,请联系 IBM SevOne 支持

附錄

使用自己选择的文本编辑器,编辑每个 .json 文件,根据配置修改设置,然后保存 .json 文件。

收集器.json 文件

举例说明:收集器 .json 文件


cat /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/collector_source1.json
{
    "adapterName": "GenericCSVTransform",
    "logFile": ""/var/log/xstats/GenericCSVTransform/collector.log"、
    "heartbeatFile": ""/var/log/xstats/GenericCSVTransform/collector_heartbeat.csv"、
    "lastPollRepository": "本地文件系统"、
    "操作系统":"ubuntu"、
    "sourceType": "真实"、
    "debug": true、
    "用户名":"root"、
    "密码":"",
    "publicKey": ""/opt/sevone-xstats/GenericCSVTransform/simulator/id_rsa.pub"、
    "privateKey": "/opt/sevone-xstats/GenericCSVTransform/simulator/id_rsa",
    "密码":"",
    "remoteHostname": "127.0.0.1",
    "remoteDir": "/opt/sevone-xstats/GenericCSVTransform/simulator/simulatorData/output-dir-1",
    "端口":22,
    "thresholdDays": 2,
    "serviceType": "scp"、
    "截止": "2015-01-01T00:00:00",
    "regex":"/\\.*/",
    "dateStringFormat": "Ymd"、
    "dateTimezone": "协调世界时"、
    "dateRegex": "",
    "运行": true、
    "fullScan": 真
}
变量 描述
lastPollRepository 请指定以下选项之一。
  • localfilesystem - 如果收集器安装在 jump box 上。
  • database - 如果收集器安装在 SevOne primarysecondary HSA 设备上。
sourceType 请指定以下选项之一。
  • real - 如果您直接连接到远程服务器。
  • jumpbox - 如果您通过跳转盒连接到远程服务器。
调试 设置为 true 会在日志文件中存储所有调试信息。 否则,请将此字段设置为 false
操作系统 指定远程服务器的操作系统。
  • Ubuntu
  • FreeBSD
  • SunOS
  • Solaris
  • Linux
  • CentOS
  • Gentoo
  • 其他
thresholdDays 文件可下载的最长天数。 不能下载超过该字段中指定天数的文件。
中断 下载文件的截止日期。 超过此日期的文件将无法下载。 请使用 yyyy-mm-ddThh:mm:ss 格式。
remoteDir 远程设备上用于收集文件的目录。
remoteHostname 远程设备的主机名或 IP 地址。
serviceType 用于从服务器下载文件的服务。 即 scpsftpftp
端口 远程 设备上要连接的端口
用户名 用于验证远程 设备的用户名。
密码 用于验证远程 设备的密码。
publicKey 用于验证远程 设备的公钥。 如果密码字段为空,就会使用此功能。
privateKey 用于验证远程 设备的私人密钥。 如果密码字段为空,就会使用此功能。
口令 私人密钥的口令(如果已设置解析)。
regex 文件下载时需要匹配的正则表达式。 格式应为 /regex/。 例如,/.csv/ 指定下载 .csv 文件。
全扫描 请指定以下选项之一。
  • true - 从远程目录及其子目录中收集文件。
  • false - 只从远程目录中收集文件。
dateStringFormat 文件名中时间戳的格式。
dataTimezone 适用于文件名时间戳的时区。
dateRegex 文件时间戳的正则表达式。
运行 输入 true 可收集数据,否则输入 false 。 如果输入 false,就可以停止为源收集文件,而无需移除源配置。 将 run 设置为 false 会禁用源。
(可选) adapterName 适配器的名称。 建议使用默认设置。 请联系 Expert Labs 更改设置。
(可选) logFile 适配器日志文件的名称,包括文件的完整路径。 建议使用默认设置。 请联系 Expert Labs 更改设置。
(可选) heartbeatFile 采集器心跳文件的名称,包括文件的完整路径。 建议使用默认设置。 请联系 Expert Labs 更改设置。

如有需要,请使用您选择的文本编辑器编辑并保存 /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/collector_source1.json 文件。

将文件复制到 /sources/source_<id>/config 文件夹。

cp /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/collector_source1.json /opt/sevone-xstats/GenericCSVTransform/sources/source_1/config/

解析器.json 文件

示例解析器 .json 文件


cat /opt/sevone-xstats/GeneicCSVTransform/prepared_json_files/source_1/parser_source1.json
{
    "分隔符":",",
    "additionalDelimiter": "",
    "maxColumns": 60,
    "maxCharsOnLine": 2048,
    "stringEnclosure": "\"",
    "typeMatchString": "%对象类型%"、
    "列":{
        "日期":3,
        "设备名称":0,
        "对象类型":2,
        "对象名称":1
    },
    "fileNameRegex": "",
    "timestampRound": 0,
    "设备":{
        "名称":"设备名称%"、
        "类型": "GenericCSVDevice_Test"
    },
    "对象":{
        "名称":"%对象名称%"、
        "类型":"%Object Type%"、
        "类": "GenericCSV_Test"
    },
    "时间戳":"%日期%"、
    "timestampFormat": "Y-m-d H:i:s"、
    "时区":"UTC"、
    "timestampRound": 300,
    "metadata":	{
        "设备":{
            " attr1 ":"%0%",
            " attr2 ":"%1%"
        },
        "对象":{
            " attr3 ":"%2%",
            " attr4 ":"%3%"
        },

    },
    "rowTypes": {
        "Profile1ObjectType_11": {
            "指标":{
                "IndicatorEpoch1": 4,
                "IndicatorSecondOfMinute1": 5,
                "IndicatorMinuteOfHour1": 6,
                "IndicatorHourOfDay1": 7,
                "IndicatorUnitA1": 8,
                "IndicatorUnitB1": 9,
                "IndicatorUnitC1": 10,
                "IndicatorRoundedSine1": 11
            }
        },
        "Profile1ObjectType_12": {
            "指标":{
                "IndicatorEpoch1": 4,
                "IndicatorSecondOfMinute1": 5,
                "IndicatorMinuteOfHour1": 6,
                "IndicatorHourOfDay1": 7
            }
        }
    }
}
变量 描述
分隔符 用于分隔列的分隔符。 默认值为 ,
additionalDelimiter 附加分隔符(如果有的话)。 只支持一个附加分隔符。
maxColumns 一行中的最大列数。 列数超过指定最大值的行将不会被解析。 缺省值是 60。
maxCharsOnLine 一行中的最大字符数。 字符数超过指定最大值的行将不会被解析。 默认值为 2048 个字符。
typeMatchString 用于匹配行类型的模板。
stringEnclosure 将从列中删除的字符。 默认值为 "
fileNameRegex 用于解析文件名的正则表达式。 如果没有 regex,就无法在模板中使用文件名。
报头 文件头的数量。 缺省值为 0。 如果设置为 2,文件的前两行将作为页眉读取。 标题中的数据使用 %headers[<headerIndex>][<columnIndex>] %。
可在模板中使用的带索引的列列表。
devicePrefix 与您要添加的源相关联的设备名称的前缀。 如果不在此处输入,设备名称中将不包含前缀。
  • 台设备
    • name - 设备名称。
    • type - 设备类型。
  • 对象
    • name - 对象的名称。
    • type - 对象类型。
    • class - 对象类别。
时间戳记 时间戳的模板。
timestampFormat 时间戳的格式。 如果缺少此项,将使用 unix 时间戳格式。
时区 数据所在的时区。 如果没有输入,该设置将默认为 UTC。 http://php.net/manual/en/timezones.php 提供了时区列表。
(可选) timestampRound 此设置用于对齐文件中的时间戳。 当时间戳差异不大时,这种方法很有用;它允许忽略微小的差异。 不过,使用该选项可能会导致数值被覆盖。 如果需要 SevOne NMS 中的所有时间戳,请勿使用此设置。
元数据 这是元数据信息,包括设备对象的属性。 通过该设置,您可以从.csv 文件中指定哪些数据要作为 SevOne NMS 元数据被注入。

此处添加的任何元数据信息都必须与元数据配置文件中添加的元数据信息相对应、 metadata.json. 请参阅元数据配置.json 文件

.
  • device - 对于要包含的每个设备属性,请在以下引号内提供列编号或列名称 attr1 等。 在上面的截图中,attr1 的值是 %0% 。 在这种情况下,所指的列是第 0 列。 列以 0 开头,这意味着这将是样本 .csv 文件中的第一列。 因此,右边的下一列将是第 1 列,这里用 %1% 表示。 另一方面,如果您选择使用列名,例如列名为设备名称,那么您将输入 %Device Name%
    • attr1 - 要包含的列编号或名称。
    • attr2 - 要包含的列编号或名称。
  • object - 对于要包含的每个对象属性,请在以下引号中提供列号或列名称 attr3 等。 在上面的截图中,attr3 的值是 %2% 。 在这种情况下,所指的列是第 2 列。 列以 0 开头,这意味着 %2% 将是示例 .csv 文件中的第三列。 另一方面,如果您选择使用列名,并且列名是 "对象名称",那么您可以输入 %Object Name%
    • attr3 - 要包含的列编号或名称。
    • attr4 - 要包含的列编号或名称。
rowTypes 为要支持的每一行指定解析配置。 如果所有行的类型相同,则可以使用 * 为所有行类型设置配置。 对于每种行类型,您都可以指定以下变量。
  • columns - 可在模板中使用的带有索引的列列表。 每种行类型的列都可以有不同的索引。
  • 台设备
    • name - 设备名称。
    • type - 设备类型。
  • 对象
    • name - 对象的名称。
    • type - 对象类型。
    • class - 对象类别。
  • timestamp - 时间戳的模板。
  • timestampFormat - 时间戳的格式。 如果缺少此项,将使用 unix 时间戳格式。
  • metadata - 元数据信息。 这可能包括设备和对象的属性。 通过这些设置,您可以从 .csv 文件中指定要作为 SevOne NMS 元数据摄取的数据。 详细信息请参见上面的元数据条目。 您在 rowTypes, 下输入的任何元数据信息将仅适用于行类型。
  • (可选)跳过 - 设置为 true 或 1 的行类型将被跳过。
  • indicators - 要使用的指标。 这应该是行中指标和列的列表。 在上面的截图中,首先提供的是指标名称,然后是值,即列索引。 列索引以 0 为基础。 您也可以使用负值从右向左指定索引。 例如,-1 表示从右边开始的第一列。 indicators 设置(如果配置)优先于 repeatableIndicators 设置。
  • repeatableIndicators - 用于指定可重复列组的设置。 如果每个指标有两列或三列,并且每个行类型有不同数量的指标,那么这将非常有用。 以下是您可以为该设置配置的选项。
    • name - 用于创建 指标名称的模板。
    • value - 用于创建 indicator 值的模板。 这将是 %valueIdx%%columnName% 。 目前,此处不支持公式。
    • valueIdx - 包含 指标值的列的偏移量。 您可以将 %valueIdx% 用于特殊文本。
    • startIdx - 第一个索引,表示重复列的起始位置。
    • toupleLen - 组中的列数。 例如,如果我们有一行 "Device, Object, Date, Ind1, 1, Ind2, 2, Ind3, 3"、startIdx 将是 3toupleLen 将是 2
    • endIdx - 最后一组中最后一列的结束索引。 如果省略此项,解析器将尝试获取所有列直至末尾。
    • columns - 可以在模板中使用的列列表。 在这种情况下,索引实际上是在组中偏移的。 在上例中,indicator name 的索引为 0indicator value 的索引为 1
    • namesToSkip-您不想发射的任何 indicator 名称的列表。

如有需要,请使用您选择的文本编辑器编辑并保存 /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/parser_source1.json 文件。

将文件复制到 /sources/source_<id>/config 文件夹。

cp /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/parser_source1.json /opt/sevone-xstats/GenericCSVTransform/sources/source_1/config/

对象类型和指标类型.json 文件

示例:对象/指标类型 .json 文件


cat /opt/sevone-xstats/GeneicCSVTransform/prepared_json_files/source_1/object_types_source1.json
{
    "Profile1ObjectType_11": {
        "field_identifiers"(字段标识符): "Profile1ObjectType_11",
        "is_ignore"(忽略):0,
        "指标":[
            {
                "指标": "IndicatorEpoch1",
                "描述": "IndicatorEpoch1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            },
            {
                "指标": "IndicatorSecondOfMinute1",
                "描述": "IndicatorSecondOfMinute1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            },
            {
                "指标": "IndicatorMinuteOfHour1",
                "描述": "IndicatorMinuteOfHour1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            },
            {
                "指标": "IndicatorHourOfDay1",
                "描述": "IndicatorHourOfDay1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            },
            {
                "指标": "IndicatorUnitA1",
                "描述": "IndicatorUnitA1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            },
            {
                "指标": "IndicatorUnitB1",
                "描述": "IndicatorUnitB1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            },
            {
                "指标": "IndicatorUnitC1",
                "描述": "IndicatorUnitC1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            },
            {
                "指标": "IndicatorRoundedSine1",
                "描述": "IndicatorRoundedSine1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            }
        ]
    },
    "Profile1ObjectType_12": {
        "field_identifiers"(字段标识符): "Profile1ObjectType_12",
        "is_ignore"(忽略):0,
        "指标":[
            {
                "指标": "IndicatorEpoch1",
                "描述": "IndicatorEpoch1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            },
            {
                "指标": "IndicatorSecondOfMinute1",
                "描述": "IndicatorSecondOfMinute1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            },
            {
                "指标": "IndicatorMinuteOfHour1",
                "描述": "IndicatorMinuteOfHour1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            },
            {
                "指标": "IndicatorHourOfDay1",
                "描述": "IndicatorHourOfDay1",
                "类型":"GAUGE"、
                "可百分比":"0",
                "单位":"数字"、
                "data_units"(数据单位):"数字"、
                "is_default"(默认):"1",
                "is_ignore"(忽略):"0",
                "default_value"(默认值):"",
                "index_in_file": -1
            }
        ]
    }
}
变量 描述
字段指示符 对象类型。
是否忽略 在 SevOne NMS 中指定是否忽略(隐藏)对象类型的设置。
威胁
  • indicator - 指标类型的名称。
  • description - 要显示的名称。
  • type - 数据类型。 指定 GAUGE, COUNTER32, 或 COUNTER64.
  • percentable - 用于指定文件中的值是否代表百分比的设置。 1 表示它们确实代表百分比。 0 表示没有。
  • units - 显示结果的数据单位。
  • data_units - 要测量的数据单位。
  • is_default - 用于指定是否为新设备创建指示器的设置,即使该指示器未发射。
  • is_ignore - 一个设置,用于指定是否应在 SevOne NMS 中忽略(隐藏)指标。
  • default_value - 如果没有发射对象的指示符,则将发射的默认值。
  • (可选) index_in_file- 用于显示应用作指标值的列(在数据文件中)的索引的设置。 只有在解析器配置 .json 文件中的指标下指定 useObjectIndicatorTypes 时,此设置才适用。

如有需要,请使用您选择的文本编辑器编辑并保存 /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/object_types_source1.json 文件。

将文件复制到 /sources/source_<id>/config 文件夹。

cp /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/object_types_source1.json /opt/sevone-xstats/GenericCSVTransform/sources/source_1/config/

元数据配置.json 文件

范例:元数据 .json 文件

cat /opt/sevone-xstats/GeneicCSVTransform/prepared_json_files/source_1/metadata_source1.json
{
    "路径": "/opt/sevone-xstats/GenericCSVTransform/sources/",
    "命名空间": "GenericCSVTransform",
    "设备":{
        "文件名": ""deviceMetadata.json"、
        "前缀":"",
        "attributes": {

        }
    },
    "对象":{
        "文件名": ""objectMetadata.json"、
        "前缀":"",
        "attributes": {

        }
    }
}
变量 描述
台设备 对于在解析器配置 .json 文件中添加的每个 device 属性,都需要在本节中添加相应的属性类型。 可能的属性类型包括 string, ip, integer, macdateTime, regex, url, latLong.
  • (可选) prefix - 允许您添加前缀。 例如,如果在此处添加 csv_ 作为前缀,就会在 SevOne NMS 中看到 csv_attr1csv_attr2 。 如果另一个 xStats 适配卡的元数据属性名称相同,但类型不同,则前缀可以避免歧义。
  • 属性
    • attr1 - 您在解析器配置 .json 文件中为 attr1 添加的属性类型。 例如,如果您在解析器 .json 文件中添加的属性是一个字符串,那么您就可以在此处用引号输入 string
    • attr2 - 您在解析器配置 .json 文件中为 attr2 添加的属性类型。 例如,如果您在解析器 .json 文件中添加的属性是一个整数,那么您可以在此处输入 integer 并加上引号。
对象 对于在解析器配置 .json 文件中添加的每个 对象属性,都需要在本节中添加相应的属性类型。 可能的属性类型包括 string, ip, integer, macdateTime, regex, url, latLong.
  • (可选) prefix - 允许您添加前缀。 例如,如果在此处添加 csv_ 作为前缀,就会在 SevOne NMS 中看到 csv_attr3csv_attr4 。 如果另一个 xStats 适配卡的元数据属性名称相同,但类型不同,则前缀可以避免歧义。
  • 属性
    • attr3 - 您在解析器配置 .json 文件中为 attr3 添加的属性类型。 例如,如果您在解析器 .json 文件中添加的属性是 IP 地址,那么您可以在此处用引号输入 ip
    • attr4 - 您在解析器配置 .json 文件中为 attr4 添加的属性类型。 例如,如果您在解析器 .json 文件中添加的属性是经度和纬度,那么您可以在此处输入 latLong 并加上引号。
也可以配置以下变量,但建议保留默认值。 如果要更改以下变量的默认设置,请联系 SevOne 支持Expert Labs
  • 路径
  • 名称空间
  • 文件名

如有需要,请使用您选择的文本编辑器编辑并保存 /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/metadata_source1.json 文件。

将文件复制到 /sources/source_<id>/config 文件夹。

cp /opt/sevone-xstats/GenericCSVTransform/prepared_json_files/source_1/metadata_source1.json /opt/sevone-xstats/GenericCSVTransform/sources/source_1/config/