The monitoring daemon needs to be aware of the name of the node status collector in order to provide accurate node status data. The way for the monitoring daemon to do this, is to query the configuration daemon; this is necessary, as the monitoring daemon runs on every node, so cannot assume to have a local copy of the configuration.
Signed-off-by: Klaus Aehlig <[email protected]> --- src/Ganeti/Confd/ClientFunctions.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Ganeti/Confd/ClientFunctions.hs b/src/Ganeti/Confd/ClientFunctions.hs index 3213669..a119d99 100644 --- a/src/Ganeti/Confd/ClientFunctions.hs +++ b/src/Ganeti/Confd/ClientFunctions.hs @@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. module Ganeti.Confd.ClientFunctions ( getInstances , getInstanceDisks + , getDiagnoseCollectorFilename ) where import Control.Monad (liftM) @@ -89,3 +90,15 @@ getInstanceDisks getInstanceDisks node srvAddr srvPort = liftM (uncurry (++)) (getInstances node srvAddr srvPort) >>= mapM (\i -> liftM ((,) i) (getDisks i srvAddr srvPort)) + +-- | Get the name of the diagnose collector. +getDiagnoseCollectorFilename + :: Maybe String -> Maybe Int -> BT.ResultT String IO String +getDiagnoseCollectorFilename srvAddr srvPort = do + client <- liftIO $ getConfdClient srvAddr srvPort + reply <- liftIO . query client ReqConfigQuery + $ PlainQuery "/cluster/diagnose_data_collector_filename" + case fmap (J.readJSON . confdReplyAnswer) reply of + Just (J.Ok filename) -> return filename + Just (J.Error msg) -> fail msg + Nothing -> fail "No answer from the Confd server" -- 2.7.0.rc3.207.g0ac5344
