#!/usr/bin/env php This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* This is a small Nagios plugin to warn for severe weather. It gets the data from meteoalarm.eu. The script takes the full URL of the region your are interested in. For example: ./check_meteo.php www.meteoalarm.eu/en_UK/0/0/SE002-Sk%E5ne.html */ // Sanity check & help text if ($argc != 2) { printf("Please provide a full URL for your region\n"); printf("Usage:\n"); printf("$argv[0] [URL]\n\n"); printf("Please note that you must use the english version of the site/URL\n\n"); printf("Example:\n"); printf("$argv[0] http://www.meteoalarm.eu/en_UK/0/0/SE038-Halland.html\n"); exit(3); } // Get HTML-file from Meteoalarm $url = $argv[1]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($ch); curl_close($ch); // Get all the warnings for the selected region preg_match_all('/