@f5devcentral/f5-teem

中文文档
1.6.1发布于 2023/04/27Apache-2.0CommonJS近 30 天下载 4964

Utility library for connecting iControlLX Extensions to Telemetry Entitlement Enforcement and Mediation (TEEM)

原始使用文档
文档目录8 节
  1. Usage
  2. Anonymous API Usage
  3. reportRecord API Usage
  4. Record functions
  5. Advanced usage
  6. Disable f5-teem from sending data
  7. Send custom Data
  8. Use TEEM staging environment

f5-teem

This library is for use by Automation Toolchain products. Its purpose is to interface with F5's TEEM infrastructure to provide usage analytics to F5.

Usage

const TeemDevice = require('@f5devcentral/f5-teem').Device;
const assetInfo = {
    name: 'Declarative Onboarding',
    version: '1.2.3'
};
const teemDevice = new TeemDevice(assetInfo);
const declaration = <incoming_declaration>;
teemDevice.report('Declarative Onboarding Telemetry Data', '1', declaration);

By default, f5-teem will send a report that includes

  • The type of device that on which the code is currently running (for example, 'BIG-IP')
  • The TMOS software version of the device on which the code is currently running
  • A count of each class type in the declaration

Note: these TEEM reports can error upon transmitting. It is best practice to catch any errors and handle them appropriatly. However, it is reasonable to discard any errors you receive, as TEEM (usually) should not prevent a project from executing. TEEM reports should not be blocking for your project, the responses are not useful.

Anonymous API Usage

In order to successfully send the information to the anonymous endpoint, an API Key will need to be provided.

Additionally, you can specify your machine id value as part of the assetInfo. This will take precedence over the automated check done if ran on a BIG-IP.

Currently, unless f5-teem is ran on a BIG-IP the product and productVersion cannot be determined and so will be labeled "unknown" in the output.

const TeemDevice = require('@f5devcentral/f5-teem').AnonymousDevice;
const assetInfo = {
    name: 'Declarative Onboarding',
    version: '1.2.3',
    id: '<ID of the machine>'
};
const teemDevice = new TeemDevice(assetInfo, <API_KEY>);
const declaration = <incoming_declaration>;
teemDevice.report('Declarative Onboarding Telemetry Data', '1', declaration);

Example rawTelemetry object sent by f5-teem

{
    "documentType": "Declarative Onboarding Telemetry Data",
    "documentVersion": "1",
    "digitalAssetId": "213d40c8-6d64-5682-b29d-bc2ac080c9e2",
    "digitalAssetName": "Declarative Onboarding",
    "digitalAssetVersion": "1.2.3",
    "observationStartTime": "2019-09-27T23:15:23.149Z",
    "observationEndTime": "2019-09-27T23:15:23.149Z",
    "epochTime": "1569626123149",
    "telemetryId": "345619b4-3e4c-429c-b15c-3ee73e3738a0",
    "telemetryRecords": [
        {
            "Device": 1,
            "Tenant": 1,
            "License": 1,
            "DNS": 1,
            "NTP": 1,
            "Provision": 1,
            "VLAN": 2,
            "SelfIp": 2,
            "platform": "BIG-IP",
            "platformVersion": "14.1.0.5"
        }
    ]
}

reportRecord API Usage

Both device and anonymousDevice have this API allowing users to specify what goes into the report, instead of using the predesigned reports. To do so, you first create and specify a record, and then the reportRecord(), will parse through it and send the information.

Here is an example of creating and sending a report using the Anonymous API.

Note: records use promises to gather the information.

const TeemDevice = require('@f5devcentral/f5-teem').AnonymousDevice;
const Record = require('@f5devcentral/f5-teem').Record;
const assetInfo = {
    name: 'Declarative Onboarding',
    version: '1.2.3',
    id: '<ID of the machine>'
};
const teemDevice = new TeemDevice(assetInfo, <API_KEY>);
const declaration = <incoming_declaration>;

const record = new Record('Declarative Onboarding Telemetry Data', '1');
return Promise.resolve()
    .then(() => record.addClassCount(declaration))
    .then(() => record.addJsonObject({ <Any JSON information you want to add> }))
    .then(() => record.addPlatformInfo())
    .then(() => teemDevice.reportRecord(record));

Record functions

Can be used anywhere

  • addClassCount(declaration) - Accepts and parses the declaration, adding the number of classes it finds. Can be called multiple times, incrementing the number of found classes.
  • addJsonObject(jsonObject) - Accepts a JSON object and adds it directly to the record.

Must be ran on a BIG-IP

  • addPlatformInfo() - Pulls the platform information from localhost and parses it into the record.
  • addRegKey() - Pulls the RegKey information from localhost and adds it to the record.
  • addProvisionedModules() - Pulls and parses the available and provisioned modules and adds the provisioning level of each module to the record.
  • calculateAssetId() - Pulls the machineId and creates a hash, this will be used if no assetInfo.id is provided.

Advanced usage

Disable f5-teem from sending data

f5-teem honors the phone home setting. To disable f5-teem from sending data:

tmsh modify sys software update auto-phonehome disabled

Send custom Data

To send more than the default data, send extra records to the report API

const extraFields = {
    status: 'OK',
    firstRun: false
};
teemDevice.report('Declarative Onboarding Telemetry Data', '1', declaration, extraFields);

Use TEEM staging environment

  • edit the file /service/restnoded/run
    • before the lines that start restnoded, add the line:
    export TEEM_API_ENVIRONMENT='staging'
    
  • bigstart restart restnoded

版本与发布记录

@f5devcentral/f5-teem 共发布 15 个版本,首次发布于 2019/10/02;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.6.1latest2023/04/273 年前
1.5.02021/05/065 年前
1.4.72021/03/205 年前
1.4.62020/05/286 年前
1.4.52020/05/196 年前
1.4.42020/05/166 年前

关于 @f5devcentral/f5-teem 的常见问题

@f5devcentral/f5-teem 是什么?

Utility library for connecting iControlLX Extensions to Telemetry Entitlement Enforcement and Mediation (TEEM)

如何安装 @f5devcentral/f5-teem?

在项目目录运行 npm install @f5devcentral/f5-teem,或使用 pnpm add / yarn add / bun add。

@f5devcentral/f5-teem 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/f5devcentral__f5-teem 是否存在。

@f5devcentral/f5-teem 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@f5devcentral/f5-teem 可以商用吗?

@f5devcentral/f5-teem 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@f5devcentral/f5-teem 的下载量有多少?

根据 npm 官方下载统计,@f5devcentral/f5-teem 在 2026/10/14 – 2026/11/12 这 30 天内被下载 4,964 次,日均约 165 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@f5devcentral/f5-teem 还在维护吗?

最新版本 1.6.1 发布于 2023/04/27(3 年前);至今共发布 15 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/10/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。