Ejemplo n.º 1
0
	author:Kouji Sugibayashi
*/
require_once 'TanpopoWeather.php';
//------------------------------------------------------------------------
function file_write($DEN)
{
    global $argv, $power_company, $PowerCom_JP;
    $message = "現在の電力使用率 \n";
    for ($i = 0; $i < 10; $i++) {
        $message .= $PowerCom_JP[$i] . $DEN[$power_company[$i]]["den_updown"] . $DEN[$power_company[$i]]["den_per"] . " \n";
    }
    $message .= "#" . $argv[2];
    return $message;
}
//-----------------------------------------------------------------------------------
$DD = new Denryoku_Class();
$TT = new Twitter_Class();
$power_company = array("Hokkaido", "Tohoku", "Tokyo", "Chubu", "Hokuriku", "Kansai", "Chugoku", "Shikoku", "Kyushu", "Okinawa");
$PowerCom_JP = array("北海道電力", "東北電力 ", "東京電力 ", "中部電力 ", "北陸電力 ", "関西電力 ", "中国電力 ", "四国電力 ", "九州電力 ", "沖縄電力 ");
$Power = $DD->StoreDenryoku();
for ($i = 0; $i < 10; $i++) {
    $DEN[$power_company[$i]] = $Power[$power_company[$i]];
}
$Denryoku[] = array("ID" => 0, "dpercent" => $DEN["Hokkaido"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=575&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004669848");
$Denryoku[] = array("ID" => 1, "dpercent" => $DEN["Tohoku"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=565&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004732726");
$Denryoku[] = array("ID" => 2, "dpercent" => $DEN["Tokyo"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=553&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004764737");
$Denryoku[] = array("ID" => 3, "dpercent" => $DEN["Chubu"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=572&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004795741");
$Denryoku[] = array("ID" => 4, "dpercent" => $DEN["Hokuriku"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=577&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004825770");
$Denryoku[] = array("ID" => 5, "dpercent" => $DEN["Kansai"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=573&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004825777");
$Denryoku[] = array("ID" => 6, "dpercent" => $DEN["Chugoku"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=578&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004919725");
$Denryoku[] = array("ID" => 7, "dpercent" => $DEN["Shikoku"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=576&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004950727");
Ejemplo n.º 2
0
        $pref->appendChild($dom->createElement('den_yosou', $Power[$power_company[$i]]["yosou"]));
        $pref->appendChild($dom->createElement('den_date', $Power[$power_company[$i]]["DATE"]));
        $pref->appendChild($dom->createElement('den_time', $Power[$power_company[$i]]["time"]));
        $pref->appendChild($dom->createElement('den_alive', $Power[$power_company[$i]]["alive"]));
    }
    $weekjp = array('日', '月', '火', '水', '木', '金', '土');
    $weekno = date('w');
    $week_X = "〔" . $weekjp[$weekno] . "〕";
    $pref = $prefs->appendChild($dom->createElement('pref'));
    $pref->setAttribute('code', 'DATE');
    $pref->appendChild($dom->createElement('time', date("Y年m月d日") . $week_X . date(" H時i分")));
    $pref->appendChild($dom->createElement('time_ampm', date("Y年m月d日") . $week_X . date(" A h:i")));
    $pref->appendChild($dom->createElement('time_x', date("Ymd")));
    $dom->formatOutput = true;
    $save_file = "/etc/zabbix/externalscripts/" . $OUT_FILE;
    $dom->save($save_file);
}
//-------------------------------------------------------------------------------------------------
if (!isset($argv[1])) {
    echo "\"/etc/zabbix/externalscripts/power_prefs.xml\" を出力します。";
    $OUT_FILE = "power_prefs.xml";
} else {
    $OUT_FILE = $argv[1];
    echo "\"/etc/zabbix/externalscripts/" . $OUT_FILE . "\" を出力します。";
}
$DD = new Denryoku_Class();
$power_company = array("Hokkaido", "Tohoku", "Tokyo", "Chubu", "Hokuriku", "Kansai", "Chugoku", "Shikoku", "Kyushu", "Okinawa");
for ($i = 0; $i < 10; $i++) {
    $Power[$power_company[$i]] = $DD->Denryoku($power_company[$i]);
}
file_write();
Ejemplo n.º 3
0
    } else {
        if ($Power["Tokyo"]["den_alive"] == "good") {
            $message .= "東京電力電力使用率:" . floor($Power["Tokyo"]["den_per"]) . "% \n";
            if ($Power["Tokyo"]["den_per"] >= 90) {
                $message .= $setsuden;
            } else {
                $message .= $kansya;
            }
        }
    }
    $message .= "#" . $SHARP;
    return $message;
}
//-----------------------------------------------------------------------------------
$TT = new Twitter_Class();
$DD = new Denryoku_Class();
$WW = new Weather_Class();
$wg = $WW->wunderground();
$power_company = array("Hokkaido", "Tohoku", "Tokyo", "Chubu", "Hokuriku", "Kansai", "Chugoku", "Shikoku", "Kyushu", "Okinawa");
$PP = $DD->StoreDenryoku();
for ($i = 0; $i < 10; $i++) {
    $Power[$power_company[$i]] = $PP[$power_company[$i]];
}
if ($wg == NULL) {
    echo "ERROR";
    exit;
}
$message = file_write();
//-------------------------------------------------------------------
$status = $message;
if (strstr($PLACE_NAME, "宮城県") || strstr($PLACE_NAME, "新潟県") || strstr($PLACE_NAME, "青森県")) {