Revision 34be621a src/Ganeti/Monitoring/Server.hs
b/src/Ganeti/Monitoring/Server.hs | ||
---|---|---|
51 | 51 |
import qualified Ganeti.DataCollectors.Lv as Lv |
52 | 52 |
import Ganeti.DataCollectors.Types |
53 | 53 |
import qualified Ganeti.Constants as C |
54 |
import Ganeti.Runtime |
|
54 | 55 |
|
55 | 56 |
-- * Types and constants definitions |
56 | 57 |
|
... | ... | |
99 | 100 |
-- * Configuration handling |
100 | 101 |
|
101 | 102 |
-- | The default configuration for the HTTP server. |
102 |
defaultHttpConf :: Config Snap () |
|
103 |
defaultHttpConf = |
|
104 |
setAccessLog (ConfigFileLog C.daemonsExtraLogfilesGanetiMondAccess) .
|
|
103 |
defaultHttpConf :: FilePath -> FilePath -> Config Snap ()
|
|
104 |
defaultHttpConf accessLog errorLog =
|
|
105 |
setAccessLog (ConfigFileLog accessLog) .
|
|
105 | 106 |
setCompression False . |
106 |
setErrorLog (ConfigFileLog C.daemonsExtraLogfilesGanetiMondError) $
|
|
107 |
setErrorLog (ConfigFileLog errorLog) $
|
|
107 | 108 |
setVerbose False |
108 | 109 |
emptyConfig |
109 | 110 |
|
... | ... | |
115 | 116 |
|
116 | 117 |
-- | Prepare function for monitoring agent. |
117 | 118 |
prepMain :: PrepFn CheckResult PrepResult |
118 |
prepMain opts _ = |
|
119 |
return $ |
|
120 |
setPort (maybe C.defaultMondPort fromIntegral (optPort opts)) |
|
121 |
defaultHttpConf |
|
119 |
prepMain opts _ = do |
|
120 |
mAccessLog <- daemonsExtraLogFile GanetiMond AccessLog |
|
121 |
mErrorLog <- daemonsExtraLogFile GanetiMond ErrorLog |
|
122 |
case (mAccessLog, mErrorLog) of |
|
123 |
(Just accessLog, Just errorLog) -> |
|
124 |
return $ |
|
125 |
setPort |
|
126 |
(maybe C.defaultMondPort fromIntegral (optPort opts)) |
|
127 |
(defaultHttpConf accessLog errorLog) |
|
128 |
_ -> fail "Failed to retrieve extra log filepaths for the monitoring daemon" |
|
122 | 129 |
|
123 | 130 |
-- * Query answers |
124 | 131 |
|
Also available in: Unified diff