| 1 | <? | 
 
 
 
 
 | 2 |  | 
 
 
 
 
 | 3 | # The rrd directory containing the images | 
 
 
 
 
 | 4 | $imgdir = "/home/pkg/iscream/public_html/graphs"; | 
 
 
 
 
 | 5 | $imgwebdir = "/graphs"; | 
 
 
 
 
 | 6 |  | 
 
 
 
 
 | 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 |  | 
 
 
 
 
 | 42 | # The name Paging information should be displayed as | 
 
 
 
 
 | 43 | if($string == "paging") { | 
 
 
 
 
 | 44 | return "Paging"; | 
 
 
 
 
 | 45 | } | 
 
 
 
 
 | 46 |  | 
 
 
 
 
 | 47 | # The name Uptime information should be displayed as | 
 
 
 
 
 | 48 | if($string == "uptime") { | 
 
 
 
 
 | 49 | return "Uptime"; | 
 
 
 
 
 | 50 | } | 
 
 
 
 
 | 51 |  | 
 
 
 
 
 | 52 | # 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 | # (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 |  | 
 
 
 
 
 | 64 | # The name Disk information should be displayed as | 
 
 
 
 
 | 65 | if(preg_match("/^disk-(\S+)$/", $string, $matches)) { | 
 
 
 
 
 | 66 | $string = preg_replace("/$hex_slash/", "/", $matches[1]); | 
 
 
 
 
 | 67 | $string = preg_replace("/$hex_underscore/", "_", $string); | 
 
 
 
 
 | 68 | $string = preg_replace("/$hex_bslash/", "\\", $string); | 
 
 
 
 
 | 69 | $string = preg_replace("/$hex_space/", " ", $string); | 
 
 
 
 
 | 70 | $string = preg_replace("/$hex_colon/", ":", $string); | 
 
 
 
 
 | 71 | return "Disk usage: $string"; | 
 
 
 
 
 | 72 | } | 
 
 
 
 
 | 73 |  | 
 
 
 
 
 | 74 | # The name DiskIO information should be displayed as | 
 
 
 
 
 | 75 | if(preg_match("/^diskio-(\S+)$/", $string, $matches)) { | 
 
 
 
 
 | 76 | $string = preg_replace("/$hex_slash/", "/", $matches[1]); | 
 
 
 
 
 | 77 | $string = preg_replace("/$hex_underscore/", "_", $string); | 
 
 
 
 
 | 78 | $string = preg_replace("/$hex_bslash/", "\\", $string); | 
 
 
 
 
 | 79 | $string = preg_replace("/$hex_space/", " ", $string); | 
 
 
 
 
 | 80 | $string = preg_replace("/$hex_colon/", ":", $string); | 
 
 
 
 
 | 81 | return "Disk IO: $string"; | 
 
 
 
 
 | 82 | } | 
 
 
 
 
 | 83 |  | 
 
 
 
 
 | 84 | # The name Network information should be displayed as | 
 
 
 
 
 | 85 | if(preg_match("/^net-(\S+)$/", $string, $matches)) { | 
 
 
 
 
 | 86 | $string = preg_replace("/$hex_slash/", "/", $matches[1]); | 
 
 
 
 
 | 87 | $string = preg_replace("/$hex_underscore/", "_", $string); | 
 
 
 
 
 | 88 | $string = preg_replace("/$hex_bslash/", "\\", $string); | 
 
 
 
 
 | 89 | $string = preg_replace("/$hex_space/", " ", $string); | 
 
 
 
 
 | 90 | $string = preg_replace("/$hex_colon/", ":", $string); | 
 
 
 
 
 | 91 | return "Network IO: $string"; | 
 
 
 
 
 | 92 | } | 
 
 
 
 
 | 93 |  | 
 
 
 
 
 | 94 | # The name Mail Queue information should be displayed as | 
 
 
 
 
 | 95 | if(preg_match("/^mailq-(\S+)$/", $string, $matches)) { | 
 
 
 
 
 | 96 | return "Mail Queue Size: $matches[1]"; | 
 
 
 
 
 | 97 | } | 
 
 
 
 
 | 98 |  | 
 
 
 
 
 | 99 | # The name Queue information should be displayed as | 
 
 
 
 
 | 100 | if($machine_name == "i-scream-server" && preg_match("/^\d+$/", $string)) { | 
 
 
 
 
 | 101 | $readfile = file("/u1/i-scream/databases/$machine_name/$string.def"); | 
 
 
 
 
 | 102 | return "Queue: $readfile[0]"; | 
 
 
 
 
 | 103 | } | 
 
 
 
 
 | 104 |  | 
 
 
 
 
 | 105 | # Catch all... don't change it | 
 
 
 
 
 | 106 | return "$string"; | 
 
 
 
 
 | 107 | } | 
 
 
 
 
 | 108 |  | 
 
 
 
 
 | 109 | # Files to include | 
 
 
 
 
 | 110 | $titleHTML = "title.inc.php"; | 
 
 
 
 
 | 111 | $bottomHTML = "bottom.inc"; | 
 
 
 
 
 | 112 |  | 
 
 
 
 
 | 113 | # Submission details. | 
 
 
 
 
 | 114 | $formMethod = "GET"; | 
 
 
 
 
 | 115 | $thisPage = "graphs.php"; | 
 
 
 
 
 | 116 |  | 
 
 
 
 
 | 117 | ?> |