Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

OpenTSDB CLI Tools

Updated on 2024-08-16 GMT+08:00

OpenTSDB provides client tools that can directly invoke commands to operate OpenTSDB. The version of a client tool is the same as that of the open source community. For details, visit https://opentsdb.net/docs/build/html/user_guide/cli/index.html.

Usage of the client tools:

  1. Log in to any Master node.
  2. Run the following command to initialize environment variables:

    source /opt/client/bigdata_env

  3. If the Kerberos authentication is enabled for the current cluster, run the following command to authenticate the user. If the Kerberos authentication is disabled for the current cluster, skip this step.

    kinit MRS cluster user

    For example, kinit opentsdbuser

  4. Run the tsdb command. For example, you can run the tsdb command to print all commands supported by OpenTSDB, such as, fsck, import, mkmetric, query, tsd, scan, search, uid, and version.

    tsdb: error: unknown command ''
    usage: tsdb <command> [args]
    Valid commands: fsck, import, mkmetric, query, tsd, scan, search, uid, version

Creating an OpenTSDB Metric

Create a metric that can be saved to OpenTSDB. For example, run the tsdb mkmetric sys.cpu.user command to create sys.cpu.user.

Start run net.opentsdb.tools.UidManager, args: assign metrics sys.cpu.user
metrics sys.cpu.user: [0, 0, 6]

Querying the OpenTSDB Metric

You can run the tsdb command to obtain the metric saved in OpenTSDB, for example, tsdb uid metrics sys.cpu.user.

Start run net.opentsdb.tools.UidManager, args: metrics sys.cpu.user
metrics sys.cpu.user: [0, 0, 6]

To obtain more information, run the tsdb uid command.

Start run net.opentsdb.tools.UidManager, args:
Not enough arguments
Usage: uid <subcommand> args
Sub commands:
  grep [kind] <RE>: Finds matching IDs.
  assign <kind> <name> [names]: Assign an ID for the given name(s).
  rename <kind> <name> <newname>: Renames this UID.
  delete <kind> <name>: Deletes this UID.
  fsck: [fix] [delete_unknown] Checks the consistency of UIDs.
        fix            - Fix errors. By default errors are logged.
        delete_unknown - Remove columns with unknown qualifiers.
                         The "fix" flag must be supplied as well.

  [kind] <name>: Lookup the ID of this name.
  [kind] <ID>: Lookup the name of this ID.
  metasync: Generates missing TSUID and UID meta entries, updates
            created timestamps
  metapurge: Removes meta data entries from the UID table
  treesync: Process all timeseries meta objects through tree rules
  treepurge <id> [definition]: Purge a tree and/or the branches
            from storage. Provide an integer Tree ID and optionally
            add "true" to delete the tree definition

Example values for [kind]: metrics, tagk (tag name), tagv (tag value).
  --config=PATH    Path to a configuration file (default: Searches for file see docs).
  --idwidth=N      Number of bytes on which the UniqueId is encoded.
  --ignore-case    Ignore case distinctions when matching a regexp.
  --table=TABLE    Name of the HBase table where to store the time series (default: tsdb).
  --uidtable=TABLE Name of the HBase table to use for Unique IDs (default: tsdb-uid).
  --verbose        Print more logging messages and not just errors.
  --zkbasedir=PATH Path under which is the znode for the -ROOT- region (default: /hbase).
  --zkquorum=SPEC  Specification of the ZooKeeper quorum to use (default: localhost).
  -i               Short for --ignore-case.
  -v               Short for --verbose.

Importing Data to the OpenTSDB Metric

You can run the tsdb import command to import metric data in batches.

  • Prepare metric data, for example, the importData.txt file that contains the following content.
    sys.cpu.user 1356998400 41 host=web01 cpu=0
    sys.cpu.user 1356998401 42 host=web01 cpu=0
    sys.cpu.user 1356998402 44 host=web01 cpu=0
    sys.cpu.user 1356998403 47 host=web01 cpu=0
    sys.cpu.user 1356998404 42 host=web01 cpu=0
    sys.cpu.user 1356998405 42 host=web01 cpu=0
  • Run the tsdb import importData.txt command to import metric data.
    Start run net.opentsdb.tools.TextImporter, args: importData.txt
    2019-06-26 15:45:22,091 INFO  [main] TextImporter: reading from file:importData.txt
    2019-06-26 15:45:22,102 INFO  [main] TextImporter: Processed importData.txt in 11 ms, 6 data points (545.5 points/s)
    2019-06-26 15:45:22,102 INFO  [main] TextImporter: Total: imported 6 data points in 0.012s (504.0 points/s)

Scanning the OpenTSDB Metric Data

You can run the tsdb query command to query the imported metric data in batches, for example, tsdb query 0 1h-ago sum sys.cpu.user host=web01.

Start run net.opentsdb.tools.CliQuery, args: 0 1h-ago sum sys.cpu.user host=web01
sys.cpu.user 1356998400000 41 {host=web01, cpu=0}
sys.cpu.user 1356998401000 42 {host=web01, cpu=0}
sys.cpu.user 1356998402000 44 {host=web01, cpu=0}
sys.cpu.user 1356998403000 47 {host=web01, cpu=0}
sys.cpu.user 1356998404000 42 {host=web01, cpu=0}
sys.cpu.user 1356998405000 42 {host=web01, cpu=0}

Deleting the Imported OpenTSDB Metric

You can run the tsdb uid delete command to delete the imported metric and its value, for example, tsdb uid delete metrics sys.cpu.user.

Start run net.opentsdb.tools.UidManager, args: delete metrics sys.cpu.user

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback