AOSOM-流媒体指南
AOSOM-流概述
AOSOM 流式传输是演示软件,不适用于生产环境。
您可以将 Apstra 配置为为计数器数据 (perfmon)、警报和事件生成 Google Protocol Buffer (protobuf) 流。每种数据类型都通过其自己的 TCP 套接字发送到流接收器。即使为同一个流式处理器配置了所有三种数据类型,也会在 Apstra 服务器和流式处理接收器之间创建三个连接。这也允许将所有三种类型发送到三个不同的流接收器。您可以从许多开源项目中进行选择,也可以开发自己的解决方案来捕获、存储和检查 protobuf 数据。Apstra 在 GitHub 上开发了一个名为 AOSOM-Streaming 的项目,以演示如何使用多个开源组件实现这一目标。AOSOM-Streaming 项目旨在帮助您了解如何使用 AOS protobuf 流。它仅用于演示目的,Apstra Telegraf 输入插件除外。Apstra 软件完全支持此插件,可用作流遥测解决方案的一部分。
Aosom 流处理项目提供了一个打包的解决方案,用于收集和可视化来自 Apstra 服务器的遥测流信息。这提供了 Web 界面体验和示例查询来处理警报、计数器和 Apstra 事件。这个开源项目正式存在于 https://github.com/Apstra/aosom-streaming 的Github上。
一揽子解决方案包括:
- 基于 Grafana 的图形界面(端口 3000)
- 用于计数器和警报的 Prometheus(端口 9090)
- 用于事件的 Influxdb(端口 8086)
- 2 个收集器,每个数据库一个基于 Telegraf。
格拉法纳
在 Web 浏览器中输入 URL http://<aosom-streaming>:3000 ,然后输入用户名 admin (默认)和密码 管理员 (默认)。
grafana GUI 包括两个主要部分(左上角)。 Apstra AOS 蓝图 描述了总体遥测警报和流量吞吐量,以及用于接口遥测的单个设备。蓝图是使用 Apstra 'telegraf' Docker 容器自动学习的;无需进一步配置。
在上面的屏幕截图中,我们可以观察演示 Apstra 环境中的流量,并汇总 CPU、流量和错误。
要根据特定和单个设备筛选遥测事件,请将顶部的仪表板更改为 Apstra AOS 设备。在这里,我们可以观察到蓝图中有两个活动的路由异常,并且 Apstra 已收到两个叶交换机的遥测数据。
向下滚动以查看 CPU 和内存等设备统计信息:
普罗 米修斯
Prometheus 用于 Aosom 流设备中的警报和设备遥测计数器存储。从网络浏览器中输入 URL http://<aosom-streaming>:9090 以访问 Prometheus GUI。
当传入事件出现时,Apstra 会动态构建每个查询。要查看示例查询名称,请开始在“执行”下键入。从“alert”开始,它会按选项卡完成 Prometheus 从 Apstra 收到的可用警报。
下面是 BGP 邻居脱机的示例。
流入数据库
InfluxDB 用于存储来自遥测流的 Apstra 事件。从 Web 浏览器中输入 URL http://<aosom-streaming>:8083 以访问 InfluxDB。
我们可以通过查询显示可用的 influxdb 键,例如 显示字段键 或 显示测量值。
知道测量值后,我们可以使用 <测量中选择* 来查看数据和键> -- 在本例中,我们将捕获 LAG 接口状态。
开发 influx-db 应用程序超出了本文档的范围。
配置 Aosom-Streaming
若要将遥测流式处理配置为此项目的一部分,请编辑 variables.env
、运行 make start
文件并重新启动容器。无需配置 Apstra 服务器。有关启动、停止和清除数据的文档,请访问 https://github.com/Apstra/aosom-streaming
telegraf 项目连接到 Apstra API,并发布一个 IP:Port,Apstra 使用该 IP:Port 将实时遥测数据流式传输回。
在 Apstra 服务器升级后重新配置 Aosom-streaming
构建 AOSOM 流式处理 VM(可选)
您可以构建自己的 Aosom 流式处理 VM,它是一个 Docker 容器。此步骤说明如何设置基本的 Docker 服务器。
安装 Ubuntu 16.04.2
下载 Ubuntu 16.04.2 ISO 并预配新的 VM。默认用户名为 aosom ,密码为 admin。
对于较大的蓝图,我们建议将 RAM 更改为至少 8GB,将 CPU 更改为至少 2 个 vCPU。可能还需要更多磁盘空间。
资源 | 数量 |
---|---|
Ram | 8GB |
Cpu | 2 个 vCPU |
网络 | 1 个虚拟网卡 |
安装软件包
基于 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 流式处理包不会设置 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 流式处理应用程序设置部分设置和启动容器。
更改系统主机名
修改 /etc/hostname
为 aosom,并将 ubuntu 的环回 IP /etc/hosts
更改为 aosom。
故障 排除
虽然大多数故障排除信息都包含在 https://github.com/Apstra/aosom-streaming 的 Github 主页中,但您可以运行一些简单的命令来确保环境正常运行。
检查从 Apstra 到 Aosom-streaming 的日志
aosomstreaming_telegraf-influx_1运行 Docker 日志
当 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