BK-Monitor custom report Python SDK.
- [Basic] BK-Monitor custom report API
- [Basic] convert prometheus metrics to BK-Monitor custom metrics
- [Basic] periodic reporting daemon
- [Contrib] Celery worker metrics custom report Blueprint
from bk_monitor_report import MonitorReporter
reporter = MonitorReporter(
data_id=123, # BK-Monitor Data ID
access_token="xx", # custom report Token
target="test", # report identifier
url="http://xxx:10205/v2/push/", # report gateway
)
# generate report data
reporter.generate_report_data()
# report manually
reporter.report()
# start periodic reporting daemon
reporter.start()
from bk_monitor_report import MonitorReporter
reporter = MonitorReporter(
data_id=123, # BK-Monitor Data ID
access_token="xx", # custom report Token
target="test", # report identifier
url="http://xxx:10205/v2/push/", # report gateway
)
reporter.report_event(
name="my_event", # event name
content="event content", # event content
dimension={"a": "b"} # custom dimensions
)
from bk_monitor_report import MonitorReporter
from bk_monitor_report.contrib.celery import MonitorReportStep
reporter = MonitorReporter(
data_id=123, # BK-Monitor Data ID
access_token="xx", # custom report Token
target="test", # report identifier
url="http://xxx:10205/v2/push/", # report gateway
)
MonitorReportStep.setup_reporter(reporter)
# init celery app
app = Celery("proj")
# set Blueprint if worker pool is not prefork
from bk_monitor_report.contrib.celery import MonitorReportStep
app.steps["worker"].add(MonitorReportStep)
# connect worker process init signal if worker pool is prefork
from celery.signals import worker_process_init
worker_process_init.connect(reporter.start, weak=False)
pip install bk-monitor-report
- bk forum
- bk DevOps online video tutorial(In Chinese)
- Contact us, technical exchange QQ group:
- BK-CI:a continuous integration and continuous delivery system that can easily present your R & D process to you.
- BK-BCS:a basic container service platform which provides orchestration and management for micro-service business.
- BK-PaaS:an development platform that allows developers to create, develop, deploy and manage SaaS applications easily and quickly.
- BK-SOPS:an lightweight scheduling SaaS for task flow scheduling and execution through a visual graphical interface.
- BK-CMDB:an enterprise-level configuration management platform for assets and applications.
If you have good ideas or suggestions, please let us know by Issues or Pull Requests and contribute to the Blue Whale Open Source Community.
Based on the MIT protocol. Please refer to LICENSE