forked from influxdata/community-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins.yml
1408 lines (1380 loc) · 51.8 KB
/
jenkins.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
apiVersion: influxdata.com/v2alpha1
kind: Label
metadata:
name: noshing-gagarin-8d2001
spec:
color: '#326BBA'
name: Jenkins
---
apiVersion: influxdata.com/v2alpha1
kind: CheckDeadman
metadata:
name: crazy-booth-cd2003
spec:
associations:
- kind: Label
name: noshing-gagarin-8d2001
description: Availability via mem_total
every: 5m0s
level: CRIT
name: Jenkins node health
query: |-
from(bucket: "jenkins")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_node")
|> filter(fn: (r) => r._field == "memory_total")
staleTime: 10m0s
status: active
statusMessageTemplate: 'Check: ${ r._check_name } is: ${ r._level }'
timeSince: 1m30s
---
apiVersion: influxdata.com/v2alpha1
kind: CheckThreshold
metadata:
name: vigorous-mahavira-8d2005
spec:
associations:
- kind: Label
name: noshing-gagarin-8d2001
every: 15m0s
name: Jenkins job duration
query: |-
from(bucket: "jenkins")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r._field == "duration")
|> aggregateWindow(every: 1m, fn: mean)
|> yield(name: "mean")
status: active
statusMessageTemplate: 'Check: Job duration of ${ r._check_name } is: ${ r._level
}'
thresholds:
- level: OK
type: lesser
value: 60069.76
- level: WARN
max: 150030
min: 60579.01
type: inside_range
- level: CRIT
type: greater
value: 150031
---
apiVersion: influxdata.com/v2alpha1
kind: Variable
metadata:
name: charming-khorana-cd2007
spec:
associations:
- kind: Label
name: noshing-gagarin-8d2001
language: flux
name: jenkinsHostnames
query: "import \"influxdata/influxdb/v1\"\r\n\r\nv1.tagValues(\r\n bucket: v.jenkinsBucket,\r\n
\ tag: \"host\",\r\n predicate: (r) => true,\r\n)"
type: query
---
apiVersion: influxdata.com/v2alpha1
kind: Variable
metadata:
name: nifty-bohr-cd200b
spec:
associations:
- kind: Label
name: noshing-gagarin-8d2001
name: jenkinsBucket
type: constant
values:
- jenkins
---
apiVersion: influxdata.com/v2alpha1
kind: Variable
metadata:
name: focused-shirley-506003
spec:
associations:
- kind: Label
name: noshing-gagarin-8d2001
language: flux
name: jenkinsJobNames
query: "import \"csv\"\r\nimport \"influxdata/influxdb/v1\"\r\n\r\nactual = v1.tagValues(\r\n
\ bucket: v.jenkinsBucket,\r\n tag: \"name\",\r\n predicate: (r) => true,\r\n)\r\n\r\ncsvData
= \"\r\n#datatype,string,long,string\r\n#group,false,false,false\r\n#default,,,\r\n,result,table,_value\r\n,,0,<all>\r\n,,0,<without
excluded>\r\n\"\r\n\r\nall = csv.from(csv: csvData)\r\nunion(tables: [all,
actual])"
type: query
---
apiVersion: influxdata.com/v2alpha1
kind: Variable
metadata:
name: rustling-chaplygin-d06003
spec:
associations:
- kind: Label
name: noshing-gagarin-8d2001
name: jenkinsExcludedJobs
selected:
- <service jobs>
type: map
values:
<none>: ""
<service jobs>: deploy-tickstack-eprise-partial,ec2-cleanup weekly,ec2-terminator-all
---
apiVersion: influxdata.com/v2alpha1
kind: Dashboard
metadata:
name: vigorous-pike-cd2001
spec:
associations:
- kind: Label
name: noshing-gagarin-8d2001
charts:
- colors:
- hex: '#513CC6'
name: planet
type: text
- hex: '#32B08C'
name: viridian
type: text
value: 2
- hex: '#F48D38'
name: tiger
type: text
value: 4
- hex: '#BF3D5E'
name: ruby
type: text
value: 6
decimalPlaces: 2
height: 3
kind: Single_Stat
name: "\U0001F44E"
note: NO FAILED JOBS REPORTED
noteOnEmpty: true
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r._field == "result_code")
|> filter(fn: (r) => r.result == "FAILURE")
|> group(columns: ["result"])
|> count()
|> yield(name: "count")
width: 1
- colors:
- hex: '#BF3D5E'
name: ruby
type: text
- hex: '#F48D38'
name: tiger
type: text
value: 2
- hex: '#4ED8A0'
name: rainforest
type: text
value: 4
- hex: '#513CC6'
name: planet
type: text
value: 6
decimalPlaces: 0
height: 2
kind: Single_Stat
name: "\U0001F44D"
note: NO SUCCESSFUL JOBS (IS THIS OKAY??)
noteOnEmpty: true
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r._field == "result_code")
|> filter(fn: (r) => r.result == "SUCCESS")
|> group(columns: ["result"])
|> count()
|> yield(name: "count")
width: 1
yPos: 3
- axes:
- label: "\U0001F44D to \U0001F44E (grouped by job name)"
name: x
binCount: 2
colors:
- hex: '#FD7A5D'
name: Delorean
type: scale
- hex: '#5F1CF2'
name: Delorean
type: scale
- hex: '#4CE09A'
name: Delorean
type: scale
height: 3
kind: Histogram
name: '(tip: hover for details)'
note: No reports found. Run some jobs!
noteOnEmpty: true
position: stacked
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r._field == "result_code")
|> filter(fn: (r) => r.result == "SUCCESS" or r.result == "FAILURE")
|> group(columns: ["result"])
|> yield()
width: 7
xCol: _value
yPos: 5
- axes:
- base: "10"
name: x
scale: linear
- base: "10"
label: duration
name: y
scale: linear
suffix: s
colors:
- hex: '#31C0F6'
name: Nineteen Eighty Four
type: scale
- hex: '#A500A5'
name: Nineteen Eighty Four
type: scale
- hex: '#FF7E27'
name: Nineteen Eighty Four
type: scale
geom: line
height: 2
kind: Xy
name: "\U0001F44E Job Durations (tip: hover for details)"
note: No reports found. Run some jobs!
noteOnEmpty: true
position: overlaid
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r._field == "duration")
|> filter(fn: (r) => r.result == "FAILURE")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> group(columns: ["name"])
|> map(fn: (r) => ({
r with
_value: r._value / 1000
}))
shade: true
width: 7
yPos: 8
- axes:
- base: "10"
name: x
scale: linear
- base: "10"
label: duration
name: y
scale: linear
suffix: s
colors:
- hex: '#31C0F6'
name: Nineteen Eighty Four
type: scale
- hex: '#A500A5'
name: Nineteen Eighty Four
type: scale
- hex: '#FF7E27'
name: Nineteen Eighty Four
type: scale
geom: line
height: 2
kind: Xy
name: "\U0001F44D Job Durations (tip: hover for details)"
note: No reports found. Run some jobs!
noteOnEmpty: true
position: overlaid
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r._field == "duration")
|> filter(fn: (r) => r.result == "SUCCESS")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> group(columns: ["name"])
|> map(fn: (r) => ({
r with
_value: r._value / 1000
}))
shade: true
width: 7
yPos: 10
- height: 1
kind: Markdown
name: Name this Cell
note: '# Node Metrics'
queries: null
width: 7
yPos: 12
- axes:
- base: "10"
name: x
scale: linear
- name: y
scale: linear
suffix: B
colors:
- hex: '#FD7A5D'
name: Delorean
type: scale
- hex: '#5F1CF2'
name: Delorean
type: scale
- hex: '#4CE09A'
name: Delorean
type: scale
geom: step
height: 2
kind: Xy
name: MEMORY
position: overlaid
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_node")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r._field == "memory_available" or r._field == "memory_total")
shade: true
width: 2
xCol: _time
yCol: _value
yPos: 13
- colors:
- hex: '#F95F53'
name: curacao
type: text
decimalPlaces: 2
height: 2
kind: Single_Stat
name: Recent Failed Job
note: no job failures reported
noteOnEmpty: true
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r._field == "result_code")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r.result == "FAILURE")
|> group(columns: ["result"])
|> sort(columns: ["_time"])
|> last()
|> drop(columns: ["_value"])
|> rename(columns: {name: "_value"})
|> yield(name: "sort")
width: 3
xPos: 1
- colors:
- hex: '#FFB94A'
name: pineapple
type: text
decimalPlaces: 2
height: 1
kind: Single_Stat
name: Volatile Job
note: no job failures reported
noteOnEmpty: true
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r._field == "result_code")
|> filter(fn: (r) => r.result == "FAILURE")
|> group(columns: ["name"])
|> count()
|> group()
|> max()
|> drop(columns: ["_value"])
|> rename(columns: {name: "_value"})
|> yield()
width: 3
xPos: 1
yPos: 2
- colors:
- hex: '#00C9FF'
name: laser
type: text
decimalPlaces: 2
height: 1
kind: Single_Stat
name: Recent Success Job
note: no job success reported (IS THIS OKAY??)
noteOnEmpty: true
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r._field == "result_code")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r.result == "SUCCESS")
|> group(columns: ["result"])
|> sort(columns: ["_time"])
|> last()
|> drop(columns: ["_value"])
|> rename(columns: {name: "_value"})
|> yield(name: "sort")
width: 3
xPos: 1
yPos: 3
- colors:
- hex: '#513CC6'
name: planet
type: text
decimalPlaces: 2
height: 1
kind: Single_Stat
name: Most Stable
note: no job success reported (IS THIS OKAY??)
noteOnEmpty: true
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r._field == "result_code")
|> filter(fn: (r) => r.result == "SUCCESS")
|> group(columns: ["name"])
|> count()
|> group()
|> max()
|> drop(columns: ["_value"])
|> rename(columns: {name: "_value"})
|> yield()
width: 3
xPos: 1
yPos: 4
- axes:
- base: "10"
name: x
scale: linear
- name: y
scale: linear
suffix: B
colors:
- hex: '#31C0F6'
name: Nineteen Eighty Four
type: scale
- hex: '#A500A5'
name: Nineteen Eighty Four
type: scale
- hex: '#FF7E27'
name: Nineteen Eighty Four
type: scale
geom: step
height: 2
kind: Xy
name: DISK USAGE
position: overlaid
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_node")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r._field == "disk_available" or r._field == "swap_total" or r._field == "swap_available" or r._field == "temp_available")
shade: true
width: 2
xCol: _time
xPos: 2
yCol: _value
yPos: 13
- colors:
- hex: '#00C9FF'
name: laser
type: min
- hex: '#BF3D5E'
name: ruby
type: max
value: 10
decimalPlaces: 0
height: 5
kind: Gauge
name: Status Temp
note: "✅ - Nothing to report \U0001F6A2"
noteOnEmpty: true
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r._field == "result_code")
|> filter(fn: (r) => r.name == "Front-End Application" or r.name == "Front-End Application - Staging" or r.name == "Static Files")
|> filter(fn: (r) => r.result == "FAILURE")
|> group(columns: ["result"])
|> count()
|> yield(name: "count")
width: 3
xPos: 4
- axes:
- base: "10"
name: x
scale: linear
- base: "10"
name: y
scale: linear
colors:
- hex: '#31C0F6'
name: Nineteen Eighty Four
type: scale
- hex: '#A500A5'
name: Nineteen Eighty Four
type: scale
- hex: '#FF7E27'
name: Nineteen Eighty Four
type: scale
geom: line
height: 2
kind: Xy
name: Response Time
position: overlaid
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_node")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r._field == "response_time")
width: 3
xCol: _time
xPos: 4
yCol: _value
yPos: 13
- height: 10
kind: Markdown
name: Name this Cell
note: |-
My main approach for this dashboard was provide a quick pulse on a Jenkins node. If this were the first place I'd look for any clues on issues, what would I want to see?
Two Large Numbers - Sum of total Failure/Success Jobs
Recent Failed/Success Job - Shows the most recent failing or successful jobs by name
Volatile/Stable Job - Shows the most failing or successful build from the "duration" specified in the dashboard
"Gauge" cell - Something I was messing around with. note: I wish I could use a variable as a value for "customize - maximum threshold"
Histogram - Group all the jobs from the "duration" by their success or failure. Found a way to use the histogram, I feel like I could be doing it very wrong due to the labeling on the X axis
Job Duration - Two charts, one for successful jobs and the other failed jobs
queries: null
width: 5
xPos: 7
- height: 6
kind: Markdown
name: Name this Cell
note: Some metrics that are reported along with jobs. To get more useful data
out of here, try increasing the time range.
queries: null
width: 5
xPos: 7
yPos: 10
description: ""
name: Jenkins - High-Resolution
---
apiVersion: influxdata.com/v2alpha1
kind: Dashboard
metadata:
name: zen-taussig-127001
spec:
associations:
- kind: Label
name: noshing-gagarin-8d2001
charts:
- colors:
- hex: '#00C9FF'
name: laser
type: text
decimalPlaces: 2
height: 2
kind: Single_Stat
name: 'You Selected:'
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r.name == v.jenkinsJobNames)
|> keep(columns: ["name"])
|> rename(columns: {name: "_value"})
|> first()
width: 7
- colors:
- hex: '#513CC6'
name: planet
type: text
- hex: '#32B08C'
name: viridian
type: text
value: 2
- hex: '#F48D38'
name: tiger
type: text
value: 4
- hex: '#BF3D5E'
name: ruby
type: text
value: 6
decimalPlaces: 2
height: 3
kind: Single_Stat
name: "\U0001F44E"
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r._field == "result_code")
|> filter(fn: (r) => r.result == "FAILURE")
|> filter(fn: (r) => r.name == v.jenkinsJobNames)
|> group(columns: ["result"])
|> count()
|> yield(name: "count")
width: 1
yPos: 2
- colors:
- hex: '#BF3D5E'
name: ruby
type: text
- hex: '#F48D38'
name: tiger
type: text
value: 2
- hex: '#4ED8A0'
name: rainforest
type: text
value: 4
- hex: '#513CC6'
name: planet
type: text
value: 6
decimalPlaces: 0
height: 3
kind: Single_Stat
name: "\U0001F44D"
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r._field == "result_code")
|> filter(fn: (r) => r.result == "SUCCESS")
|> filter(fn: (r) => r.name == v.jenkinsJobNames)
|> group(columns: ["result"])
|> count()
|> yield(name: "count")
width: 1
xPos: 1
yPos: 2
- axes:
- base: "10"
name: x
scale: linear
- base: "10"
label: duration in sections
name: y
scale: linear
suffix: s
colors:
- hex: '#31C0F6'
name: Nineteen Eighty Four
type: scale
- hex: '#A500A5'
name: Nineteen Eighty Four
type: scale
- hex: '#FF7E27'
name: Nineteen Eighty Four
type: scale
geom: line
height: 3
kind: Xy
name: 'Build Times (tip: hover for details)'
position: overlaid
queries:
- query: |-
from(bucket: v.jenkinsBucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "jenkins_job")
|> filter(fn: (r) => r._field == "duration")
|> filter(fn: (r) => r.host == v.jenkinsHostnames)
|> filter(fn: (r) => r.name == v.jenkinsJobNames)
|> map(fn: (r) => ({
r with
_value: r._value / 1000
}))
shade: true
width: 5
xPos: 2
yPos: 2
- height: 7
kind: Markdown
name: Name this Cell
note: |-
I want to show more details here about a Jenkins job but I think this is all that can be done
I added the "You Selected:" cell because it was difficult to tell which "jenkinsJobNames" value I had selected.
queries: null
width: 5
xPos: 7
description: ""
name: Jenkins - Single Job
---
apiVersion: influxdata.com/v2alpha1
kind: Dashboard
metadata:
name: alerting-morse-fcb001
spec:
associations:
- kind: Label
name: noshing-gagarin-8d2001
charts:
- colors:
- hex: '#F95F53'
name: curacao
type: min
- hex: '#4ED8A0'
name: rainforest
type: max
value: 100
decimalPlaces: 0
height: 4
kind: Gauge
name: Success ratio
queries:
- query: "import \"influxdata/influxdb/v1\"\r\nimport \"strings\"\r\n\r\nfrom(bucket:
v.jenkinsBucket)\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n
\ |> filter(fn: (r) => r._measurement == \"jenkins_job\")\r\n |>
filter(fn: (r) => r.host == v.jenkinsHostnames)\r\n |> filter(fn:
(r) => \r\n if v.jenkinsJobNames == \"<all>\" then true\r\n else
if v.jenkinsJobNames == \"<without excluded>\" then not contains(set:
strings.split(v: v.jenkinsExcludedJobs, t: \",\"), value: r.name)\r\n
\ else r.name == v.jenkinsJobNames\r\n )\r\n |> v1.fieldsAsCols()\r\n
\ |> duplicate(column: \"result_code\", as: \"_value\")\r\n |> group()\r\n
\ |> reduce(\r\n fn: (r, accumulator) => ({\r\n total:
accumulator.total + 1,\r\n success: accumulator.success
+ (if r.result_code == 0 then 1 else 0),\r\n }),\r\n identity:
{total: 0, success: 0}\r\n ) \r\n |> map(fn: (r) => ({r with
_value: (float(v: 100 * r.success) / float(v: r.total))}))"
suffix: '%'
width: 5
- colors:
- hex: '#4ED8A0'
id: base
name: rainforest
type: background
value: 0
- hex: '#F95F53'
id: 2ad18e5d-818e-4e5f-aa81-c38b746dfaa6
name: curacao
type: background
value: 1
- hex: '#545667'
id: 28ebafd3-cf8e-4572-bf14-a02b0e543f39
name: graphite
type: background
value: 2
- hex: '#FFD255'
id: e510204d-b629-43c9-acad-89dbd5148287
name: thunder
type: background
value: 3
- hex: '#545667'
id: 0b210208-6a4c-4bcd-835c-83ee9a154b11
name: graphite
type: background
value: 4
decimalPlaces: 0
fieldOptions:
- displayName: time
fieldName: _time
visible: true
- displayName: _start
fieldName: _start
visible: true
- displayName: _stop
fieldName: _stop
visible: true
- displayName: _measurement
fieldName: _measurement
visible: true
- displayName: host
fieldName: host
- displayName: job name
fieldName: name
visible: true
- displayName: port
fieldName: port
- displayName: source
fieldName: source
visible: true
- displayName: duration
fieldName: duration
- displayName: result code
fieldName: result_code
visible: true
- displayName: result
fieldName: _value
visible: true
- displayName: build
fieldName: link
visible: true
- displayName: _zlink
fieldName: _zlink
height: 4
kind: Table
name: Last Builds
queries:
- query: "import \"influxdata/influxdb/v1\"\r\nimport \"strings\"\r\n\r\nfrom(bucket:
v.jenkinsBucket)\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n
\ |> filter(fn: (r) => r._measurement == \"jenkins_job\")\r\n |>
filter(fn: (r) => r.host == v.jenkinsHostnames)\r\n |> filter(fn:
(r) => \r\n if v.jenkinsJobNames == \"<all>\" then true\r\n else
if v.jenkinsJobNames == \"<without excluded>\" then not contains(set:
strings.split(v: v.jenkinsExcludedJobs, t: \",\"), value: r.name)\r\n
\ else r.name == v.jenkinsJobNames\r\n )\r\n |> v1.fieldsAsCols()\r\n
\ |> duplicate(column: \"result_code\", as: \"_value\")\r\n |> group()\r\n
\ |> keep(columns: [\"_time\", \"host\", \"port\", \"name\", \"result\",
\"result_code\", \"duration\"])\r\n |> map(fn: (r) => ({r with link:
\"https://\" + r.host + \":\" + r.port + \"/job/\" + r.name + \"/\"}))"
tableOptions:
sortBy: _time
verticalTimeAxis: true
timeFormat: YYYY/MM/DD HH:mm:ss
width: 11
yPos: 4
- height: 2
kind: Markdown
name: Name this Cell
note: |-
---
Last 7 days statistics
---
width: 11
yPos: 8
- colors:
- hex: '#BF3D5E'
id: base
name: ruby
type: background
value: 0
- hex: '#DC4E58'
id: 3fe676af-09e5-47ab-a32e-d1b99335c5f3
name: fire
type: background
value: 33
- hex: '#F48D38'
id: 94ece9fa-23bf-43aa-910f-e5e1c56cec77
name: tiger
type: background
value: 50
- hex: '#FFB94A'
id: 82593475-2ea4-437c-9ffe-3ab2fa57bb3c
name: pineapple
type: background
value: 75
- hex: '#4ED8A0'
id: 8b045ebd-007e-46ff-9c1e-bd60d4bf8517
name: rainforest
type: background
value: 100
decimalPlaces: 0
fieldOptions:
- displayName: name
fieldName: name
visible: true
- displayName: ratio (%)
fieldName: _value
visible: true
- displayName: success
fieldName: success
- displayName: total
fieldName: total
height: 4
kind: Table
name: Success Rate (last 7 days)
queries:
- query: "import \"influxdata/influxdb/v1\"\r\nimport \"strings\"\r\n\r\nfrom(bucket:
v.jenkinsBucket)\r\n |> range(start: -1w)\r\n |> filter(fn: (r)
=> r._measurement == \"jenkins_job\")\r\n |> filter(fn: (r) => r.host
== v.jenkinsHostnames)\r\n |> filter(fn: (r) => \r\n if v.jenkinsJobNames
== \"<all>\" then true\r\n else if v.jenkinsJobNames == \"<without
excluded>\" then not contains(set: strings.split(v: v.jenkinsExcludedJobs,
t: \",\"), value: r.name)\r\n else r.name == v.jenkinsJobNames\r\n
\ )\r\n |> v1.fieldsAsCols()\r\n |> duplicate(column: \"result_code\",
as: \"_value\")\r\n |> group(columns: [\"name\"])\r\n |> reduce(\r\n
\ fn: (r, accumulator) => ({\r\n total: accumulator.total
+ 1,\r\n success: accumulator.success + (if r.result_code
== 0 then 1 else 0),\r\n }),\r\n identity: {total: 0,
success: 0}\r\n ) \r\n |> map(fn: (r) => ({r with _value: (float(v:
100 * r.success) / float(v: r.total))}))\r\n |> group()"
tableOptions:
sortBy: _value
verticalTimeAxis: true
timeFormat: YYYY-MM-DD HH:mm:ss
width: 3
yPos: 10
- height: 2
kind: Markdown
name: Name this Cell
note: |-
---
Last builds of each job irrespective of time window and job filter.
---
width: 11
yPos: 14
- colors:
- hex: '#F95F53'
name: curacao
type: min
- hex: '#4ED8A0'
name: rainforest
type: max
value: 100
decimalPlaces: 0
height: 4
kind: Gauge
name: Success ratio (Distinct)
queries:
- query: "import \"influxdata/influxdb/v1\"\r\n\r\nfrom(bucket: v.jenkinsBucket)\r\n
\ |> range(start: -1y)\r\n |> filter(fn: (r) => r._measurement ==
\"jenkins_job\")\r\n |> filter(fn: (r) => r.host == v.jenkinsHostnames)\r\n
\ |> v1.fieldsAsCols()\r\n |> duplicate(column: \"result_code\",
as: \"_value\")\r\n |> group(columns: [\"name\"])\r\n |> last()\r\n
\ |> group()\r\n |> reduce(\r\n fn: (r, accumulator) => ({\r\n
\ total: accumulator.total + 1,\r\n success:
accumulator.success + (if r.result_code == 0 then 1 else 0),\r\n }),\r\n
\ identity: {total: 0, success: 0}\r\n ) \r\n |> map(fn:
(r) => ({r with _value: (float(v: 100 * r.success) / float(v: r.total))}))"
suffix: '%'
width: 5
yPos: 16
- axes:
- base: "10"
name: x
scale: linear
- base: "10"
name: y
scale: linear
colors:
- hex: '#FD7A5D'
name: Delorean
type: scale
- hex: '#5F1CF2'
name: Delorean
type: scale
- hex: '#4CE09A'
name: Delorean
type: scale
geom: line
height: 4
kind: Xy
name: Builds Duration (last 7 days)
position: overlaid
queries:
- query: "import \"influxdata/influxdb/v1\"\r\nimport \"strings\"\r\n\r\nfrom(bucket:
v.jenkinsBucket)\r\n |> range(start: -1w)\r\n |> filter(fn: (r)
=> r._measurement == \"jenkins_job\")\r\n |> filter(fn: (r) => r.host
== v.jenkinsHostnames)\r\n |> filter(fn: (r) => \r\n if v.jenkinsJobNames