| 1 | tdb | 1.9 | <?php | 
 
 
 
 
 
 
 
 | 2 | tdb | 1.1 |  | 
 
 
 
 
 | 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.8 | # # converted to a decimal then hex'd | 
 
 
 
 
 | 70 |  |  | $hex_hash = "_23"; | 
 
 
 
 
 
 
 
 | 71 | tdb | 1.1 |  | 
 
 
 
 
 | 72 |  |  | # The name Disk information should be displayed as | 
 
 
 
 
 | 73 |  |  | if(preg_match("/^disk-(\S+)$/", $string, $matches)) { | 
 
 
 
 
 | 74 |  |  | $string = preg_replace("/$hex_slash/", "/", $matches[1]); | 
 
 
 
 
 
 
 
 | 75 | tdb | 1.2 | $string = preg_replace("/$hex_underscore/", "_", $string); | 
 
 
 
 
 
 
 
 | 76 | tdb | 1.5 | $string = preg_replace("/$hex_bslash/", "\\", $string); | 
 
 
 
 
 | 77 |  |  | $string = preg_replace("/$hex_space/", " ", $string); | 
 
 
 
 
 | 78 |  |  | $string = preg_replace("/$hex_colon/", ":", $string); | 
 
 
 
 
 
 
 
 | 79 | tdb | 1.1 | return "Disk usage: $string"; | 
 
 
 
 
 | 80 |  |  | } | 
 
 
 
 
 
 
 
 | 81 | tdb | 1.4 |  | 
 
 
 
 
 | 82 |  |  | # The name DiskIO information should be displayed as | 
 
 
 
 
 | 83 |  |  | if(preg_match("/^diskio-(\S+)$/", $string, $matches)) { | 
 
 
 
 
 
 
 
 | 84 | tdb | 1.5 | $string = preg_replace("/$hex_slash/", "/", $matches[1]); | 
 
 
 
 
 | 85 |  |  | $string = preg_replace("/$hex_underscore/", "_", $string); | 
 
 
 
 
 | 86 |  |  | $string = preg_replace("/$hex_bslash/", "\\", $string); | 
 
 
 
 
 | 87 |  |  | $string = preg_replace("/$hex_space/", " ", $string); | 
 
 
 
 
 | 88 |  |  | $string = preg_replace("/$hex_colon/", ":", $string); | 
 
 
 
 
 | 89 |  |  | return "Disk IO: $string"; | 
 
 
 
 
 
 
 
 | 90 | tdb | 1.4 | } | 
 
 
 
 
 | 91 |  |  |  | 
 
 
 
 
 | 92 |  |  | # The name Network information should be displayed as | 
 
 
 
 
 | 93 |  |  | if(preg_match("/^net-(\S+)$/", $string, $matches)) { | 
 
 
 
 
 
 
 
 | 94 | tdb | 1.5 | $string = preg_replace("/$hex_slash/", "/", $matches[1]); | 
 
 
 
 
 | 95 |  |  | $string = preg_replace("/$hex_underscore/", "_", $string); | 
 
 
 
 
 | 96 |  |  | $string = preg_replace("/$hex_bslash/", "\\", $string); | 
 
 
 
 
 | 97 |  |  | $string = preg_replace("/$hex_space/", " ", $string); | 
 
 
 
 
 | 98 |  |  | $string = preg_replace("/$hex_colon/", ":", $string); | 
 
 
 
 
 
 
 
 | 99 | tdb | 1.7 | $string = preg_replace("/$hex_lbracket/", "(", $string); | 
 
 
 
 
 | 100 |  |  | $string = preg_replace("/$hex_rbracket/", ")", $string); | 
 
 
 
 
 | 101 |  |  | $string = preg_replace("/$hex_plus/", "+", $string); | 
 
 
 
 
 
 
 
 | 102 | tdb | 1.8 | $string = preg_replace("/$hex_hash/", "#", $string); | 
 
 
 
 
 
 
 
 | 103 | tdb | 1.6 | return "Network IO: $string"; | 
 
 
 
 
 
 
 
 | 104 | tdb | 1.5 | } | 
 
 
 
 
 | 105 |  |  |  | 
 
 
 
 
 | 106 |  |  | # The name Mail Queue information should be displayed as | 
 
 
 
 
 | 107 |  |  | if(preg_match("/^mailq-(\S+)$/", $string, $matches)) { | 
 
 
 
 
 | 108 |  |  | return "Mail Queue Size: $matches[1]"; | 
 
 
 
 
 
 
 
 | 109 | tdb | 1.4 | } | 
 
 
 
 
 
 
 
 | 110 | tdb | 1.1 |  | 
 
 
 
 
 | 111 |  |  | # The name Queue information should be displayed as | 
 
 
 
 
 | 112 |  |  | if($machine_name == "i-scream-server" && preg_match("/^\d+$/", $string)) { | 
 
 
 
 
 | 113 |  |  | $readfile = file("/u1/i-scream/databases/$machine_name/$string.def"); | 
 
 
 
 
 | 114 |  |  | return "Queue: $readfile[0]"; | 
 
 
 
 
 | 115 |  |  | } | 
 
 
 
 
 | 116 |  |  |  | 
 
 
 
 
 | 117 |  |  | # Catch all... don't change it | 
 
 
 
 
 | 118 |  |  | return "$string"; | 
 
 
 
 
 | 119 |  |  | } | 
 
 
 
 
 | 120 |  |  |  | 
 
 
 
 
 | 121 |  |  | # Files to include | 
 
 
 
 
 | 122 |  |  | $titleHTML = "title.inc.php"; | 
 
 
 
 
 | 123 |  |  | $bottomHTML = "bottom.inc"; | 
 
 
 
 
 | 124 |  |  |  | 
 
 
 
 
 | 125 |  |  | # Submission details. | 
 
 
 
 
 | 126 |  |  | $formMethod = "GET"; | 
 
 
 
 
 | 127 |  |  | $thisPage = "graphs.php"; | 
 
 
 
 
 | 128 |  |  |  | 
 
 
 
 
 | 129 |  |  | ?> |