<commit_before>-- | Options/Parsing

module Vaultaire.Collector.Nagios.Perfdata.Options where

import           Vaultaire.Collector.Nagios.Perfdata.Rep

import           Options.Applicative

parseOptions :: IO CollectorOptions
parseOptions = execParser optionParser

-- | Parser which include all help info
optionParser :: ParserInfo CollectorOptions
optionParser =
    info (helper <*> collectorOptions)
    (fullDesc <>
        progDesc "Vaultaire collector for Nagios perfdata files, can run with mod_gearman" <>
        header "vaultaire-collector-nagios - writes datapoints from Nagios perfdata files to Vaultaire. Can run in daemon mode using the gearman protocol"
    )

-- | The parser for all options for nagios-perfdata
collectorOptions :: Parser CollectorOptions
collectorOptions = CollectorOptions
    <$> strOption
        (long "marquise-namespace"
         <> short 'n'
         <> value "perfdata"
         <> metavar "MARQUISE-NAMESPACE"
         <> help "Marquise namespace to write to. Must be unique on a host basis.")
    <*> (read <$> strOption
        (long "log-verbosity"
         <> short 'v'
         <> help "Verbosity level at which to write log output"))
    <*> switch
        (long "normalise-metrics"
         <> short 's'<commit_msg>update logger option flag<commit_after>-- | Options/Parsing

module Vaultaire.Collector.Nagios.Perfdata.Options where

import           Vaultaire.Collector.Nagios.Perfdata.Rep

import           Options.Applicative
import           System.Log.Logger

parseOptions :: IO CollectorOptions
parseOptions = execParser optionParser

-- | Parser which include all help info
optionParser :: ParserInfo CollectorOptions
optionParser =
    info (helper <*> collectorOptions)
    (fullDesc <>
        progDesc "Vaultaire collector for Nagios perfdata files, can run with mod_gearman" <>
        header "vaultaire-collector-nagios - writes datapoints from Nagios perfdata files to Vaultaire. Can run in daemon mode using the gearman protocol"
    )

-- | The parser for all options for nagios-perfdata
collectorOptions :: Parser CollectorOptions
collectorOptions = CollectorOptions
    <$> strOption
        (long "marquise-namespace"
         <> short 'n'
         <> value "perfdata"
         <> metavar "MARQUISE-NAMESPACE"
         <> help "Marquise namespace to write to. Must be unique on a host basis.")
    <*> flag WARNING DEBUG
        (long "log-verbosity"
         <> short 'v'
         <> help "Verbosity level at which to write log output")
    <*> switch
        (long "normalise-metrics"
         <> short 's'
{'fraction_non_alphanumeric': 0.08491663435440093, 'fraction_numerical': 0.0, 'mean_word_length': 2.932926829268293, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7481155', 'n_tokens_mistral': 757, 'n_tokens_neox': 730, 'n_words': 231}