AOSOM-Streaming 指南
AOSOM-Streaming 概述
AOSOM 流式处理是演示软件,不适用于生产环境。
您可以将 Apstra 配置为为计数器数据 (perfmon)、提醒和事件生成 Google Protocol Buffe (protobuf) 流。每种数据类型都通过其自己的 TCP 套接字发送到流式传输接收器。即使为同一个流式传输接收器配置了所有三种数据类型,也会在 Apstra 服务器和流接收器之间创建三个连接。这也允许将所有三种类型发送到三种不同的流接收器。您可以从众多开源项目中进行选择,也可以开发自己的解决方案来捕获、存储和检查 protobuf 数据。Apstra 在 GitHub 上开发了一个名为 AOSOM-Streaming 的项目,用于演示如何使用多个开源组件实现这一点。AOSOM-Streaming 项目旨在帮助您了解如何使用 AOS protobuf 流。它仅用于演示目的,Apstra Telegraf 输入插件除外。Apstra 软件完全支持此插件,可将其用作流遥测解决方案的一部分。
Aosom Streaming 项目提供了一个打包式解决方案,用于收集和可视化来自 Apstra 服务器的遥测流信息。这提供了 Web 界面体验和示例查询来处理警报、计数器和 Apstra 事件。这个开源项目 正式存在于 https://github.com/Apstra/aosom-streaming 年的 Github 上。
一揽子解决方案包括:
- 基于 Grafana 的图形界面(端口 3000)
- Prometheus for Counters and Alerts(端口 9090)
- Influxdb for Events(端口 8086)
- 2 个收集器,每个基于 Telegraf 的数据库一个。
格拉法纳
在 Web 浏览器中,输入 URL http://<aosom-streaming>:3000 ,然后输入用户名 admin (默认)和密码 admin (默认)。
grafana GUI 包括两个主要部分(左上角)。 Apstra AOS 蓝图 描述了整体遥测警报和流量吞吐量,以及用于接口遥测的单个设备。使用 Apstra“telegraf”Docker 容器自动学习蓝图;无需进一步配置。
在上面的屏幕截图中,我们可以观察演示 Apstra 环境中的流量,并汇总 CPU、流量和错误。
要基于特定设备和单个设备过滤遥测事件,请将顶部的仪表板更改为 Apstra AOS 设备。在这里,我们可以观察到蓝图中有两个活动路由异常,并且 Apstra 已收到两个叶交换机的遥测数据。
向下滚动以查看 CPU 和内存等设备统计信息:
普罗 米修斯
Prometheus 用于 Aosom 流式传输设备中的警报和设备遥测计数器存储。在 Web 浏览器中,输入 URL http://<aosom-streaming>:9090 以访问 Prometheus GUI。
当传入事件出现时,Apstra 会动态构建每个查询。若要查看示例查询名称,请在“execute”下开始键入。从“alert”(警报)开始,它会以选项卡完成 prometheus 从 Apstra 收到的可用警报。
下面是 BGP 邻居脱机的示例。
InfluxDB的
InfluxDB 用于存储来自遥测流的 Apstra 事件。在 Web 浏览器中,输入 URL http://<aosom-streaming>:8083 以访问 InfluxDB。
我们可以通过查询显示可用的 influxdb 键,例如 show field keys 或 show measurements。
一旦我们知道了测量值,我们就可以查看数据和键, 请从<测量值中选择 *> -- 在本例中,我们将捕获 LAG 接口状态。
开发 influx-db 应用程序超出了本文档的范围。
配置 Aosom-Streaming
若要将遥测流式处理配置为此项目的一部分,需要编辑 variables.env
,运行 make start
文件并重新启动容器。无需配置 Apstra 服务器。有关启动、停止和清除数据的文档,请访问 https://github.com/Apstra/aosom-streaming
telegraf 项目连接到 Apstra API 并发布一个 IP:端口,Apstra 使用该端口将实时遥测数据流式传输回。
Apstra 服务器升级后重新配置 Aosom-streaming
构建 Aosom-Streaming VM(可选)
您可以构建自己的 Aosom 流式处理 VM,这是一个 Docker 容器。此步骤演示如何设置基本的 Docker 服务器。
安装 Ubuntu 16.04.2
下载 Ubuntu 16.04.2 ISO 并预配新的 VM。默认用户名是 aosom ,密码是 admin。
对于较大的蓝图,我们建议将 RAM 更改为至少 8GB,将 CPU 更改为至少 2 个 vCPU。可能还需要更多的磁盘空间。
资源 | 数量 |
---|---|
公羊 | 8GB |
中央处理器 | 2 个 vCPU |
网络 | 1 个 vNIC |
安装软件包
基于 Ubuntu 16.04.2 安装所需的软件包。
apt-get update
更新系统以确保所有软件包都是最新的。
apt-get install docker docker-compose git make curl openssh-server
aosom@ubuntu:~$ sudo apt-get install docker docker-compose git make curl openssh-server [sudo] password for aosom: Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: bridge-utils cgroupfs-mount containerd dns-root-data dnsmasq-base docker.io git-man liberror-perl libnetfilter-conntrack3 libperl5.22 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libyaml-0-2 patch perl perl-modules-5.22 python python-backports.ssl-match-hostname python-cached-property python-cffi-backend python-chardet python-cryptography python-docker python-dockerpty python-docopt python-enum34 python-funcsigs python-functools32 python-idna python-ipaddress python-jsonschema python-minimal python-mock python-ndg-httpsclient python-openssl python-pbr python-pkg-resources python-pyasn1 python-requests python-six python-texttable python-urllib3 python-websocket python-yaml python2.7 python2.7-minimal rename runc ubuntu-fan xz-utils Suggested packages: mountall aufs-tools btrfs-tools debootstrap docker-doc rinse zfs-fuse | zfsutils git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki git-svn diffutils-doc perl-doc libterm-readline-gnu-perl | libterm-readline-perl-perl make python-doc python-tk python-cryptography-doc python-cryptography-vectors python-enum34-doc python-funcsigs-doc python-mock-doc python-openssl-doc python-openssl-dbg python-setuptools doc-base python-ntlm python2.7-doc binutils binfmt-support make The following NEW packages will be installed: bridge-utils cgroupfs-mount containerd dns-root-data dnsmasq-base docker docker-compose docker.io git git-man liberror-perl libnetfilter-conntrack3 libperl5.22 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libyaml-0-2 patch perl perl-modules-5.22 python python-backports.ssl-match-hostname python-cached-property python-cffi-backend python-chardet python-cryptography python-docker python-dockerpty python-docopt python-enum34 python-funcsigs python-functools32 python-idna python-ipaddress python-jsonschema python-minimal python-mock python-ndg-httpsclient python-openssl python-pbr python-pkg-resources python-pyasn1 python-requests python-six python-texttable python-urllib3 python-websocket python-yaml python2.7 python2.7-minimal rename runc ubuntu-fan xz-utils make 0 upgraded, 54 newly installed, 0 to remove and 3 not upgraded. Need to get 32.4 MB of archives. After this operation, 174 MB of additional disk space will be used. Do you want to continue? [Y/n] y
将 aosom 用户添加到 Docker 组。这允许“aosom”进行 Docker 配置更改,而无需升级到 sudo。
aosom@ubuntu:~/aosom-streaming$ sudo usermod -aG docker aosom Log out and log back in again for ‘aosom’ user to be properly added to the group.
使用“git clone”复制 Aosom-streaming Docker 容器。
aosom@ubuntu:~$ git clone https://github.com/Apstra/aosom-streaming.git Cloning into 'aosom-streaming'... remote: Counting objects: 303, done. remote: Total 303 (delta 0), reused 0 (delta 0), pack-reused 303 Receiving objects: 100% (303/303), 64.10 KiB | 0 bytes/s, done. Resolving deltas: 100% (176/176), done. Checking connectivity... done. aosom@ubuntu:~$
设置容器重启策略
AOSOM-Streaming 软件包未设置 Docker 重启策略;这取决于您的编排工具链。打开 aosom-streaming/docker-compose.yml 并添加到 restart: always
每个服务指令中。这可确保 Docker 容器在服务重新启动后处于联机状态。
git diff docker-compose.yml
aosom@ubuntu:~/aosom-streaming$ git diff docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml index 799d4c5..0d0fcc2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,7 @@ services: - prometheus ports: - "3000:3000" + restart: always # ------------------------------------------------------------------------- # Prometheus - @@ -30,6 +31,7 @@ services: - '-config.file=/etc/prometheus/prometheus.yml' ports: - '9090:9090' + restart: always # ------------------------------------------------------------------------- # influxdb @@ -43,6 +45,7 @@ services: ports: - "8083:8083" - "8086:8086" + restart: always # ------------------------------------------------------------------------- # Telegraf - Prom @@ -57,6 +60,7 @@ services: - /etc/localtime:/etc/localtime ports: - '6666:6666' + restart: always # ------------------------------------------------------------------------- # Telegraf - Influx @@ -71,3 +75,4 @@ services: - /etc/localtime:/etc/localtime ports: - '4444:4444' + restart: always
variables.env
根据 Aosom-Streaming 应用程序设置部分设置和启动容器。
更改系统主机名
修改 /etc/hostname
为 aosom,并将环路 IP 从 ubuntu 更改 /etc/hosts
为 aosom。
故障 排除
虽然大多数故障排除信息都包含在 https://github.com/Apstra/aosom-streaming 的 Github 主页中,但您可以运行一些简单的命令来确保环境正常运行。
检查从 Apstra 到 Aosom-streaming 的日志
运行 Docker 日志 aosomstreaming_telegraf-influx_1
当 AOS 上发生遥测事件时,您应该会看到一个蓝图 ID 和一些 influxdb“写入”事件 - BGP、活动性、配置偏差等。
GetBlueprints() - Id 0033cf3f-41ed-4ddc-91f5-ea68318fba9b 2017-07-31T23:59:13Z D! Finished to Refresh Data, will sleep for 20 sec 2017-07-31T23:59:15Z D! Output [influxdb] buffer fullness: 11 / 10000 metrics. 2017-07-31T23:59:15Z D! Output [influxdb] wrote batch of 11 metrics in 5.612057ms 2017-07-31T23:59:20Z D! Output [influxdb] buffer fullness: 4 / 10000 metrics. 2017-07-31T23:59:20Z D! Output [influxdb] wrote batch of 4 metrics in 5.349171ms 2017-07-31T23:59:25Z D! Output [influxdb] buffer fullness: 11 / 10000 metrics. 2017-07-31T23:59:25Z D! Output [influxdb] wrote batch of 11 metrics in 4.68295ms 2017-07-31T23:59:30Z D! Output [influxdb] buffer fullness: 4 / 10000 metrics. 2017-07-31T23:59:30Z D! Output [influxdb] wrote batch of 4 metrics in 5.007029ms GetBlueprints() - Id 0033cf3f-41ed-4ddc-91f5-ea68318fba9b 2017-07-31T23:59:33Z D! Finished to Refresh Data, will sleep for 20 sec
确保容器正常运行
要查看并确保所有预期的容器都在运行,请运行 docker ps
:
aosom@ubuntu:~/aosom-streaming$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e03d003a2ef9 grafana/grafana:4.1.2 "/run.sh" 3 minutes ago Up 3 minutes 0.0.0.0:3000->3000/tcp aosomstreaming_grafana_1 3042d45f1107 prom/prometheus:v1.5.2 "/bin/prometheus -con" 3 minutes ago Up 3 minutes 0.0.0.0:9090->9090/tcp aosomstreaming_prometheus_1 429328fbb5ac apstra/telegraf:1.2 "telegraf -debug" 3 minutes ago Up 3 minutes 0.0.0.0:6666->6666/tcp aosomstreaming_telegraf-prom_1 0a84241e1366 apstra/telegraf:1.2 "telegraf -debug" 3 minutes ago Up 3 minutes 0.0.0.0:4444->4444/tcp aosomstreaming_telegraf-influx_1 f4d2deb0e428 influxdb:1.1.1-alpine "/entrypoint.sh influ" 3 minutes ago Up 3 minutes 0.0.0.0:8083->8083/tcp, 0.0.0.0:8086->8086/tcp aosomstreaming_influxdb_1