diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..80983d3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2014 Jack-Benny Persson + +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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..bdb7048 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# Check SMHI Warn # +This is a Nagios plugin that checks SMHI +(Sveriges meteorologiska och hydrologiska institut) for weather alerts. For +class 1 warning, the scripts exit with a warning state, for class 2 and 3 +it exit with a critical-state. In the rare cases where more than one warning +is issued for the same area, the script exit with a critical state and a message +that more than one warning is issued for the area. + +## Usage ## +The script only takes one argument, the area/district for which it should check +for weather alerts. The district must be entered exactly as it is on the SMHI +webpage. For a complete list, enter 'list' instead of a district for argument. +Don't forget to quote the district in the argument, such as the below example. + + check_smhiwarn.php 'Skåne län utom Österlen' + +Create one instance of each district you want to monitor. + +## Copyright ## +This script is release under GNU GPL version 2. The script should not be used to +protect life and/or property. diff --git a/check_smhiwarn.php b/check_smhiwarn.php index cc012d8..123ed51 100755 --- a/check_smhiwarn.php +++ b/check_smhiwarn.php @@ -124,7 +124,7 @@ if (!preg_grep("/^$district$/", $availDistricts)) // Retrive the data -//$data = file_get_contents("smhi_alla_varningar.xml"); //For testing purposes +//$data = file_get_contents("testing/smhi_alla_varningar.xml"); //For testing purposes $data = shell_exec("curl -s http://www.smhi.se/weatherSMHI2/varningar/smhi_alla_varningar.xml"); // Regex the area (1st paranthesis is area, 2nd is warning class, 3rd is warning msg) diff --git a/smhi_alla_varningar.xml b/testing/smhi_alla_varningar.xml similarity index 100% rename from smhi_alla_varningar.xml rename to testing/smhi_alla_varningar.xml