ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/php/graphs/graphs_config.inc.php
Revision: 1.7
Committed: Wed Jun 15 10:41:24 2005 UTC (19 years, 4 months ago) by tdb
Branch: MAIN
Changes since 1.6: +9 -0 lines
Log Message:
Escape more values in filenames. Thanks skel.

File Contents

# User Rev Content
1 tdb 1.1 <?
2    
3     # The rrd directory containing the images
4     $imgdir = "/home/pkg/iscream/public_html/graphs";
5 tdb 1.3 $imgwebdir = "/graphs";
6 tdb 1.1
7     # Page appearance
8     $lineColor = "#9999ff";
9    
10     # tidy up the visual names
11     function tidyName($machine_name, $string) {
12     # The name CPU information should be displayed as
13     if($string == "cpu") {
14     return "Processor usage";
15     }
16    
17     # The name Load information should be displayed as
18     if($string == "load") {
19     return "System loads";
20     }
21    
22     # The name Memory information should be displayed as
23     if($string == "mem") {
24     return "Memory usage";
25     }
26    
27     # The name Process information should be displayed as
28     if($string == "proc") {
29     return "Processes";
30     }
31    
32     # The name Swap information should be displayed as
33     if($string == "swap") {
34     return "Swap usage";
35     }
36    
37     # The name User information should be displayed as
38     if($string == "users") {
39     return "User counts";
40     }
41 tdb 1.3
42     # The name Paging information should be displayed as
43     if($string == "paging") {
44     return "Paging";
45     }
46    
47 tdb 1.5 # The name Uptime information should be displayed as
48     if($string == "uptime") {
49     return "Uptime";
50     }
51    
52 tdb 1.1 # Values use for escaping (need to match the perl scripts!)
53     # / converted to a decimal then hex'd
54     $hex_slash = "_2f";
55     # _ converted to a decimal then hex'd
56     $hex_underscore = "_5f";
57 tdb 1.5 # (space) converted to a decimal then hex'd
58     $hex_space = "_20";
59     # : converted to a decimal then hex'd
60     $hex_colon = "_3A";
61     # \ converted to a decimal then hex'd
62     $hex_bslash = "_5C";
63 tdb 1.7 # ( converted to a decimal then hex'd
64     $hex_rbracket = "_28";
65     # ) converted to a decimal then hex'd
66     $hex_lbracket = "_29";
67     # + converted to a decimal then hex'd
68     $hex_plus = "_2B";
69 tdb 1.1
70     # The name Disk information should be displayed as
71     if(preg_match("/^disk-(\S+)$/", $string, $matches)) {
72     $string = preg_replace("/$hex_slash/", "/", $matches[1]);
73 tdb 1.2 $string = preg_replace("/$hex_underscore/", "_", $string);
74 tdb 1.5 $string = preg_replace("/$hex_bslash/", "\\", $string);
75     $string = preg_replace("/$hex_space/", " ", $string);
76     $string = preg_replace("/$hex_colon/", ":", $string);
77 tdb 1.1 return "Disk usage: $string";
78     }
79 tdb 1.4
80     # The name DiskIO information should be displayed as
81     if(preg_match("/^diskio-(\S+)$/", $string, $matches)) {
82 tdb 1.5 $string = preg_replace("/$hex_slash/", "/", $matches[1]);
83     $string = preg_replace("/$hex_underscore/", "_", $string);
84     $string = preg_replace("/$hex_bslash/", "\\", $string);
85     $string = preg_replace("/$hex_space/", " ", $string);
86     $string = preg_replace("/$hex_colon/", ":", $string);
87     return "Disk IO: $string";
88 tdb 1.4 }
89    
90     # The name Network information should be displayed as
91     if(preg_match("/^net-(\S+)$/", $string, $matches)) {
92 tdb 1.5 $string = preg_replace("/$hex_slash/", "/", $matches[1]);
93     $string = preg_replace("/$hex_underscore/", "_", $string);
94     $string = preg_replace("/$hex_bslash/", "\\", $string);
95     $string = preg_replace("/$hex_space/", " ", $string);
96     $string = preg_replace("/$hex_colon/", ":", $string);
97 tdb 1.7 $string = preg_replace("/$hex_lbracket/", "(", $string);
98     $string = preg_replace("/$hex_rbracket/", ")", $string);
99     $string = preg_replace("/$hex_plus/", "+", $string);
100 tdb 1.6 return "Network IO: $string";
101 tdb 1.5 }
102    
103     # The name Mail Queue information should be displayed as
104     if(preg_match("/^mailq-(\S+)$/", $string, $matches)) {
105     return "Mail Queue Size: $matches[1]";
106 tdb 1.4 }
107 tdb 1.1
108     # The name Queue information should be displayed as
109     if($machine_name == "i-scream-server" && preg_match("/^\d+$/", $string)) {
110     $readfile = file("/u1/i-scream/databases/$machine_name/$string.def");
111     return "Queue: $readfile[0]";
112     }
113    
114     # Catch all... don't change it
115     return "$string";
116     }
117    
118     # Files to include
119     $titleHTML = "title.inc.php";
120     $bottomHTML = "bottom.inc";
121    
122     # Submission details.
123     $formMethod = "GET";
124     $thisPage = "graphs.php";
125    
126     ?>