-
Notifications
You must be signed in to change notification settings - Fork 9
/
grafanafortactical.sh
3218 lines (2972 loc) · 93 KB
/
grafanafortactical.sh
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
#!/bin/bash
### Basic setup is are:
##
##
##### Please note for the dashboard to display properly you must have cpu, ram and disk checks on your agents.
##
##
### 1. Swap to user setup for tactical rmm - e.g. su tactical
### 2. Go to home - cd ~/
### 3. wget https://raw.githubusercontent.com/dinger1986/dvis/master/grafanafortactical.sh
### 4. chmod +x grafanafortactical.sh
### 5. ./grafanafortactical.sh
### 6. Enter your username
### 7. Enter the domain for the frontend e.g. rmm.mydomain.com
### 8. Enter your full domain e.g. mydomain.com
### 9. Go to https://rmm.mydomain.com:3000
### 10. Go to dashboards and copy the dashboard to reconfigure how you want it or keep it as default
##
### Add URL action to Tactical (correct URL will be shown at the end of the script):
### https://rmm.mydomain.com:3000/d/pLkA1-inz/tacticalrmm-dashboard-trmm?orgId=1&var-Client={{client.name}}&var-Sites={{site.name}}&var-Agents_HostName={{agent.hostname}}
##
### Troubleshooting:
##
### If you need to rerun the script the only thing that will need redone is changing the postgres dbreader password
### to the same as is in /etc/grafana/provisioning/datasources/default.yaml
##
### 1. To do this type in nano /etc/grafana/provisioning/datasources/default.yaml
### 2. Copy password under:
### secureJsonData:
### password: ""
### 3. Replace the password for dbreader for postgres with the following command
### 4. sudo -u postgres psql tacticalrmm -c "ALTER USER dbreader WITH PASSWORD 'new_password'"
#### Just scripted up to work from @Yasd and @sebcashmag on Discord forum
#check if running on ubuntu 20.04, Debian or Raspbian
osname=$(lsb_release -si); osname=${osname^}
osname=$(echo "$osname" | tr '[A-Z]' '[a-z]')
fullrel=$(lsb_release -sd)
codename=$(lsb_release -sc)
relno=$(lsb_release -sr | cut -d. -f1)
fullrelno=$(lsb_release -sr)
# Fallback if lsb_release -si returns anything else than Ubuntu, Debian or Raspbian
if [ ! "$osname" = "ubuntu" ] && [ ! "$osname" = "debian" ]; then
osname=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
osname=${osname^}
fi
# determine system
if ([ "$osname" = "ubuntu" ] && [ "$fullrelno" = "20.04" ]) || ([ "$osname" = "debian" ] && [ $relno -ge 10 ]); then
echo $fullrel
else
echo $fullrel
echo -ne "${RED}Only Ubuntu release 20.04 and Debian 10 and later, are supported\n"
echo -ne "Your system does not appear to be supported${NC}\n"
exit 1
fi
if [ $EUID -eq 0 ]; then
echo -ne "${RED}Do NOT run this script as root. Exiting.${NC}\n"
exit 1
fi
#check if running as root
if [ $EUID -eq 0 ]; then
echo -ne "\033[0;31mDo NOT run this script as root. Exiting.\e[0m\n"
exit 1
fi
#Username
echo -ne "Enter your created username if you havent done this please do it now, use ctrl+c to cancel this script and do it${NC}: "
read username
while [[ ${domain} != *[.]*[.]* ]]
do
echo -ne "${YELLOW}Enter the main domain setup ie rmm.yourdomain.com ${NC}: "
read domain
done
echo -ne "${YELLOW}Enter the letsencrypt domain (if using txt acme e.g. example.com) or the frontend (as above) (if using certbot dns e.g. rmm.example.com)${NC}: "
read certdomain
admintoken=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 70 | head -n 1)
cd ~/
# Create a read-only PostgreSQL user for the tacticalrmm database
sudo -u postgres psql tacticalrmm -c "CREATE ROLE dbreader WITH LOGIN PASSWORD '${admintoken}'"
sudo -u postgres psql tacticalrmm -c "GRANT CONNECT ON DATABASE tacticalrmm TO dbreader"
sudo -u postgres psql tacticalrmm -c "GRANT USAGE ON SCHEMA public to dbreader"
sudo -u postgres psql tacticalrmm -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO dbreader"
sudo -u postgres psql tacticalrmm -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO dbreader"
# create a firewall rule for the Grafana website (default port is 3000)
sudo ufw allow 3000/tcp
sudo ufw reload
# Install Grafana based on https://grafana.com/docs/grafana/latest/installation/debian/
sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
# add the repository for the latest stable OSS release
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install grafana
sudo rm /etc/grafana/provisioning/datasources/default.yaml
sudo touch /etc/grafana/provisioning/datasources/default.yaml
sudo chown ${username}:${username} /etc/grafana/provisioning/datasources/default.yaml
#Set Grafana DB file
dbconf="$(cat << EOF
## config file version
apiVersion: 1
## list of datasources that should be deleted from the database
deleteDatasources:
## list of datasources to insert/update depending
datasources:
- name: PostgreSQL
type: postgres
access: proxy
url: localhost:5432
user: dbreader
database: tacticalrmm
basicAuth: false
isDefault: true
jsonData:
postgresVersion: 1200
sslmode: verify-ca
tlsAuth: true
tlsAuthWithCACert: true
tlsConfigurationMethod: file-path
tlsSkipVerify: false
secureJsonData:
password: "${admintoken}"
version: 1
editable: true
EOF
)"
echo "${dbconf}" > /etc/grafana/provisioning/datasources/default.yaml
sudo rm /etc/grafana/provisioning/dashboards/default.yaml
sudo touch /etc/grafana/provisioning/dashboards/default.yaml
sudo chown ${username}:${username} /etc/grafana/provisioning/dashboards/default.yaml
#Set Grafana dashboard file
dashconf="$(cat << EOF
apiVersion: 1
providers:
- name: Default # A uniquely identifiable name for the provider
folder: Tactical # The folder where to place the dashboards
type: file
options:
path: /var/lib/grafana/dashboards
EOF
)"
echo "${dashconf}" > /etc/grafana/provisioning/dashboards/default.yaml
sudo mkdir /var/lib/grafana/dashboards
sudo rm /var/lib/grafana/dashboards/cluster.json
sudo touch /var/lib/grafana/dashboards/cluster.json
sudo chown ${username}:${username} /var/lib/grafana/dashboards/cluster.json
#Set Grafana dashboard layout file
dashlayconf="$(cat << EOF
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"limit": 100,
"name": "Annotations & Alerts",
"type": "dashboard"
},
{
"datasource": null,
"enable": false,
"iconColor": "red",
"name": "Update",
"rawQuery": "select \n--agents_note.entry_time as \"time\",\nTO_TIMESTAMP((substring(agents_note.note, ('[^le]*\$'))),'YYYY-MM-DD HH24:MI:SS')- INTERVAL '2 hour' as \"time\",\n agents_note.note as \"text\",\n ('Update') as \"tags\"\n--(substring(agents_note.note, ('[^=]*'))) as \"tags\"\nfrom \n agents_note\nwhere \n agents_note.note like 'Update:%' AND\n agent_id IN (SELECT id FROM agents_agent where agents_agent.description = \$Agents_Description)\n--AND agent_id = 40"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 10,
"iteration": 1626210213221,
"links": [],
"panels": [
{
"collapsed": false,
"datasource": null,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 49,
"panels": [],
"title": "Information of the selected agent",
"type": "row"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 1
},
"id": 57,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "/.*/",
"values": true
},
"text": {
"valueSize": 18
},
"textMode": "value"
},
"pluginVersion": "8.0.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select \n concat('Site: ',clients_site.name,' / HostName: ', agents_agent.hostname,' ',agents_agent.DESCRIPTION)\nfrom \n agents_agent\n LEFT OUTER JOIN clients_site on agents_agent.site_id = clients_site.id\n where \n agents_agent.hostname = \$Agents_HostName",
"refId": "A",
"select": [
[
{
"params": [
"boot_time"
],
"type": "column"
}
]
],
"table": "agents_agent",
"timeColumn": "last_seen",
"timeColumnType": "timestamp",
"where": [
{
"name": "\$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"Connected": {
"color": "dark-green",
"index": 1
},
"No Connected": {
"color": "dark-red",
"index": 0
}
},
"type": "value"
},
{
"options": {
"match": "null",
"result": {
"color": "transparent",
"index": 2
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "transparent",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 5,
"x": 0,
"y": 2
},
"id": 53,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [],
"fields": "/.*/",
"values": false
},
"text": {},
"textMode": "value"
},
"pluginVersion": "8.0.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select \r\nCASE\r\n WHEN (count(*) = 1) THEN 'Connected'\r\n WHEN (count(*) = 0) THEN 'No Connected'\r\n ELSE ''\r\n END AS modifiedpvc\r\n \r\n from \r\n agents_agent\r\n where \r\n agents_agent.hostname = \$Agents_HostName and\r\n last_seen > NOW()- interval '1 hours'\r\n ",
"refId": "A",
"select": [
[
{
"params": [
"boot_time"
],
"type": "column"
}
]
],
"table": "agents_agent",
"timeColumn": "last_seen",
"timeColumnType": "timestamp",
"where": [
{
"name": "\$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
},
{
"datasource": null,
"description": "Track CPU consumption for the selected agent.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"log": 10,
"type": "log"
},
"showPoints": "always",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"mappings": [],
"thresholds": {
"mode": "percentage",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "#EAB839",
"value": 70
},
{
"color": "dark-red",
"value": 90
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 7,
"x": 5,
"y": 2
},
"id": 28,
"options": {
"legend": {
"calcs": [],
"displayMode": "hidden",
"placement": "bottom"
},
"tooltip": {
"mode": "multi"
}
},
"pluginVersion": "8.0.3",
"targets": [
{
"format": "time_series",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT \r\n x AS \"time\",\r\n y as \"CPU Load\"\r\n FROM checks_checkhistory\r\n WHERE x BETWEEN '2021-07-01T13:54:25.526Z' AND '2100-07-02T19:54:25.526Z'\r\n AND check_id IN (SELECT id FROM checks_check WHERE agent_id=(SELECT id FROM agents_agent where agents_agent.hostname = \$Agents_HostName) AND check_type='cpuload')\r\n ORDER BY x",
"refId": "A",
"select": [
[
{
"params": [
"boot_time"
],
"type": "column"
}
]
],
"table": "agents_agent",
"timeColumn": "last_seen",
"timeColumnType": "timestamp",
"where": [
{
"name": "\$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "CPU Load Check",
"type": "timeseries"
},
{
"datasource": null,
"description": "Track memory consumption for the selected agent.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "hue",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"log": 10,
"type": "log"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"mappings": [],
"thresholds": {
"mode": "percentage",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "dark-orange",
"value": 70
},
{
"color": "dark-red",
"value": 85
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 6,
"x": 12,
"y": 2
},
"id": 29,
"options": {
"legend": {
"calcs": [],
"displayMode": "hidden",
"placement": "bottom"
},
"tooltip": {
"mode": "multi"
}
},
"pluginVersion": "8.0.3",
"targets": [
{
"format": "time_series",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT \r\n x AS \"time\",\r\n y as \"Memory Usage\"\r\nFROM \r\n checks_checkhistory\r\nWHERE \r\n x BETWEEN '2021-07-01T13:54:25.526Z' AND '2100-07-02T19:54:25.526Z' AND \r\n check_id IN (SELECT id FROM checks_check WHERE agent_id=(SELECT id FROM agents_agent where agents_agent.hostname = \$Agents_HostName) AND check_type='memory')\r\n ORDER BY x",
"refId": "A",
"select": [
[
{
"params": [
"boot_time"
],
"type": "column"
}
]
],
"table": "agents_agent",
"timeColumn": "last_seen",
"timeColumnType": "timestamp",
"where": [
{
"name": "\$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Memory Usage",
"type": "timeseries"
},
{
"datasource": null,
"description": "Track disk consumption for the selected agent.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "hue",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"mappings": [],
"thresholds": {
"mode": "percentage",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "dark-red",
"value": 0.5
},
{
"color": "dark-orange",
"value": 10
},
{
"color": "green",
"value": 11
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 6,
"x": 18,
"y": 2
},
"id": 30,
"options": {
"legend": {
"calcs": [],
"displayMode": "hidden",
"placement": "bottom"
},
"tooltip": {
"mode": "multi"
}
},
"pluginVersion": "8.0.3",
"targets": [
{
"format": "time_series",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT \r\n x AS \"time\",\r\n y as \"Disk Usage\"\r\nFROM \r\n checks_checkhistory\r\nWHERE \r\n x BETWEEN '2021-07-01T13:54:25.526Z' AND '2100-07-02T19:54:25.526Z'\r\n AND check_id IN (SELECT id FROM checks_check WHERE agent_id=(SELECT id FROM agents_agent where agents_agent.hostname = \$Agents_HostName) AND check_type='diskspace')\r\n ORDER BY x",
"refId": "A",
"select": [
[
{
"params": [
"boot_time"
],
"type": "column"
}
]
],
"table": "agents_agent",
"timeColumn": "last_seen",
"timeColumnType": "timestamp",
"where": [
{
"name": "\$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "Disk Usage",
"type": "timeseries"
},
{
"datasource": null,
"description": "Type of CPU installed",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "text",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 2,
"w": 5,
"x": 0,
"y": 3
},
"id": 50,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [],
"fields": "/^concat\$/",
"values": true
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select \r\n concat(wmi_detail->'cpu'->0->0->>'Name',' \\\ ',wmi_detail->'base_board'->0->0->>'Manufacturer')\r\nfrom \r\n agents_agent\r\nwhere \r\n agents_agent.hostname = \$Agents_HostName",
"refId": "A",
"select": [
[
{
"params": [
"boot_time"
],
"type": "column"
}
]
],
"table": "agents_agent",
"timeColumn": "last_seen",
"timeColumnType": "timestamp",
"where": [
{
"name": "\$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "CPU Name",
"type": "stat"
},
{
"datasource": null,
"description": "Agent bone type",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "text",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 2,
"w": 5,
"x": 0,
"y": 5
},
"id": 44,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "center",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "/^concat\$/",
"values": true
},
"text": {},
"textMode": "value"
},
"pluginVersion": "8.0.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select \r\n concat(SUBSTRING(agents_agent.operating_system,'(.*),'),' ', wmi_detail->'cpu'->0->0->>'DataWidth',' Bits') \r\n \r\nfrom \r\n agents_agent\r\nwhere \r\n agents_agent.hostname = \$Agents_HostName\r\n",
"refId": "A",
"select": [
[
{
"params": [
"boot_time"
],
"type": "column"
}
]
],
"table": "agents_agent",
"timeColumn": "last_seen",
"timeColumnType": "timestamp",
"where": [
{
"name": "\$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"Windows not up to date": {
"color": "dark-red",
"index": 0
},
"Windows up to date": {
"color": "dark-green",
"index": 1
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 2,
"x": 0,
"y": 7
},
"id": 59,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [],
"fields": "/.*/",
"values": true
},
"text": {},
"textMode": "value"
},
"pluginVersion": "8.0.5",
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n CASE\n WHEN (has_patches_pending = true) THEN 'Windows not up to date'\n WHEN (has_patches_pending = false) THEN 'Windows up to date'\n ELSE 'nothing'\n END AS Statut\nFROM \n agents_agent\nwhere\n agents_agent.hostname = \$Agents_HostName",
"refId": "A",
"select": [
[
{
"params": [
"boot_time"
],
"type": "column"
}
]
],
"table": "agents_agent",
"timeColumn": "last_seen",
"timeColumnType": "timestamp",
"where": [
{
"name": "\$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"type": "stat"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [
{
"options": {
"No reboot required": {
"color": "dark-green",
"index": 1
},
"Reboot required": {
"color": "dark-red",
"index": 0
}