From 4218ab4b76e81227364ed008d8d55a8c5f3ed1a0 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Sat, 3 May 2014 13:30:37 +0200 Subject: CoreCommon: Try several paths in checkedDataRetrieval --- src/Plugins/Monitors/CoreCommon.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Plugins/Monitors/CoreCommon.hs') diff --git a/src/Plugins/Monitors/CoreCommon.hs b/src/Plugins/Monitors/CoreCommon.hs index 5d6efd4..943f491 100644 --- a/src/Plugins/Monitors/CoreCommon.hs +++ b/src/Plugins/Monitors/CoreCommon.hs @@ -26,10 +26,11 @@ import Plugins.Monitors.Common import System.Directory checkedDataRetrieval :: (Ord a, Num a) - => String -> [String] -> Maybe (String, String -> Int) + => String -> [[String]] -> Maybe (String, String -> Int) -> (Double -> a) -> (a -> String) -> Monitor String -checkedDataRetrieval msg path lbl trans fmt = liftM (fromMaybe msg) $ - retrieveData path lbl trans fmt +checkedDataRetrieval msg paths lbl trans fmt = + liftM (fromMaybe msg . listToMaybe . catMaybes) $ + mapM (\p -> retrieveData p lbl trans fmt) paths retrieveData :: (Ord a, Num a) => [String] -> Maybe (String, String -> Int) -- cgit v1.2.3