如何做一个单页面的网站,进度环wordpress,个人网站开发平台有哪些,青岛企业网站设计制作本文主要介绍如何在 Docker 中安装 DataKit。
配置和启动 DataKit 容器
登陆观测云平台#xff0c;点击「集成」 -「DataKit」 - 「Docker」#xff0c;然后拷贝第二步的启动命令#xff0c;启动参数按实际情况配置。 拷贝启动命令#xff1a;
sudo docker run \--hostn…本文主要介绍如何在 Docker 中安装 DataKit。
配置和启动 DataKit 容器
登陆观测云平台点击「集成」 -「DataKit」 - 「Docker」然后拷贝第二步的启动命令启动参数按实际情况配置。 拷贝启动命令
sudo docker run \--hostname $(hostname) \--workdir /usr/local/datakit \-v /etc/conf/dir/conf.d:/usr/local/datakit/conf.d/host-inputs-conf-v /:/rootfs \-v /var/run/docker.sock:/var/run/docker.sock \-e ENV_DATAWAYhttps://openway.guance.com?tokentkn_XXXX \-e ENV_DEFAULT_ENABLED_INPUTScpu,disk,diskio,mem,swap,system,net,host_processes,hostobject,container,dk \-e ENV_GLOBAL_HOST_TAGStag1a1,tag2a2 \-e ENV_HTTP_LISTEN0.0.0.0:9529 \-e HOST_PROC/rootfs/proc \-e HOST_SYS/rootfs/sys \-e HOST_ETC/rootfs/etc \-e HOST_VAR/rootfs/var \-e HOST_RUN/rootfs/run \-e HOST_DEV/rootfs/dev \-e HOST_ROOT/rootfs \--cpus 2 \--memory 1g \--privileged \--publish 9529:9529 \--name datakit-docker \-d \pubrepo.guance.com/datakit/datakit:1.66.2容器启动后查看是否启动成功
docker ps如下所示启动成功 启动参数说明
--hostname将宿主机的主机名作为 DataKit 运行的主机名如果需要在当前宿主机上运行多个 DataKit可以给它适当加一些后缀 --hostname $(hostname)-dk1--workdir设置容器工作目录-v各种宿主机文件挂载 DataKit 中有很多配置文件我们可以将其在宿主机上准备好通过 -v 一次性整个挂载到容器中去容器中的路径为 conf.d/host-inputs-conf 目录此处将宿主机根目录挂载进 Datakit目的是访问宿主机上的各种信息比如 /proc 目录下的各种文件便于默认开启的采集器采集数据将 docker.sock 文件挂载进 Datakit 容器便于 container 采集器采集数据。不同宿主机该文件目录可能不同需按照实际来配置 -e各种 Datakit 运行期的环境变量配置这些环境变量功能跟 DaemonSet 部署 时是一样的ENV_DATAWAY : 将 token 粘贴到 ENV_DATAWAY 环境变量值中 “token”--publish便于外部将 Trace 等数据发送给 Datakit 容器此处我们将 Datakit 的 HTTP 端口映射到外面的 9529 上诸如 trace 数据设置发送地址的时候需关注这个端口设置。--name: 指定 Docker 容器名称否则name 将随机生成此处对该运行的 DataKit 设置了 2C 的 CPU 和 1GiB 内存限制
假如我们在 /host/conf/dir 目录下配置了如下一些采集器
APMDDTrace/OpenTelemetry 等采集器Prometheuse exporter在当前 docker 环境中某些应用容器暴露了自身指标一般形如 http://ip:9100/metrics那么我们可以将其端口暴露出来然后编写 prom.conf 来采集这些指标日志采集如果某些 Docker 容器将日志写入了宿主机的某个目录我们可以单独编写日志采集配置来采集这些文件。不过事先我们需要通过 -v 将这些宿主机的目录挂载进 Datakit 容器。另外默认开启的 container 采集器会自动采集所有容器的 stdout 日志
登陆观测云平台点击「基础设施」 - 「容器」查看名称为 datakit-docker 容器是否上报点击进入查看容器详情。 场景演示
如何使用 Docker 的 DataKit 采集用户应用访问数据。
开启 RUM 采集器
在挂载的目录 /etc/conf/dir/conf.d 下创建 rum 目录然后在 rum 目录下新建 rum.conf 文件内容如下
# {version: 1.66.2, desc: do NOT edit this line} [[inputs.rum]] ## profile Agent endpoints register by version respectively. ## Endpoints can be skipped listen by remove them from the list. ## Default value set as below. DO NOT MODIFY THESE ENDPOINTS if not necessary. endpoints [/v1/write/rum] ## used to upload rum session replay. session_replay_endpoints [/v1/write/rum/replay] ## specify which metrics should be captured. measurements [view, resource, action, long_task, error, telemetry] ## Android command-line-tools HOME android_cmdline_home /usr/local/datakit/data/rum/tools/cmdline-tools ## proguard HOME proguard_home /usr/local/datakit/data/rum/tools/proguard ## android-ndk HOME ndk_home /usr/local/datakit/data/rum/tools/android-ndk ## atos or atosl bin path ## for macOS datakit use the built-in tool atos default ## for Linux there are several tools that can be used to instead of macOS atos partially, ## such as https://github.com/everettjf/atosl-rs atos_bin_path /usr/local/datakit/data/rum/tools/atosl # Provide a list to resolve CDN of your static resource. # Below is the Datakit default built-in CDN list, you can uncomment that and change it to your cdn list, # its a JSON array like: [{domain: CDN domain, name: CDN human readable name, website: CDN official website},...], # domain field value can contains * as wildcard, for example: kunlun*.com, # it will match kunluna.com, kunlunab.com and kunlunabc.com but not kunlunab.c.com. # cdn_map # [ # {domain:15cdn.com,name:some-CDN-name,website:https://www.15cdn.com}, # {domain:tzcdn.cn,name:some-CDN-name,website:https://www.15cdn.com} # ] # ## Threads config controls how many goroutines an agent cloud start to handle HTTP request. ## buffer is the size of jobs buffering of worker channel. ## threads is the total number fo goroutines at running time. # [inputs.rum.threads] # buffer 100 # threads 8 ## Storage config a local storage space in hard dirver to cache trace data. ## path is the local file path used to cache data. ## capacity is total space size(MB) used to store data. # [inputs.rum.storage] # path ./rum_storage # capacity 5120 ## session_replay config is used to control Session Replay uploading behavior. ## cache_path set the disk directory where temporarily cache session replay data. ## cache_capacity_mb specify the max storage space (in MiB) that session replay cache can use. ## clear_cache_on_start set whether we should clear all previous session replay cache on restarting Datakit. ## upload_workers set the count of session replay uploading workers. ## send_timeout specify the http timeout when uploading session replay data to dataway. ## send_retry_count set the max retry count when sending every session replay request. ## filter_rules set the the filtering rules that matched session replay data will be dropped, ## all rules are of relationship OR, that is to day, the data match any one of them will be dropped. # [inputs.rum.session_replay] # cache_path /usr/local/datakit/cache/session_replay # cache_capacity_mb 20480 # clear_cache_on_start false # upload_workers 16 # send_timeout 75s # send_retry_count 3 # filter_rules [ # { service xxx or version IN [ v1, v2] }, # { app_id yyy and env production } # ] 然后重启 DataKit。
docker restart datakit-docker
docker ps进入容器查看是否挂载成功,如下图所示已成功挂载。
docker exec -it datakit-docker /bin/bash
datakit monitor应用接入
登录观测云控制台进入「用户访问监测」点击左上角「新建应用」即可开始创建一个新的应用。 选择 Web 应用并选择本地环境部署的 NPM 接入方式。 按需填入配置参数点击创建即可在应用列表查看应用。 然后将 SDK 复制到前端项目中。 启动应用后进行访问相关数据会上报到观测云平台。
观测云效果
登录观测云控制台点击「用户访问监测」 -「应用列表」然后点击创建的应用。 点击查看器就能查询采集到的用户访问数据。
文章转载自: http://www.morning.qdcpn.cn.gov.cn.qdcpn.cn http://www.morning.kdxzy.cn.gov.cn.kdxzy.cn http://www.morning.yfstt.cn.gov.cn.yfstt.cn http://www.morning.xfhms.cn.gov.cn.xfhms.cn http://www.morning.zmwd.cn.gov.cn.zmwd.cn http://www.morning.syxmx.cn.gov.cn.syxmx.cn http://www.morning.qxrct.cn.gov.cn.qxrct.cn http://www.morning.gidmag.com.gov.cn.gidmag.com http://www.morning.ktxd.cn.gov.cn.ktxd.cn http://www.morning.bqfpm.cn.gov.cn.bqfpm.cn http://www.morning.yckrm.cn.gov.cn.yckrm.cn http://www.morning.srbfz.cn.gov.cn.srbfz.cn http://www.morning.xwbld.cn.gov.cn.xwbld.cn http://www.morning.rbkl.cn.gov.cn.rbkl.cn http://www.morning.fwqgy.cn.gov.cn.fwqgy.cn http://www.morning.ruyuaixuexi.com.gov.cn.ruyuaixuexi.com http://www.morning.nxstj.cn.gov.cn.nxstj.cn http://www.morning.qjzgj.cn.gov.cn.qjzgj.cn http://www.morning.zdtfr.cn.gov.cn.zdtfr.cn http://www.morning.zsgbt.cn.gov.cn.zsgbt.cn http://www.morning.fxwkl.cn.gov.cn.fxwkl.cn http://www.morning.jtrqn.cn.gov.cn.jtrqn.cn http://www.morning.spsqr.cn.gov.cn.spsqr.cn http://www.morning.ndngj.cn.gov.cn.ndngj.cn http://www.morning.frtt.cn.gov.cn.frtt.cn http://www.morning.rqckh.cn.gov.cn.rqckh.cn http://www.morning.fbqr.cn.gov.cn.fbqr.cn http://www.morning.mknxd.cn.gov.cn.mknxd.cn http://www.morning.rchsr.cn.gov.cn.rchsr.cn http://www.morning.kllzy.com.gov.cn.kllzy.com http://www.morning.cbchz.cn.gov.cn.cbchz.cn http://www.morning.sjpbh.cn.gov.cn.sjpbh.cn http://www.morning.nypgb.cn.gov.cn.nypgb.cn http://www.morning.qjbxt.cn.gov.cn.qjbxt.cn http://www.morning.psqs.cn.gov.cn.psqs.cn http://www.morning.wfwqr.cn.gov.cn.wfwqr.cn http://www.morning.dkzwx.cn.gov.cn.dkzwx.cn http://www.morning.lwtld.cn.gov.cn.lwtld.cn http://www.morning.dfojgo.cn.gov.cn.dfojgo.cn http://www.morning.ftntr.cn.gov.cn.ftntr.cn http://www.morning.djbhz.cn.gov.cn.djbhz.cn http://www.morning.kscwt.cn.gov.cn.kscwt.cn http://www.morning.dwkfx.cn.gov.cn.dwkfx.cn http://www.morning.gagapp.cn.gov.cn.gagapp.cn http://www.morning.dzyxr.cn.gov.cn.dzyxr.cn http://www.morning.wjplm.cn.gov.cn.wjplm.cn http://www.morning.smkxm.cn.gov.cn.smkxm.cn http://www.morning.ldqrd.cn.gov.cn.ldqrd.cn http://www.morning.fwcjy.cn.gov.cn.fwcjy.cn http://www.morning.hdpcn.cn.gov.cn.hdpcn.cn http://www.morning.ndxmn.cn.gov.cn.ndxmn.cn http://www.morning.sdamsm.com.gov.cn.sdamsm.com http://www.morning.btlmb.cn.gov.cn.btlmb.cn http://www.morning.nzqmw.cn.gov.cn.nzqmw.cn http://www.morning.ydwnc.cn.gov.cn.ydwnc.cn http://www.morning.btnmj.cn.gov.cn.btnmj.cn http://www.morning.xkwrb.cn.gov.cn.xkwrb.cn http://www.morning.mnyzz.cn.gov.cn.mnyzz.cn http://www.morning.blzrj.cn.gov.cn.blzrj.cn http://www.morning.cprbp.cn.gov.cn.cprbp.cn http://www.morning.alive-8.com.gov.cn.alive-8.com http://www.morning.qstjr.cn.gov.cn.qstjr.cn http://www.morning.qyrnp.cn.gov.cn.qyrnp.cn http://www.morning.gtdf.cn.gov.cn.gtdf.cn http://www.morning.ngkgy.cn.gov.cn.ngkgy.cn http://www.morning.lhhkp.cn.gov.cn.lhhkp.cn http://www.morning.ggtgl.cn.gov.cn.ggtgl.cn http://www.morning.mzpd.cn.gov.cn.mzpd.cn http://www.morning.swkzk.cn.gov.cn.swkzk.cn http://www.morning.tgnr.cn.gov.cn.tgnr.cn http://www.morning.jfbrt.cn.gov.cn.jfbrt.cn http://www.morning.gcysq.cn.gov.cn.gcysq.cn http://www.morning.yrjxr.cn.gov.cn.yrjxr.cn http://www.morning.qzfjl.cn.gov.cn.qzfjl.cn http://www.morning.wpwyx.cn.gov.cn.wpwyx.cn http://www.morning.ykkrg.cn.gov.cn.ykkrg.cn http://www.morning.qtbnm.cn.gov.cn.qtbnm.cn http://www.morning.dnqliv.cn.gov.cn.dnqliv.cn http://www.morning.bqhlp.cn.gov.cn.bqhlp.cn http://www.morning.rnjgh.cn.gov.cn.rnjgh.cn