(01)Java Agent采集数据
#java -jar -javaagent:/usr/share/skywalking/agent/skywalking-agent.jar -DSW_AGENT_NAME=MyServiceName -DSW_AGENT_NAMESPACE=MyNameSpace -DSW_AGENT_CLUSTER=MyCluster -DSW_AGENT_INSTANCE_NAME=MyInstanceName -DSW_AGENT_COLLECTOR_BACKEND_SERVICES=192.168.100.201:11800 -jar MyApplicationName.jar
(02)名称配置
1)服务名称
#The service name in UI
s e r v i c e n a m e = [ {service name} = [ servicename=[{group name}::]KaTeX parse error: Expected 'EOF', got '#' at position 14: {logic name} #̲The group name ...{SW_AGENT_NAME:Your_ApplicationName}
在命令行带参数:-DSW_AGENT_NAME=MyServiceName传入服务名称
2)名字空间
#The agent namespace
agent.namespace=${SW_AGENT_NAMESPACE:}
在命令行带参数:-DSW_AGENT_NAMESPACE传入名字空间
3)集群名称
#The agent cluster
agent.cluster=${SW_AGENT_CLUSTER:}
在命令行带参数:-DSW_AGENT_CLUSTER传入集群名称
4)实例名称
实例名称在没有配置时,默认使用uuid+@+ipv4地址拼接而成的字符串。在/usr/share/skywalking/agent/config/agent.config中
#Instance name is the identity of an instance, should be unique in the service. If empty, SkyWalking agent will generate an 32-bit uuid. BY Default, SkyWalking uses UUID@hostname as the instance name. Max length is 50(UTF-8 char)
agent.instance_name=${SW_AGENT_INSTANCE_NAME:MyInstanceName}
在命令行带参数:-DSW_AGENT_INSTANCE_NAME=MyInstanceName传入实例名称
5)服务器地址
#Backend service addresses.
collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:192.168.100.201:11800}
6)认证
#Authentication active is based on backend setting, see application.yml for more details.
agent.authentication=${SW_AGENT_AUTHENTICATION:}
在Server端的application.yml 中,有如下参数:
authentication: ${SW_AUTHENTICATION:""}
7)频率
#The number of sampled traces per 3 seconds
#Negative or zero means off, by default
agent.sample_n_per_3_secs=${SW_AGENT_SAMPLE:3}