项目操作员中多列的平均值

时间:2019-05-27 07:28:19

标签: azure kusto

我们在loganalytics中有2个自定义日志,我能够获取每个日志的平均值,我需要合并这2个日志,并将其合并为1表示vpn + url的平均值

workspace(name).vpn_CL
| extend healty=iff(Status_s == 'Connected' , 100 , 0)
| summarize vpn = avg(healty) by EnvName_s, ClientName_s
| 
join
(
    workspace(name).url_CL
    | extend Availability=iff(StatusDescription_s == 'OK' , 100 , 0)
    | summarize URL=avg(Availability) by EnvName_s, ClientName_s
 ) on ClientName_s
  | project Client=ClientName_s, Environment=EnvName_s , vpn , URL

1 个答案:

答案 0 :(得分:0)

根据我的理解,我认为vpn+url的平均值是当vpn的实体数为url时,加上healty值和Availability值的结果等于workspace(name).vpn_CL | extend healty=iff(Status_s == 'Connected' , 100 , 0) | summarize m = count(), vpn = avg(healty) by EnvName_s, ClientName_s | join ( workspace(name).url_CL | extend Availability=iff(StatusDescription_s == 'OK' , 100 , 0) | summarize n = count(), URL=avg(Availability) by EnvName_s, ClientName_s ) on ClientName_s | project Client=ClientName_s, Environment=EnvName_s , vpn , URL, avgOfVpnUrl = vpn*m/(m+n)+url*n/(m+n) 个实体的数量。

enter image description here

否则,如果它们的实体数量不相等,则两个标签的平均值是基于其概率的期望值,

enter image description here

然后

#like this is for mean value

import pandas

print(len(df))
acc_x_mean=df.rolling(5).mean().dropna()[::5]
len(acc_x_mean)
what i am doing

import pandas
print(len(df))
acc_x_mad=df.rolling(5).apply(mad).dropna()[::5]
len(acc_x_mad)
but it not working

import pandas
print(len(df))
acc_x_max=df.rolling(5).apply(max).dropna()[::5]
len(acc_x_max)

import pandas
print(len(df))
acc_x_min=df.rolling(5).apply(min).dropna()[::5]
len(acc_x_min)

import pandas

print(len(df))
acc_x_mean=df.rolling(5).mean().dropna()[::5]
len(acc_x_mean)

name 'mad' is not defined
what attributes i called for mad

希望有帮助。