forked from Cacti/cacti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal_form.php
2282 lines (2235 loc) · 77.9 KB
/
global_form.php
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
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2021 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDtool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
if (!defined('VALID_HOST_FIELDS')) {
$string = api_plugin_hook_function('valid_host_fields', '(hostname|host_id|location|snmp_community|snmp_username|snmp_password|snmp_auth_protocol|snmp_priv_passphrase|snmp_priv_protocol|snmp_context|snmp_engine_id|snmp_version|snmp_port|snmp_timeout|external_id)');
define('VALID_HOST_FIELDS', $string);
}
$valid_host_fields = VALID_HOST_FIELDS;
/* If you update this, check that you have updated the installer */
$fields_snmp_item = array(
'snmp_version' => array(
'method' => 'drop_array',
'friendly_name' => __('SNMP Version'),
'description' => __('Choose the SNMP version for this host.'),
'on_change' => 'setSNMP()',
'value' => '|arg1:snmp_version|',
'default' => read_config_option('snmp_version'),
'array' => $snmp_versions
),
'snmp_community' => array(
'method' => 'textbox',
'friendly_name' => __('SNMP Community String'),
'description' => __('Fill in the SNMP read community for this device.'),
'value' => '|arg1:snmp_community|',
'default' => read_config_option('snmp_community'),
'max_length' => '100',
'size' => '20'
),
'snmp_security_level' => array(
'method' => 'drop_array',
'friendly_name' => __('SNMP Security Level'),
'description' => __('SNMP v3 Security Level to use when querying the device.'),
'on_change' => 'setSNMP()',
'value' => '|arg1:snmp_security_level|',
'form_id' => '|arg1:id|',
'default' => read_config_option('snmp_security_level'),
'array' => $snmp_security_levels
),
'snmp_auth_protocol' => array(
'method' => 'drop_array',
'friendly_name' => __('SNMP Auth Protocol (v3)'),
'description' => __('Choose the SNMPv3 Authorization Protocol.'),
'on_change' => 'setSNMP()',
'value' => '|arg1:snmp_auth_protocol|',
'default' => read_config_option('snmp_auth_protocol'),
'array' => $snmp_auth_protocols,
),
'snmp_username' => array(
'method' => 'textbox',
'friendly_name' => __('SNMP Username (v3)'),
'description' => __('SNMP v3 username for this device.'),
'value' => '|arg1:snmp_username|',
'default' => read_config_option('snmp_username'),
'max_length' => '50',
'size' => '40'
),
'snmp_password' => array(
'method' => 'textbox_password',
'friendly_name' => __('SNMP Password (v3)'),
'description' => __('SNMP v3 password for this device.'),
'value' => '|arg1:snmp_password|',
'default' => read_config_option('snmp_password'),
'max_length' => '50',
'size' => '40'
),
'snmp_priv_protocol' => array(
'method' => 'drop_array',
'friendly_name' => __('SNMP Privacy Protocol (v3)'),
'description' => __('Choose the SNMPv3 Privacy Protocol.'),
'on_change' => 'setSNMP()',
'value' => '|arg1:snmp_priv_protocol|',
'default' => read_config_option('snmp_priv_protocol'),
'array' => $snmp_priv_protocols,
),
'snmp_priv_passphrase' => array(
'method' => 'textbox_password',
'friendly_name' => __('SNMP Privacy Passphrase (v3)'),
'description' => __('Choose the SNMPv3 Privacy Passphrase.'),
'value' => '|arg1:snmp_priv_passphrase|',
'default' => read_config_option('snmp_priv_passphrase'),
'max_length' => '200',
'size' => '80'
),
'snmp_context' => array(
'method' => 'textbox',
'friendly_name' => __('SNMP Context (v3)'),
'description' => __('Enter the SNMP Context to use for this device.'),
'value' => '|arg1:snmp_context|',
'default' => '',
'max_length' => '64',
'size' => '40'
),
'snmp_engine_id' => array(
'method' => 'textbox',
'friendly_name' => __('SNMP Engine ID (v3)'),
'description' => __('Enter the SNMP v3 Engine Id to use for this device. Leave this field empty to use the SNMP Engine ID being defined per SNMPv3 Notification receiver.'),
'value' => '|arg1:snmp_engine_id|',
'default' => '',
'max_length' => '64',
'size' => '40'
),
'snmp_port' => array(
'method' => 'textbox',
'friendly_name' => __('SNMP Port'),
'description' => __('Enter the UDP port number to use for SNMP (default is 161).'),
'value' => '|arg1:snmp_port|',
'max_length' => '5',
'default' => read_config_option('snmp_port'),
'size' => '12'
),
'snmp_timeout' => array(
'method' => 'textbox',
'friendly_name' => __('SNMP Timeout'),
'description' => __('The maximum number of milliseconds Cacti will wait for an SNMP response (does not work with php-snmp support).'),
'value' => '|arg1:snmp_timeout|',
'max_length' => '8',
'default' => read_config_option('snmp_timeout'),
'size' => '12'
),
);
$fields_snmp_item_with_oids = $fields_snmp_item + array(
'max_oids' => array(
'method' => 'textbox',
'friendly_name' => __("Maximum OIDs Per Get Request"),
'description' => __('Specified the number of OIDs that can be obtained in a single SNMP Get request.'),
'value' => '|arg1:max_oids|',
'max_length' => '8',
'default' => read_config_option('max_get_size'),
'size' => '12'
),
);
$fields_snmp_item_with_retry = $fields_snmp_item_with_oids + array(
'snmp_retries' => array(
'method' => 'textbox',
'friendly_name' => __('SNMP Retries'),
'description' => __('The maximum number of attempts to reach a device via an SNMP readstring prior to giving up.'),
'value' => '|arg1:snmp_retries|',
'max_length' => '8',
'default' => read_config_option('snmp_retries'),
'size' => '12'
),
);
/* file: profiles.php, action: edit */
$fields_profile_edit = array(
'name' => array(
'method' => 'textbox',
'friendly_name' => __('Name'),
'description' => __('A useful name for this Data Storage and Polling Profile.'),
'value' => '|arg1:name|',
'max_length' => '255',
'size' => '80',
'default' => __('New Profile')
),
'step' => array(
'method' => 'drop_array',
'friendly_name' => __('Polling Interval'),
'description' => __('The frequency that data will be collected from the Data Source?'),
'array' => $sampling_intervals,
'value' => '|arg1:step|',
'default' => read_config_option('poller_interval'),
),
'heartbeat' => array(
'method' => 'drop_array',
'friendly_name' => __('Heartbeat'),
'description' => __('How long can data be missing before RRDtool records unknown data. Increase this value if your Data Source is unstable and you wish to carry forward old data rather than show gaps in your graphs. This value is multiplied by the X-Files Factor to determine the actual amount of time.'),
'array' => $heartbeats,
'value' => '|arg1:heartbeat|',
'default' => (read_config_option('poller_interval') * 2),
),
'x_files_factor' => array(
'method' => 'textbox',
'friendly_name' => __('X-Files Factor'),
'description' => __('The amount of unknown data that can still be regarded as known.'),
'value' => '|arg1:x_files_factor|',
'max_length' => '10',
'size' => '7',
'default' => '0.5'
),
'consolidation_function_id' => array(
'method' => 'drop_multi',
'friendly_name' => __('Consolidation Functions'),
'description' => __('How data is to be entered in RRAs.'),
'array' => $consolidation_functions,
'sql' => 'SELECT consolidation_function_id AS id, data_source_profile_id FROM data_source_profiles_cf WHERE data_source_profile_id="|arg1:id|"',
),
'default' => array(
'method' => 'checkbox',
'friendly_name' => __('Default'),
'description' => __('Is this the default storage profile?'),
'value' => '|arg1:default|',
'default' => '',
),
'size' => array(
'method' => 'other',
'friendly_name' => __('RRDfile Size (in Bytes)'),
'description' => __('Based upon the number of Rows in all RRAs and the number of Consolidation Functions selected, the size of this entire in the RRDfile.'),
'value' => ''
),
'id' => array(
'method' => 'hidden_zero',
'value' => '|arg1:id|'
),
'save_component_profile' => array(
'method' => 'hidden',
'value' => '1'
)
);
/* file: rra.php, action: edit */
$fields_profile_rra_edit = array(
'name' => array(
'method' => 'textbox',
'friendly_name' => __('Name'),
'description' => __('How data is to be entered in RRAs.'),
'value' => '|arg1:name|',
'max_length' => '100',
'size' => '60',
'default' => __('New Profile RRA')
),
'steps' => array(
'method' => 'drop_array',
'friendly_name' => __('Aggregation Level'),
'description' => __('The number of samples required prior to filling a row in the RRA specification. The first RRA should always have a value of 1.'),
'array' => $aggregation_levels,
'value' => '|arg1:steps|',
'default' => read_config_option('poller_interval'),
),
'rows' => array(
'method' => 'textbox',
'friendly_name' => __('Rows'),
'description' => __('How many generations data is kept in the RRA.'),
'value' => '|arg1:rows|',
'max_length' => '12',
'size' => '10',
'default' => '600'
),
'timespan' => array(
'method' => 'drop_array',
'friendly_name' => __('Default Timespan'),
'description' => __('When viewing a Graph based upon the RRA in question, the default Timespan to show for that Graph.'),
'value' => '|arg1:timespan|',
'array' => $timespans
),
'retention' => array(
'method' => 'other',
'friendly_name' => __('Data Retention'),
'description' => __('Based upon the Aggregation Level, the Rows, and the Polling Interval the amount of data that will be retained in the RRA'),
'value' => ''
),
'size' => array(
'method' => 'other',
'friendly_name' => __('RRA Size (in Bytes)'),
'description' => __('Based upon the number of Rows and the number of Consolidation Functions selected, the size of this RRA in the RRDfile.'),
'value' => ''
),
'id' => array(
'method' => 'hidden_zero',
'value' => '|arg1:id|'
),
'save_component_rra' => array(
'method' => 'hidden',
'value' => '1'
)
);
/* file: cdef.php, action: edit */
$fields_cdef_edit = array(
'name' => array(
'method' => 'textbox',
'friendly_name' => __('Name'),
'description' => __('A useful name for this CDEF.'),
'value' => '|arg1:name|',
'max_length' => '255',
'size' => '80'
),
'id' => array(
'method' => 'hidden_zero',
'value' => '|arg1:id|'
),
'save_component_cdef' => array(
'method' => 'hidden',
'value' => '1'
)
);
/* file: color.php, action: edit */
$fields_color_edit = array(
'name' => array(
'method' => 'textbox',
'friendly_name' => __('Name'),
'description' => __('The name of this Color.'),
'value' => '|arg1:name|',
'max_length' => '40',
'size' => '40'
),
'hex' => array(
'method' => 'textbox',
'friendly_name' => __('Hex Value'),
'description' => __('The hex value for this color; valid range: 000000-FFFFFF.'),
'value' => '|arg1:hex|',
'max_length' => '6',
'size' => '5'
),
'read_only' => array(
'method' => 'hidden',
'friendly_name' => __('Read Only'),
'description' => __('Any named color should be read only.'),
'value' => '|arg1:read_only|',
'default' => ''
),
'id' => array(
'method' => 'hidden_zero',
'value' => '|arg1:id|'
),
'hidden_name' => array(
'method' => 'hidden',
'value' => '|arg1:name|',
'max_length' => '40',
'size' => '40'
),
'save_component_color' => array(
'method' => 'hidden',
'value' => '1'
)
);
/* file: data_input.php, action: edit */
$fields_data_input_edit = array(
'name' => array(
'method' => 'textbox',
'friendly_name' => __('Name'),
'description' => __('Enter a meaningful name for this data input method.'),
'value' => '|arg1:name|',
'max_length' => '255',
'size' => '80'
),
'type_id' => array(
'method' => 'drop_array',
'friendly_name' => __('Input Type'),
'description' => __('Choose the method you wish to use to collect data for this Data Input method.'),
'value' => '|arg1:type_id|',
'array' => $input_types_script,
),
'input_string' => array(
'method' => 'textarea',
'friendly_name' => __('Input String'),
'description' => __('The data that is sent to the script, which includes the complete path to the script and input sources in <> brackets.'),
'value' => '|arg1:input_string|',
'textarea_rows' => '4',
'textarea_cols' => '60',
'class' => 'textAreaNotes',
'max_length' => '255',
),
'whitelist_verification' => array(
'method' => 'other',
'value' => '',
'friendly_name' => __('White List Check'),
'description' => __('The result of the Whitespace verification check for the specific Input Method. If the Input String changes, and the Whitelist file is not update, Graphs will not be allowed to be created.')
),
'id' => array(
'method' => 'hidden_zero',
'value' => '|arg1:id|'
),
'save_component_data_input' => array(
'method' => 'hidden',
'value' => '1'
)
);
/* file: data_input.php, action: field_edit (dropdown) */
$fields_data_input_field_edit_1 = array(
'data_name' => array(
'method' => 'drop_array',
'friendly_name' => __('Field [%s]', '|arg1:|'),
'description' => __('Choose the associated field from the %s field.', '|arg1:|'),
'value' => '|arg3:data_name|',
'array' => '|arg2:|',
)
);
/* file: data_input.php, action: field_edit (textbox) */
$fields_data_input_field_edit_2 = array(
'data_name' => array(
'method' => 'textbox',
'friendly_name' => __('Field [%s]', '|arg1:|'),
'description' => __('Enter a name for this %s field. Note: If using name value pairs in your script, for example: NAME:VALUE, it is important that the name match your output field name identically to the script output name or names.', '|arg1:|'),
'value' => '|arg2:data_name|',
'max_length' => '50',
'size' => '40'
)
);
/* file: data_input.php, action: field_edit */
$fields_data_input_field_edit = array(
'fname' => array(
'method' => 'textbox',
'friendly_name' => __('Friendly Name'),
'description' => __('Enter a meaningful name for this data input method.'),
'value' => '|arg1:name|',
'max_length' => '200',
'size' => '80'
),
'update_rra' => array(
'method' => 'checkbox',
'friendly_name' => __('Update RRDfile'),
'description' => __('Whether data from this output field is to be entered into the RRDfile.'),
'value' => '|arg1:update_rra|',
'default' => 'on',
'form_id' => '|arg1:id|'
),
'regexp_match' => array(
'method' => 'textbox',
'friendly_name' => __('Regular Expression Match'),
'description' => __('If you want to require a certain regular expression to be matched against input data, enter it here (preg_match format).'),
'value' => '|arg1:regexp_match|',
'max_length' => '200',
'size' => '80'
),
'allow_nulls' => array(
'method' => 'checkbox',
'friendly_name' => __('Allow Empty Input'),
'description' => __('Check here if you want to allow NULL input in this field from the user.'),
'value' => '|arg1:allow_nulls|',
'default' => '',
'form_id' => false
),
'type_code' => array(
'method' => 'textbox',
'friendly_name' => __('Special Type Code'),
'description' => __('If this field should be treated specially by host templates, indicate so here. Valid keywords for this field are %s', str_replace(")", "'", str_replace("(", "'", str_replace("|", ", ", $valid_host_fields))) ),
'value' => '|arg1:type_code|',
'max_length' => '40',
'size' => '20'
),
'id' => array(
'method' => 'hidden_zero',
'value' => '|arg1:id|'
),
'input_output' => array(
'method' => 'hidden',
'value' => '|arg2:|'
),
'sequence' => array(
'method' => 'hidden_zero',
'value' => '|arg1:sequence|'
),
'data_input_id' => array(
'method' => 'hidden_zero',
'value' => '|arg3:data_input_id|'
),
'save_component_field' => array(
'method' => 'hidden',
'value' => '1'
)
);
/* file: data_templates.php, action: template_edit */
$fields_data_template_template_edit = array(
'template_name' => array(
'method' => 'textbox',
'friendly_name' => __('Name'),
'description' => __('The name given to this data template.'),
'value' => '|arg1:name|',
'max_length' => '150',
'size' => '80'
),
'data_template_id' => array(
'method' => 'hidden_zero',
'value' => '|arg2:data_template_id|'
),
'data_template_data_id' => array(
'method' => 'hidden_zero',
'value' => '|arg2:id|'
),
'current_rrd' => array(
'method' => 'hidden_zero',
'value' => '|arg3:view_rrd|'
),
'save_component_template' => array(
'method' => 'hidden',
'value' => '1'
)
);
/* file: (data_sources.php|data_templates.php), action: (ds|template)_edit */
if (db_table_exists('data_source_profiles')) {
$def_profile = db_fetch_cell('SELECT id
FROM data_source_profiles
ORDER BY `default`
DESC LIMIT 1');
} else {
$def_profile = '1';
}
$struct_data_source = array(
'name' => array(
'friendly_name' => __('Name'),
'method' => 'textbox',
'max_length' => '250',
'size' => '80',
'default' => '',
'description' => __('Choose a name for this data source. It can include replacement variables such as |host_description| or |query_fieldName|. For a complete list of supported replacement tags, please see the Cacti documentation.'),
'flags' => ''
),
'data_source_path' => array(
'friendly_name' => __('Data Source Path'),
'method' => 'textbox',
'max_length' => '255',
'size' => '80',
'default' => '',
'description' => __('The full path to the RRDfile.'),
'flags' => 'NOTEMPLATE'
),
'data_input_id' => array(
'friendly_name' => __('Data Input Method'),
'method' => 'drop_sql',
'sql' => 'SELECT id, name FROM data_input ORDER BY name',
'default' => '',
'none_value' => __('None'),
'description' => __('The script/source used to gather data for this data source.'),
'flags' => 'ALWAYSTEMPLATE'
),
'data_source_profile_id' => array(
'friendly_name' => __('Data Source Profile'),
'method' => 'drop_sql',
'description' => __('Select the Data Source Profile. The Data Source Profile controls polling interval, the data aggregation, and retention policy for the resulting Data Sources.'),
'sql' => 'SELECT "0" AS id, "' . __('External') . '" AS name UNION SELECT id, name FROM data_source_profiles ORDER BY name',
'default' => $def_profile,
'flags' => ''
),
'rrd_step' => array(
'friendly_name' => __('Step'),
'method' => 'hidden',
'max_length' => '10',
'size' => '10',
'default' => '300',
'description' => __('The amount of time in seconds between expected updates.'),
'flags' => ''
),
'active' => array(
'friendly_name' => __('Data Source Active'),
'method' => 'checkbox',
'default' => 'on',
'description' => __('Whether Cacti should gather data for this data source or not.'),
'flags' => ''
)
);
/* file: (data_sources.php|data_templates.php), action: (ds|template)_edit */
$struct_data_source_item = array(
'data_source_name' => array(
'friendly_name' => __('Internal Data Source Name'),
'method' => 'textbox',
'max_length' => '19',
'size' => '30',
'default' => '',
'description' => __('Choose unique name to represent this piece of data inside of the RRDfile.')
),
'rrd_minimum' => array(
'friendly_name' => __('Minimum Value ("U" for No Minimum)'),
'method' => 'textbox',
'max_length' => '30',
'size' => '20',
'default' => '0',
'description' => __('The minimum value of data that is allowed to be collected.')
),
'rrd_maximum' => array(
'friendly_name' => __('Maximum Value ("U" for No Maximum)'),
'method' => 'textbox',
'max_length' => '30',
'size' => '20',
'default' => '0',
'description' => __('The maximum value of data that is allowed to be collected.')
),
'data_source_type_id' => array(
'friendly_name' => __('Data Source Type'),
'method' => 'drop_array',
'array' => $data_source_types,
'default' => '',
'description' => __('How data is represented in the RRA.')
),
'rrd_heartbeat' => array(
'friendly_name' => __('Heartbeat'),
'method' => 'hidden',
'max_length' => '20',
'size' => '10',
'default' => '600',
'description' => __('The maximum amount of time that can pass before data is entered as \'unknown\'. (Usually 2x300=600)')
),
'data_input_field_id' => array(
'friendly_name' => __('Output Field'),
'method' => 'drop_sql',
'default' => '0',
'none_value' => __('Not Selected'),
'description' => __('When data is gathered, the data for this field will be put into this data source.')
)
);
/* file: grprint_presets.php, action: edit */
$fields_grprint_presets_edit = array(
'name' => array(
'method' => 'textbox',
'friendly_name' => __('Name'),
'description' => __('Enter a name for this GPRINT preset, make sure it is something you recognize.'),
'value' => '|arg1:name|',
'max_length' => '50',
'size' => '40',
),
'gprint_text' => array(
'method' => 'textbox',
'friendly_name' => __('GPRINT Text'),
'description' => __('Enter the custom GPRINT string here.'),
'value' => '|arg1:gprint_text|',
'max_length' => '50',
'size' => '40',
),
'id' => array(
'method' => 'hidden_zero',
'value' => '|arg1:id|'
),
'save_component_gprint_presets' => array(
'method' => 'hidden',
'value' => '1'
)
);
/* file: (graphs.php|graph_templates.php), action: (graph|template)_edit */
$struct_graph = array(
'general_header' => array(
'friendly_name' => __('Common Options'),
'collapsible' => 'true',
'method' => 'spacer',
),
'title' => array(
'friendly_name' => __('Title (--title)'),
'method' => 'textbox',
'max_length' => '255',
'default' => '',
'description' => __('The name that is printed on the graph. It can include replacement variables such as |host_description| or |query_fieldName|. For a complete list of supported replacement tags, please see the Cacti documentation.'),
'size' => '80'
),
'vertical_label' => array(
'friendly_name' => __('Vertical Label (--vertical-label)'),
'method' => 'textbox',
'max_length' => '255',
'default' => '',
'description' => __('The label vertically printed to the left of the graph.'),
'size' => '30'
),
'image_format_id' => array(
'friendly_name' => __('Image Format (--imgformat)'),
'method' => 'drop_array',
'array' => $image_types,
'default' => read_config_option('default_image_format'),
'description' => __('The type of graph that is generated; PNG, GIF or SVG. The selection of graph image type is very RRDtool dependent.')
),
'height' => array(
'friendly_name' => __('Height (--height)'),
'method' => 'textbox',
'max_length' => '50',
'default' => read_config_option('default_graph_height'),
'description' => __('The height (in pixels) of the graph area within the graph. This area does not include the legend, axis legends, or title.'),
'size' => '7'
),
'width' => array(
'friendly_name' => __('Width (--width)'),
'method' => 'textbox',
'max_length' => '50',
'default' => read_config_option('default_graph_width'),
'description' => __('The width (in pixels) of the graph area within the graph. This area does not include the legend, axis legends, or title.'),
'size' => '7'
),
'base_value' => array(
'friendly_name' => __('Base Value (--base)'),
'method' => 'textbox',
'max_length' => '50',
'default' => '1000',
'description' => __('Should be set to 1024 for memory and 1000 for traffic measurements.'),
'size' => '12'
),
'slope_mode' => array(
'friendly_name' => __('Slope Mode (--slope-mode)'),
'method' => 'checkbox',
'default' => 'on',
'description' => __('Using Slope Mode evens out the shape of the graphs at the expense of some on screen resolution.')
),
'scaling_header' => array(
'friendly_name' => __('Scaling Options'),
'collapsible' => 'true',
'method' => 'spacer',
),
'auto_scale' => array(
'friendly_name' => __('Auto Scale'),
'method' => 'checkbox',
'default' => 'on',
'description' => __('Auto scale the y-axis instead of defining an upper and lower limit. Note: if this is check both the Upper and Lower limit will be ignored.'),
'size' => '7'
),
'auto_scale_opts' => array(
'friendly_name' => __('Auto Scale Options'),
'method' => 'radio',
'default' => '2',
'description' => __('Use <br> --alt-autoscale to scale to the absolute minimum and maximum <br> --alt-autoscale-max to scale to the maximum value, using a given lower limit <br> --alt-autoscale-min to scale to the minimum value, using a given upper limit <br> --alt-autoscale (with limits) to scale using both lower and upper limits (RRDtool default) <br>'),
'items' => array(
0 => array(
'radio_value' => '1',
'radio_caption' => __('Use --alt-autoscale (ignoring given limits)')
),
1 => array(
'radio_value' => '2',
'radio_caption' => __('Use --alt-autoscale-max (accepting a lower limit)')
),
2 => array(
'radio_value' => '3',
'radio_caption' => __('Use --alt-autoscale-min (accepting an upper limit)')
),
3 => array(
'radio_value' => '4',
'radio_caption' => __('Use --alt-autoscale (accepting both limits, RRDtool default)')
)
)
),
'auto_scale_log' => array(
'friendly_name' => __('Logarithmic Scaling (--logarithmic)'),
'method' => 'checkbox',
'default' => '',
'on_change' => 'changeScaleLog()',
'description' => __('Use Logarithmic y-axis scaling')
),
'scale_log_units' => array(
'friendly_name' => __('SI Units for Logarithmic Scaling (--units=si)'),
'method' => 'checkbox',
'default' => '',
'description' => __('Use SI Units for Logarithmic Scaling instead of using exponential notation.<br> Note: Linear graphs use SI notation by default.')
),
'auto_scale_rigid' => array(
'friendly_name' => __('Rigid Boundaries Mode (--rigid)'),
'method' => 'checkbox',
'default' => '',
'description' => __('Do not expand the lower and upper limit if the graph contains a value outside the valid range.')
),
'upper_limit' => array(
'friendly_name' => __('Upper Limit (--upper-limit)'),
'method' => 'textbox',
'max_length' => '50',
'default' => '100',
'description' => __('The maximum vertical value for the graph.'),
'size' => '12'
),
'lower_limit' => array(
'friendly_name' => __('Lower Limit (--lower-limit)'),
'method' => 'textbox',
'max_length' => '255',
'default' => '0',
'description' => __('The minimum vertical value for the graph.'),
'size' => '12'
),
'grid_header' => array(
'friendly_name' => __('Grid Options'),
'collapsible' => 'true',
'method' => 'spacer',
),
'unit_value' => array(
'friendly_name' => __('Unit Grid Value (--unit/--y-grid)'),
'method' => 'textbox',
'max_length' => '50',
'default' => '',
'description' => __('Sets the exponent value on the Y-axis for numbers. Note: This option is deprecated and replaced by the --y-grid option. In this option, Y-axis grid lines appear at each grid step interval. Labels are placed every label factor lines.'),
'size' => '12'
),
'unit_exponent_value' => array(
'friendly_name' => __('Unit Exponent Value (--units-exponent)'),
'method' => 'textbox',
'max_length' => '50',
'default' => '',
'description' => __('What unit Cacti should use on the Y-axis. Use 3 to display everything in "k" or -6 to display everything in "u" (micro).'),
'size' => '12'
),
'unit_length' => array(
'friendly_name' => __('Unit Length (--units-length <length>)'),
'method' => 'textbox',
'max_length' => '50',
'default' => '',
'size' => '30',
'description' => __('How many digits should RRDtool assume the y-axis labels to be? You may have to use this option to make enough space once you start fiddling with the y-axis labeling.'),
),
'no_gridfit' => array(
'friendly_name' => __('No Gridfit (--no-gridfit)'),
'method' => 'checkbox',
'default' => '',
'description' => __('In order to avoid anti-aliasing blurring effects RRDtool snaps points to device resolution pixels, this results in a crisper appearance. If this is not to your liking, you can use this switch to turn this behavior off.<br><strong>Note: </strong>Gridfitting is turned off for PDF, EPS, SVG output by default.'),
),
'alt_y_grid' => array(
'friendly_name' => __('Alternative Y Grid (--alt-y-grid)'),
'method' => 'checkbox',
'default' => '',
'description' => __('The algorithm ensures that you always have a grid, that there are enough but not too many grid lines, and that the grid is metric. This parameter will also ensure that you get enough decimals displayed even if your graph goes from 69.998 to 70.001.<br><strong>Note: </strong>This parameter may interfere with --alt-autoscale options.'),
),
'axis_header' => array(
'friendly_name' => __('Axis Options'),
'collapsible' => 'true',
'method' => 'spacer',
),
'right_axis' => array(
'friendly_name' => __('Right Axis (--right-axis <scale:shift>)'),
'method' => 'textbox',
'max_length' => '20',
'default' => '',
'size' => '20',
'description' => __('A second axis will be drawn to the right of the graph. It is tied to the left axis via the scale and shift parameters.'),
),
'right_axis_label' => array(
'friendly_name' => __('Right Axis Label (--right-axis-label <string>)'),
'method' => 'textbox',
'max_length' => '200',
'default' => '',
'size' => '30',
'description' => __('The label for the right axis.'),
),
'right_axis_format' => array(
'friendly_name' => __('Right Axis Format (--right-axis-format <format>)'),
'method' => 'drop_sql',
'sql' => 'SELECT id, name FROM graph_templates_gprint ORDER BY name',
'default' => '',
'none_value' => __('None'),
'description' => __('By default, the format of the axis labels gets determined automatically. If you want to do this yourself, use this option with the same %lf arguments you know from the PRINT and GPRINT commands.'),
),
'right_axis_formatter' => array(
'friendly_name' => __('Right Axis Formatter (--right-axis-formatter <formatname>)'),
'method' => 'drop_array',
'array' => $rrd_axis_formatters,
'default' => '0',
'none_value' => __('None'),
'description' => __('When you setup the right axis labeling, apply a rule to the data format. Supported formats include "numeric" where data is treated as numeric, "timestamp" where values are interpreted as UNIX timestamps (number of seconds since January 1970) and expressed using strftime format (default is "%Y-%m-%d %H:%M:%S"). See also --units-length and --right-axis-format. Finally "duration" where values are interpreted as duration in milliseconds. Formatting follows the rules of valstrfduration qualified PRINT/GPRINT.'),
),
'left_axis_formatter' => array(
'friendly_name' => __('Left Axis Formatter (--left-axis-formatter <formatname>)'),
'method' => 'drop_array',
'array' => $rrd_axis_formatters,
'default' => '0',
'none_value' => __('None'),
'description' => __('When you setup the left axis labeling, apply a rule to the data format. Supported formats include "numeric" where data is treated as numeric, "timestamp" where values are interpreted as UNIX timestamps (number of seconds since January 1970) and expressed using strftime format (default is "%Y-%m-%d %H:%M:%S"). See also --units-length. Finally "duration" where values are interpreted as duration in milliseconds. Formatting follows the rules of valstrfduration qualified PRINT/GPRINT.'),
),
'legend_header' => array(
'friendly_name' => __('Legend Options'),
'collapsible' => 'true',
'method' => 'spacer',
),
'auto_padding' => array(
'friendly_name' => __('Auto Padding'),
'method' => 'checkbox',
'default' => 'on',
'description' => __('Pad text so that legend and graph data always line up. Note: this could cause graphs to take longer to render because of the larger overhead. Also Auto Padding may not be accurate on all types of graphs, consistent labeling usually helps.')
),
'dynamic_labels' => array(
'friendly_name' => __('Dynamic Labels (--dynamic-labels)'),
'method' => 'checkbox',
'default' => '',
'description' => __('Draw line markers as a line.'),
),
'force_rules_legend' => array(
'friendly_name' => __('Force Rules Legend (--force-rules-legend)'),
'method' => 'checkbox',
'default' => '',
'description' => __('Force the generation of HRULE and VRULE legends.'),
),
'tab_width' => array(
'friendly_name' => __('Tab Width (--tabwidth <pixels>)'),
'method' => 'textbox',
'max_length' => '50',
'default' => '',
'size' => '10',
'description' => __('By default the tab-width is 40 pixels, use this option to change it.')
),
'legend_position' => array(
'friendly_name' => __('Legend Position (--legend-position=<position>)'),
'method' => 'drop_array',
'array' => $rrd_legend_position,
'none_value' => __('None'),
'description' => __('Place the legend at the given side of the graph.'),
),
'legend_direction' => array(
'friendly_name' => __('Legend Direction (--legend-direction=<direction>)'),
'method' => 'drop_array',
'array' => $rrd_legend_direction,
'none_value' => __('None'),
'description' => __('Place the legend items in the given vertical order.'),
),
);
/* file: (graphs.php|graph_templates.php), action: item_edit */
$struct_graph_item = array(
'graph_type_id' => array(
'friendly_name' => __('Graph Item Type'),
'method' => 'drop_array',
'array' => $graph_item_types,
'default' => '4',
'description' => __('How data for this item is represented visually on the graph.')
),
'task_item_id' => array(
'friendly_name' => __('Data Source'),
'method' => 'drop_sql',
'sql' => 'SELECT
CONCAT_WS("",case when host.description is null then "No Device" when host.description is not null then host.description end," - ",data_template_data.name," (",data_template_rrd.data_source_name,")") AS name,
data_template_rrd.id
FROM (data_template_data,data_template_rrd,data_local)
LEFT JOIN host ON (data_local.host_id=host.id)
WHERE data_template_rrd.local_data_id=data_local.id
AND data_template_data.local_data_id=data_local.id
ORDER BY name',
'default' => '0',
'none_value' => __('None'),
'description' => __('The data source to use for this graph item.')
),
'color_id' => array(
'friendly_name' => __('Color'),
'method' => 'drop_color',
'default' => '0',
'on_change' => 'changeColorId()',
'description' => __('The color to use for the legend.')
),
'alpha' => array(
'friendly_name' => __('Opacity/Alpha Channel'),
'method' => 'drop_array',
'default' => 'FF',
'array' => $graph_color_alpha,
'description' => __('The opacity/alpha channel of the color.')
),
'consolidation_function_id' => array(
'friendly_name' => __('Consolidation Function'),
'method' => 'drop_array',
'array' => $consolidation_functions,
'default' => '0',
'description' => __('How data for this item is represented statistically on the graph.')
),
'cdef_id' => array(
'friendly_name' => __('CDEF Function'),
'method' => 'drop_sql',
'sql' => 'SELECT id, name FROM cdef ORDER BY name',
'default' => '0',
'none_value' => __('None'),
'description' => __('A CDEF (math) function to apply to this item on the graph or legend.')
),
'vdef_id' => array(
'friendly_name' => __('VDEF Function'),
'method' => 'drop_sql',
'sql' => 'SELECT id, name FROM vdef ORDER BY name',
'default' => '0',
'none_value' => __('None'),
'description' => __('A VDEF (math) function to apply to this item on the graph legend.')
),
'shift' => array(
'friendly_name' => __('Shift Data'),
'method' => 'checkbox',
'default' => '',
'description' => __('Offset your data on the time axis (x-axis) by the amount specified in the \'value\' field.'),
),
'value' => array(
'friendly_name' => __('Value'),
'method' => 'textbox',
'max_length' => '255',
'size' => '80',
'default' => '',
'description' => __('[HRULE|VRULE]: The value of the graph item.<br/> [TICK]: The fraction for the tick line.<br/> [SHIFT]: The time offset in seconds.')
),
'gprint_id' => array(
'friendly_name' => __('GPRINT Type'),
'method' => 'drop_sql',
'sql' => 'SELECT id, name FROM graph_templates_gprint ORDER BY name',
'default' => '2',
'description' => __('If this graph item is a GPRINT, you can optionally choose another format here. You can define additional types under "GPRINT Presets".')
),
'textalign' => array(
'friendly_name' => __('Text Alignment' . ' (TEXTALIGN)'),
'method' => 'drop_array',