diff --git a/assets/sleep/kmoon.png b/assets/sleep/kmoon.png new file mode 100644 index 0000000..1c69af1 Binary files /dev/null and b/assets/sleep/kmoon.png differ diff --git a/phplib/base.php b/phplib/base.php index f61f3de..fd1964d 100644 --- a/phplib/base.php +++ b/phplib/base.php @@ -24,7 +24,7 @@ $nagios_tag_categories = array("" => "Untagged", "action" => "Action Taken", "noaction" => "No Action Taken"); $nagios_tag_category_map = array("issue" => "action", "issuetimeperiod" => "action", "viewissue" => "action", "incorrecttimeperiod" => "noaction", "downtimeexpired" => "noaction", "downtimenotset" => "noaction", "thresholdincorrect" => "noaction", "checkfaulty" => "noaction"); -$locales = array("UK" => "Europe/London", "ET" => "America/New_York", "PT" => "America/Los_Angeles"); +$locales = array("UK" => "Europe/London", "ET" => "America/New_York", "PT" => "America/Los_Angeles","FR"=>"Europe/Paris"); $sleep_states = array(-1 => "Unknown", 0 => "Awake", 1 => "Asleep"); $sleep_state_icons = array(0 => "icon-eye-open", 1 => "icon-eye-close"); $sleep_state_levels = array(-1 => "Unknown", 1 => "NREM Stage 1", 2 => "NREM Stage 2", 3 => "NREM Stage 3", 4 => "REM"); @@ -682,3 +682,25 @@ function getPrettyTime($referencedate=0, $timepointer='', $measureby='', $autote return false; } } + +function IsWorkingHoursWithTZ($date) { + // This function is like the one above, except takes the timezone into account for accurate + // retrieval of the alerts sent to the user from Splunk. Can't afford to be an hour out here. + $oncall_timezone = getTeamOncallConfig('timezone'); + //we extract working hours from config + $wanted_working_hours = getTeamOncallConfig('workinghours'); + date_default_timezone_set($oncall_timezone); + $return_work_hours=explode("-",$wanted_working_hours[date("l",$date)]); + //we build to timestamp one with the starting working hours + // the second with the en of working hours for the selected day of week of our alert + $fork1=strtotime(date("Y/m/d",$date)." ".$return_work_hours[0]); + $fork2=strtotime(date("Y/m/d",$date)." ".$return_work_hours[1]); + //test if my date is between fork1 and fork2 and if yes, alert was fired during working hours + if ($date<$fork2 and $date>$fork1) { + return(true); + } + else { + return(false); + } +} + diff --git a/phplib/config.php.example b/phplib/config.php.example index 8ad504e..5be87d0 100644 --- a/phplib/config.php.example +++ b/phplib/config.php.example @@ -71,6 +71,15 @@ $teams = array( "timezone" => "America/New_York", "start" => "friday 18:00", "end" => "friday 18:00", + "workinghours" => array( + "Monday" => "08:00-18:00", + "Tuesday" => "08:00-18:00", + "Wednesday" =>"08:00-18:00", + "Thursday" =>"08:00-18:00", + "Friday" => "08:00-18:00", + "Saturday" => "", + "Sunday" => "", + ), ), "weekly_hints" => array("jira", "github"), "irc_channel" => "#ops" diff --git a/phplib/nav.php b/phplib/nav.php index 77d478c..26870f4 100644 --- a/phplib/nav.php +++ b/phplib/nav.php @@ -52,6 +52,7 @@
  • London, UK
  • Brooklyn, NY
  • San Francisco, CA
  • +
  • Paris, FR