OpenNMS 利用 Sentinel处理Netflow(流量流向分析)

别说谁变了你拦得住时间么 提交于 2019-11-25 22:12:49

准备环境

  • CentOS-7-x86_64
  • Java8
  • OpenNMS 23.0.4
  • minion-23.0.4
  • sentinel-23.0.4
  • elasticsearch-6.7.1.tar.gz

OpenNMS 配置

1 配置ActiveMQ

vi $OPENNMS_HOME/etc/opennms-activemq.xml

取消注释

<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?useJmx=false&amp;maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>

2 添加minion用户

角色选择 ROLE_MINION和 ROLE_ADMIN

minion/minion

启动 Elasticsearch

bin/elasticsearch -d

Minion 配置

1 配置控制器

config:edit org.opennms.minion.controller
config:property-set location Office-Pittsboro
config:property-set http-url http://127.0.0.1:8980/opennms
config:property-set broker-url failover:tcp://127.0.0.1:61616
config:update

scv:set opennms.http minion minion
scv:set opennms.broker minion minion

2 重启 Minion

查看状态

health:check

#需要先安装minion-core

feature:install minion-core

3 配置侦听

config:edit org.opennms.features.telemetry.listeners-udp-8877
config:property-set name Netflow-5
config:property-set class-name org.opennms.netmgt.telemetry.listeners.udp.UdpListener
config:property-set listener.port 8877
config:update

Sentinel 配置

1 配置控制器

config:edit org.opennms.sentinel.controller
config:property-set location Sentinel-Flows
config:property-set http-url http://127.0.0.1:8980/opennms
config:property-set broker-url failover:tcp://127.0.0.1:61616
config:update

scv:set opennms.http minion minion
scv:set opennms.broker minion minion

查看状态

health:check

#需要先安装 sentinel-core

feature:install sentinel-core

2 配置数据源

config:edit org.opennms.netmgt.distributed.datasource
config:property-set datasource.url jdbc:postgresql://127.0.0.1:5432/opennms
config:property-set datasource.username opennms
config:property-set datasource.password opennms
config:property-set datasource.databaseName opennms
config:update

3 配置适配器

config:edit org.opennms.features.telemetry.adapters-netflow5
config:property-set name Netflow-5
config:property-set class-name org.opennms.netmgt.telemetry.adapters.netflow.v5.Netflow5Adapter
config:update

4 安装插件

feature:install sentinel-jms
feature:install sentinel-flows

查看状态,保证所有服务 [ Success  ]

health:check

检查数据

curl http://localhost:9200/_cat/shards

Sentinel 自动配置

<?xml version="1.0" encoding="UTF-8"?>
<features
        name="opennms-23.0.4"
        xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.4.0 http://karaf.apache.org/xmlns/features/v1.4.0"
>
    <!-- Bootstrap feature to start all flow related features automatically -->
    <feature name="autostart-sentinel-flows" version="23.0.4" start-level="100" install="auto">
        <!-- Configure the controller itself -->
        <config name="org.opennms.sentinel.controller">
            location = Sentinel-Flows
            id = 00000000-0000-0000-0000-000000ddba11
            http-url = http://127.0.0.1:8980/opennms
            broker-url = failover:tcp://127.0.0.1:61616
        </config>

        <!-- Configure datasource connection -->
        <config name="org.opennms.netmgt.distributed.datasource">
            datasource.url = jdbc:postgresql://localhost:5432/opennms
            datasource.username = opennms
            datasource.password = opennms
            datasource.databaseName = opennms
        </config>
        <!--
            Starts the Netflow5Adapter to process Netflow5 Messages.
            Be aware, that this requires a Listener with name "Netflow-5" on the Minion-side to have messages
            processed properly.
        -->
        <config name="org.opennms.features.telemetry.adapters-netflow5">
            name = Netflow-5
            class-name = org.opennms.netmgt.telemetry.adapters.netflow.v5.Netflow5Adapter
        </config>
        <!-- Point sentinel to the correct elastic endpoint -->
        <config name="org.opennms.features.flows.persistence.elastic">
            elasticUrl = http://127.0.0.1:9200
        </config>
        <!-- Install JMS related features -->
        <feature>sentinel-jms</feature>
        <!-- Install Flow related features -->
        <feature>sentinel-flows</feature>
    </feature>
</features>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!