Hi
i have two tick script look like :
collected data :
var interfaces = stream
|from()
.measurement(‘INTERFACES_BIS’)
.groupBy(‘host’, ‘agent_host’, ‘NRO’, ‘ifName’)
First test :
interfaces // collected data
|derivative(‘ifInErrors’)
.nonNegative()
.as(‘erreur’)
|eval(
lambda: if(“erreur” > 0, 10, 0) * Poids_Int_BB_Erreur,
lambda: if(“erreur” > 0, 10, 0) * Poids_Int_BB_Erreur * poids_ASR,
lambda: if(“erreur” > 0, 10, 0),
lambda: Seuil_ASR,
lambda: Seuil_NRO
)
.as(‘score_Metrique’, ‘score_Equipement’, ‘score_NRO’, ‘Seuil_Equipement’, ‘seuil_NRO’)
// set data to DB
|log()
|influxDBOut()
.tag(‘rack’, ‘BIS_D’)
.tag(‘table’, ‘Interface_BB’)
.tag(‘Metrique’, ‘ErreurIn’)
.database(‘telegraf’)
.retentionPolicy(‘autogen’)
.measurement(‘alert’)
And the 2nd :
interfaces // collected data
|last(‘ifInErrors’)
.as(‘erreur’)
|eval(
lambda: if(“erreur” > 0, 10, 0) * Poids_Int_BB_Erreur,
lambda: if(“erreur” > 0, 10, 0) * Poids_Int_BB_Erreur * poids_ASR,
lambda: if(“erreur” > 0, 10, 0),
lambda: Seuil_ASR,
lambda: Seuil_NRO
)
.as(‘score_Metrique’, ‘score_Equipement’, ‘score_NRO’, ‘Seuil_Equipement’, ‘seuil_NRO’)
|log()
|influxDBOut()
.tag(‘rack’, ‘BIS_ND’)
.tag(‘table’, ‘Interface_BB’)
.tag(‘Metrique’, ‘ErreurIn’)
.database(‘telegraf’)
.retentionPolicy(‘autogen’)
.measurement(‘alert’)
i use both for see why i have data appear later than other, and i don’t found why…
why data will not insert direct and wait for newer… but the derivative don’t wait…
i can put only 1 image because i new
so the 2nd is under :
at 15:32
i use stream and when i use log i have :
ts=2020-06-30T15:30:12.676+02:00 lvl=info msg=point service=kapacitor task_master=main task=TEST_ASR903BIS node=influxdb_out7 prefix= name=INTERFACES_ASR903_ifTableBIS db= rp= group=NRO=10.68.33,agent_host=10.68.33.250,host=weathermap,ifName=Gi0/1/7 dimension_0=NRO dimension_1=agent_host dimension_2=host dimension_3=ifName tag_agent_host=10.68.33.250 tag_host=weathermap tag_ifName=Gi0/1/7 tag_ifPhysAddress=c4:44:a0:92:de:90 tag_NRO=10.68.33 field_seuil_NRO=119 field_score_Metrique=0 field_score_Equipement=0 field_score_NRO=0 field_Seuil_Equipement=29 time=2020-06-30T13:25:11Z
ts=2020-06-30T15:30:12.681+02:00 lvl=info msg=point service=kapacitor task_master=main task=TEST_ASR903BIS node=influxdb_out7 prefix= name=INTERFACES_ASR903_ifTableBIS db=telegraf rp=autogen group=NRO=10.68.33,agent_host=10.68.33.250,host=weathermap,ifName=Gi0/1/7 dimension_0=NRO dimension_1=agent_host dimension_2=host dimension_3=ifName tag_ifPhysAddress=c4:44:a0:92:de:90 tag_NRO=10.68.33 tag_agent_host=10.68.33.250 tag_host=weathermap tag_ifName=Gi0/1/7 field_Seuil_Equipement=29 field_seuil_NRO=119 field_score_Metrique=0 field_score_Equipement=0 field_score_NRO=0 time=2020-06-30T13:30:12Z
ts=2020-06-30T15:35:11.651+02:00 lvl=info msg=point service=kapacitor task_master=main task=TEST_ASR903BIS node=influxdb_out7 prefix= name=INTERFACES_ASR903_ifTableBIS db=telegraf rp=autogen group=NRO=10.68.33,agent_host=10.68.33.250,host=weathermap,ifName=Gi0/1/7 dimension_0=NRO dimension_1=agent_host dimension_2=host dimension_3=ifName tag_NRO=10.68.33 tag_agent_host=10.68.33.250 tag_host=weathermap tag_ifName=Gi0/1/7 tag_ifPhysAddress=c4:44:a0:92:de:90 field_score_NRO=0 field_Seuil_Equipement=29 field_seuil_NRO=119 field_score_Metrique=0 field_score_Equipement=0 time=2020-06-30T13:35:11Z
ts=2020-06-30T15:35:11.654+02:00 lvl=info msg=point service=kapacitor task_master=main task=TEST_ASR903BIS node=influxdb_out7 prefix= name=INTERFACES_ASR903_ifTableBIS db= rp= group=NRO=10.68.33,agent_host=10.68.33.250,host=weathermap,ifName=Gi0/1/7 dimension_0=NRO dimension_1=agent_host dimension_2=host dimension_3=ifName tag_NRO=10.68.33 tag_agent_host=10.68.33.250 tag_host=weathermap tag_ifName=Gi0/1/7 tag_ifPhysAddress=c4:44:a0:92:de:90 field_score_Metrique=0 field_score_Equipement=0 field_score_NRO=0 field_Seuil_Equipement=29 field_seuil_NRO=119 time=2020-06-30T13:30:12Z
the node as already the same… influxdb_out7… and why “time” is older than first “ts”
thank you