Compare commits

...

5 Commits

6 changed files with 162 additions and 113 deletions

View File

@ -15,15 +15,15 @@
} }
}, },
"require": { "require": {
"php": ">=7.4.0", "php": ">=8.0",
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-rrd": "*", "ext-rrd": "*",
"phpmailer/phpmailer": "^6.4", "phpmailer/phpmailer": "^6.5",
"twig/twig": "^3.3" "twig/twig": "^3.3"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^3.0" "friendsofphp/php-cs-fixer": "^3.2"
}, },
"license": "MIT", "license": "MIT",
"authors": [ "authors": [

122
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "9c1a38df70a4ffb7cbf9c4d9f7fed95c", "content-hash": "fcf932155c8963e13d7886067a859a26",
"packages": [ "packages": [
{ {
"name": "phpmailer/phpmailer", "name": "phpmailer/phpmailer",
@ -323,16 +323,16 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "composer/semver", "name": "composer/semver",
"version": "3.2.5", "version": "3.2.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/semver.git", "url": "https://github.com/composer/semver.git",
"reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9" "reference": "83e511e247de329283478496f7a1e114c9517506"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/31f3ea725711245195f62e54ffa402d8ef2fdba9", "url": "https://api.github.com/repos/composer/semver/zipball/83e511e247de329283478496f7a1e114c9517506",
"reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9", "reference": "83e511e247de329283478496f7a1e114c9517506",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -384,7 +384,7 @@
"support": { "support": {
"irc": "irc://irc.freenode.org/composer", "irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/semver/issues", "issues": "https://github.com/composer/semver/issues",
"source": "https://github.com/composer/semver/tree/3.2.5" "source": "https://github.com/composer/semver/tree/3.2.6"
}, },
"funding": [ "funding": [
{ {
@ -400,7 +400,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-24T12:41:47+00:00" "time": "2021-10-25T11:34:17+00:00"
}, },
{ {
"name": "composer/xdebug-handler", "name": "composer/xdebug-handler",
@ -620,16 +620,16 @@
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v3.2.1", "version": "v3.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
"reference": "13ae36a76b6e329e44ca3cafaa784ea02db9ff14" "reference": "06bdbdfcd619183dd7a1a6948360f8af73b9ecec"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/13ae36a76b6e329e44ca3cafaa784ea02db9ff14", "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/06bdbdfcd619183dd7a1a6948360f8af73b9ecec",
"reference": "13ae36a76b6e329e44ca3cafaa784ea02db9ff14", "reference": "06bdbdfcd619183dd7a1a6948360f8af73b9ecec",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -638,18 +638,19 @@
"doctrine/annotations": "^1.12", "doctrine/annotations": "^1.12",
"ext-json": "*", "ext-json": "*",
"ext-tokenizer": "*", "ext-tokenizer": "*",
"php": "^7.2 || ^8.0", "php": "^7.2.5 || ^8.0",
"php-cs-fixer/diff": "^2.0", "php-cs-fixer/diff": "^2.0",
"symfony/console": "^4.4.20 || ^5.1.3", "symfony/console": "^5.1.3",
"symfony/event-dispatcher": "^4.4.20 || ^5.0", "symfony/event-dispatcher": "^5.0",
"symfony/filesystem": "^4.4.20 || ^5.0", "symfony/filesystem": "^5.0",
"symfony/finder": "^4.4.20 || ^5.0", "symfony/finder": "^5.0",
"symfony/options-resolver": "^4.4.20 || ^5.0", "symfony/options-resolver": "^5.0",
"symfony/polyfill-mbstring": "^1.23",
"symfony/polyfill-php72": "^1.23", "symfony/polyfill-php72": "^1.23",
"symfony/polyfill-php80": "^1.23", "symfony/polyfill-php80": "^1.23",
"symfony/polyfill-php81": "^1.23", "symfony/polyfill-php81": "^1.23",
"symfony/process": "^4.4.20 || ^5.0", "symfony/process": "^5.0",
"symfony/stopwatch": "^4.4.20 || ^5.0" "symfony/stopwatch": "^5.0"
}, },
"require-dev": { "require-dev": {
"justinrainbow/json-schema": "^5.2", "justinrainbow/json-schema": "^5.2",
@ -665,12 +666,11 @@
"phpunitgoodpractices/polyfill": "^1.5", "phpunitgoodpractices/polyfill": "^1.5",
"phpunitgoodpractices/traits": "^1.9.1", "phpunitgoodpractices/traits": "^1.9.1",
"symfony/phpunit-bridge": "^5.2.4", "symfony/phpunit-bridge": "^5.2.4",
"symfony/yaml": "^4.4.20 || ^5.0" "symfony/yaml": "^5.0"
}, },
"suggest": { "suggest": {
"ext-dom": "For handling output formats in XML", "ext-dom": "For handling output formats in XML",
"ext-mbstring": "For handling non-UTF8 characters.", "ext-mbstring": "For handling non-UTF8 characters."
"symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible."
}, },
"bin": [ "bin": [
"php-cs-fixer" "php-cs-fixer"
@ -698,7 +698,7 @@
"description": "A tool to automatically fix PHP code style", "description": "A tool to automatically fix PHP code style",
"support": { "support": {
"issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues",
"source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.2.1" "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.3.2"
}, },
"funding": [ "funding": [
{ {
@ -706,7 +706,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-10-05T08:12:17+00:00" "time": "2021-11-15T18:06:47+00:00"
}, },
{ {
"name": "php-cs-fixer/diff", "name": "php-cs-fixer/diff",
@ -762,20 +762,20 @@
}, },
{ {
"name": "psr/cache", "name": "psr/cache",
"version": "1.0.1", "version": "3.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/cache.git", "url": "https://github.com/php-fig/cache.git",
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=8.0.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -795,7 +795,7 @@
"authors": [ "authors": [
{ {
"name": "PHP-FIG", "name": "PHP-FIG",
"homepage": "http://www.php-fig.org/" "homepage": "https://www.php-fig.org/"
} }
], ],
"description": "Common interface for caching libraries", "description": "Common interface for caching libraries",
@ -805,26 +805,26 @@
"psr-6" "psr-6"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/cache/tree/master" "source": "https://github.com/php-fig/cache/tree/3.0.0"
}, },
"time": "2016-08-06T20:24:11+00:00" "time": "2021-02-03T23:26:27+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
"version": "1.1.1", "version": "1.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/container.git", "url": "https://github.com/php-fig/container.git",
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" "reference": "513e0666f7216c7459170d56df27dfcefe1689ea"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea",
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", "reference": "513e0666f7216c7459170d56df27dfcefe1689ea",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.0" "php": ">=7.4.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -853,9 +853,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/php-fig/container/issues", "issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/1.1.1" "source": "https://github.com/php-fig/container/tree/1.1.2"
}, },
"time": "2021-03-05T17:36:06+00:00" "time": "2021-11-05T16:50:12+00:00"
}, },
{ {
"name": "psr/event-dispatcher", "name": "psr/event-dispatcher",
@ -909,30 +909,30 @@
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "1.1.4", "version": "2.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11" "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11", "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=8.0.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.1.x-dev" "dev-master": "2.0.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Psr\\Log\\": "Psr/Log/" "Psr\\Log\\": "src"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -953,22 +953,22 @@
"psr-3" "psr-3"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/log/tree/1.1.4" "source": "https://github.com/php-fig/log/tree/2.0.0"
}, },
"time": "2021-05-03T11:20:27+00:00" "time": "2021-07-14T16:41:46+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v5.3.7", "version": "v5.3.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" "reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", "url": "https://api.github.com/repos/symfony/console/zipball/d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3",
"reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", "reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1038,7 +1038,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v5.3.7" "source": "https://github.com/symfony/console/tree/v5.3.10"
}, },
"funding": [ "funding": [
{ {
@ -1054,7 +1054,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-08-25T20:02:16+00:00" "time": "2021-10-26T09:30:15+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -2168,16 +2168,16 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v5.3.7", "version": "v5.3.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" "reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", "url": "https://api.github.com/repos/symfony/string/zipball/d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c",
"reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", "reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2231,7 +2231,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v5.3.7" "source": "https://github.com/symfony/string/tree/v5.3.10"
}, },
"funding": [ "funding": [
{ {
@ -2247,7 +2247,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-08-26T08:00:08+00:00" "time": "2021-10-27T18:21:46+00:00"
} }
], ],
"aliases": [], "aliases": [],
@ -2256,7 +2256,7 @@
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": ">=7.4.0", "php": ">=8.0",
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-rrd": "*" "ext-rrd": "*"

View File

@ -1,5 +1,5 @@
body { body {
margin: 2em 1em 2em 70px; margin: 2em 1em 0 3em;
color: black; color: black;
background: white; background: white;
background-position: top left; background-position: top left;
@ -9,19 +9,19 @@ body {
text-align: center; text-align: center;
} }
th.requirement { background-color: #ff66ff; color: black; } h1 { text-align: center; }
h2, h3, h4, h5, h6 { text-align: left; }
h1 { color: black; font: 120% sans-serif; font-weight: bold; }
h2 { color: #005A9C; font: 110%; font-weight: medium; }
h3 { color: #001A4C; font: 105% sans-serif; font-weight: medium; }
h4 { color: #007A9C; font: 90% sans-serif; font-weight: medium; }
h5 { color: #005A9C; font: italic 80% sans-serif; }
h6 { font: small-caps 70% sans-serif; }
h1 {text-align: center} img { width: auto; height: auto; max-width: 100%; max-height: 100%; }
h2, h3, h4, h5, h6 { text-align: left }
h1 { color: black; font: 120% sans-serif; font-weight: bold} main { display: flex; flex-wrap: wrap; }
h2 { color: #005A9C; font: 110%; font-weight: medium} main div.graph { margin: 5px auto; }
h3 { color: #001A4C; font: 105% sans-serif; font-weight: medium} main div.range-select span { color: blue; text-decoration: underline; cursor: pointer; }
h4 { color: #007A9C; font: 90% sans-serif; font-weight: medium}
h5 { color: #005A9C; font: italic 80% sans-serif }
h6 { font: small-caps 70% sans-serif }
pre {
background-color: lightcyan;
text-color: black;
}

View File

@ -1,33 +1,72 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <html lang="en">
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta charset="utf-8">
<meta http-equiv="content-language" content="ja" /> <title>C407 Server Room Temperature</title>
<meta http-equiv="Content-Stype-Type" content="text/css" /> <meta name="description" content="C407 Server Room Temperature">
<meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta name="author" content="Neuroinformatics Unit, RIKEN CBS">
<meta http-equiv="refresh" content="60" /> <meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/default.css" /> <meta http-equiv="refresh" content="300">
<title>C407 Server Room Temperature</title> <link rel="stylesheet" href="css/default.css">
</head> </head>
<body> <body>
<h1>C407 Server Room Temperature</h1> <h1>C407 Server Room Temperature</h1>
<table> <main>
<tbody> <div class="graph">
<tr> <div class="range-select">
<td><img src="./images/graph-hour.png" alt="Hourly Graph" /></td> Hour:
<td><img src="./images/graph-day.png" alt="Daily Graph" /></td> <span onclick="changeGraph('g1', 'hour', 1)">1</span> ...
</tr> <span onclick="changeGraph('g1', 'hour', 3)">3</span> ...
<tr> <span onclick="changeGraph('g1', 'hour', 6)">6</span> ...
<td><img src="./images/graph-week.png" alt="Weekly Graph" /></td> <span onclick="changeGraph('g1', 'hour', 12)">12</span>
<td><img src="./images/graph-month.png" alt="Monthly Graph" /></td> </div>
</tr> <div><img id="g1" src="./images/graph-hour.png" alt="Hourly Graph" /></div>
<tr> </div>
<td><img src="./images/graph-year.png" alt="Yearly Graph" /></td> <div class="graph">
<td><img src="./images/graph-3year.png" alt="3 Years Graph" /></td> <div class="range-select">
</tr> Day:
</tbody> <span onclick="changeGraph('g2', 'day', 1)">1</span> ...
</table> <span onclick="changeGraph('g2', 'day', 3)">3</span>
</div>
<div><img id="g2" src="./images/graph-day.png" alt="Daily Graph" /></div>
</div>
<div class="graph">
<div class="range-select">
Week:
<span onclick="changeGraph('g3', 'week', 1)">1</span> ...
<span onclick="changeGraph('g3', 'week', 2)">2</span>
</div>
<div><img id="g3" src="./images/graph-week.png" alt="Weekly Graph" /></div>
</div>
<div class="graph">
<div class="range-select">
Month:
<span onclick="changeGraph('g4', 'month', 1)">1</span> ...
<span onclick="changeGraph('g4', 'month', 3)">3</span> ...
<span onclick="changeGraph('g4', 'month', 6)">6</span>
</div>
<div><img id="g4" src="./images/graph-month.png" alt="Monthly Graph" /></div>
</div>
<div class="graph">
<div class="range-select">
Year:
<span onclick="changeGraph('g5', 'year', 1)">1</span> ...
<span onclick="changeGraph('g5', 'year', 3)">3</span> ...
<span onclick="changeGraph('g5', 'year', 5)">5</span> ...
<span onclick="changeGraph('g5', 'year', 10)">10</span>
</div>
<div><img id="g5" src="./images/graph-year.png" alt="Yearly Graph" /></div>
</div>
</main>
<script>
function changeGraph(id, type, num) {
const img = document.getElementById(id);
if (img) {
img.src = './images/graph-' + (num === 1 ? '' : num) + type + '.png';
}
}
</script>
</body> </body>
</html> </html>

View File

@ -112,8 +112,8 @@ class Temperature
$options = [ $options = [
'--step', '60', // 1min step '--step', '60', // 1min step
sprintf('DS:%s:GAUGE:600:0:100', $id), // 10min hartbeat sprintf('DS:%s:GAUGE:600:0:100', $id), // 10min hartbeat
'RRA:LAST:0.5:1:1440', // last/m - 1day(1440min) 'RRA:LAST:0.5:1:10080', // last/m - 7day(10080min)
'RRA:LAST:0.5:30:52560', // last/30m - 3years(365day=30min*17520)*3 'RRA:LAST:0.5:30:175200', // last/30m - 10years(365day=30min*17520)*10
]; ];
return rrd_create($fpath, $options); return rrd_create($fpath, $options);
@ -135,21 +135,22 @@ class Temperature
* output graph. * output graph.
* *
* @param string $type output graph type * @param string $type output graph type
* @param int $num output period of graph type
* @param string $fpath output image file path * @param string $fpath output image file path
* *
* @return bool false if failure * @return bool false if failure
*/ */
public function outputGraph(string $type, string $fpath): bool public function outputGraph(string $type, int $num, string $fpath): bool
{ {
static $colors = [ static $colors = [
'#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#00FFFF', '#FF00FF', '#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#00FFFF', '#FF00FF',
'#FF9999', '#99FF99', '#9999FF', '#FFFF99', '#99FFFF', '#FF99FF', '#FF9999', '#99FF99', '#9999FF', '#FFFF99', '#99FFFF', '#FF99FF',
]; ];
static $types = ['hour', 'day', 'week', 'month', 'year', '3year']; static $types = ['hour', 'day', 'week', 'month', 'year'];
if (!in_array($type, $types)) { if (!in_array($type, $types)) {
return false; return false;
} }
$start = '3year' == $type ? '-3year' : '-1'.$type; $start = sprintf('-%u%s', $num, $type);
$options = [ $options = [
'--imgformat', 'PNG', '--imgformat', 'PNG',
'--lower-limit', '10', '--lower-limit', '10',
@ -160,7 +161,7 @@ class Temperature
'--height', '200', '--height', '200',
'--units-exponent', '0', '--units-exponent', '0',
'--vertical-label', "Temperature [\xc2\xb0C]", '--vertical-label', "Temperature [\xc2\xb0C]",
'--title', 'Server Room Temperature - by '.$type, '--title', 'Server Room Temperature - by '.$num.$type.'(s)',
]; ];
$idlen = 0; $idlen = 0;
foreach ($this->sensorIds as $key => $id) { foreach ($this->sensorIds as $key => $id) {

View File

@ -16,7 +16,16 @@ for ($i = 0; $i < $num; ++$i) {
$now = time(); $now = time();
$rrdtemp->update($id, $now, $value); $rrdtemp->update($id, $now, $value);
} }
foreach ($types = ['hour', 'day', 'week', 'month', 'year', '3year'] as $type) { $types = [
$fpath = APPDIR.'/'.$config['images_dir'].'/graph-'.$type.'.png'; 'hour' => [1, 3, 6, 12],
$rrdtemp->outputGraph($type, $fpath); 'day' => [1, 3],
'week' => [1, 2],
'month' => [1, 3, 6],
'year' => [1, 3, 5, 10],
];
foreach ($types as $type => $nums) {
foreach ($nums as $num) {
$fpath = APPDIR.'/'.$config['images_dir'].'/graph-'.(1 === $num ? '' : $num).$type.'.png';
$rrdtemp->outputGraph($type, $num, $fpath);
}
} }