nginxMonitor :: IO Environment
nginxMonitor = do
  log <- readFile "/var/log/nginx/monitor.log"
  let requests = catMaybes $ map (decode . B.pack) (lines log) :: [NginxLogReq]
  -- F**k Data.Time.Clock
  currentTime <- (fmap floor getPOSIXTime :: IO Int)
  let reqLastMinute = filter (\req ->  (currentTime - round (stamp req)) <= 60) requests
  return $ Environment{ 
                        requestsLastMinute = length reqLastMinute
                      , avgResponseTimeLastMinute = round (1000 * 1000 * (sum . map responseTime $ reqLastMinute) /  fromIntegral (length reqLastMinute + 1))
                      }
nginxMonitor :: IO Environment
nginxMonitor = do
  log <- readFile "/var/log/nginx/monitor.log"
  let requests = catMaybes $ map (decode . B.pack) (lines log) :: [NginxLogReq]
  -- F**k Data.Time.Clock
  currentTime <- (fmap floor getPOSIXTime :: IO Int)
  let reqLastMinute = filter (\req ->  (currentTime - round (stamp req)) <= 60) requests
  return $ Environment{ 
                        requestsLastMinute = length reqLastMinute
                      , avgResponseTimeLastMinute = round (1000 * 1000 * (sum . map responseTime $ reqLastMinute) /  fromIntegral (length reqLastMinute + 1))
                      }
nginxMonitor = do
  log <- readFile "/var/log/nginx/monitor.log"
  let requests = catMaybes $ map (decode . B.pack) (lines log) :: [NginxLogReq]
  -- F**k Data.Time.Clock
  currentTime <- (fmap floor getPOSIXTime :: IO Int)
  let reqLastMinute = filter (\req ->  (currentTime - round (stamp req)) <= 60) requests
  return $ Environment{ 
                        requestsLastMinute = length reqLastMinute
                      , avgResponseTimeLastMinute = round (1000 * 1000 * (sum . map responseTime $ reqLastMinute) /  fromIntegral (length reqLastMinute + 1))
                      }