Suggestion for a Agent config include directory

  • Suggestion for a Agent config include directory

    Posted by openmtl on February 15, 2011 at 14:24

    I’ve been setting up Pandora FMS to monitor a Asterisk server (Elastix) and I have a pile of module settings to include into the pandora_agent.conf but what I find is that it is really messy editing this single configuration file.

    I must say that it is trivial to get the Pandora FMS agent to collect the data and get some great looking graphs on the console – Pandora FMS is awesome software people ! (I remember working with HP Openview back in early 1990’s on Suns)

    What would be nice is how Apache does this; you have a very stable distribution configuration file that rarely changes and then you include a directory e.g. for Apache the httpd.conf has something like,

    Include conf.d/*.conf

    which causes the agent to load up any number of other configuration files one by one.

    This would tidy up the configuration settings dramatically and make it easier for other people to copy what you have done as they just drop in different configuration files according to the type of system and applications into that configuration file folder.

    More importantly a re-install of Pandora FMS agent won’t delete your specific config file settings as they won’t be in the pandora_agent.conf file.

    For example I could have all my asterisk module definitions in one file called e.g. pfms-asterisk-1.6-application-monitoring.conf and have my hardware definitions (hddtemp, sensors) in another file e.g. pfms-hardware-compaq-evo.conf

    If I upgrade Asterisk and the command line changes then I could create a different e.g. pfms-asterisk-1.8-application-monitoring.conf file and then delete the old pfms-asterisk-1.6-application-monitoring.conf so it doesn’t get picked up.

    Same with the hardware monitoring. Sensor chipsets have a wide variety of results with the sensors output having different strings. Once I have settled on which value gets me a usable “CPUTemp” then I should be able to put my motherboard specific changes into a usefully named config file e.g. pfms-hardware-ibm-built1.conf  or pfms-hardware-dell-v2.conf that is unique for that motherboard/chipset or my custom build.

    Same with theMySQL monitoring. If they could be dropped into say a file called pfms-mysql-5.conf

    So when I make a Asterisk server then I can copy across a set of .conf files e.g. a .conf for the Asterisk version, a .conf for the Mysql and a .conf for the specific hardware I’ve built the system on and any number of other .conf files according to what other features the server has been built with.

    Even if I use plugins e.g. my own or Nagios with the wrapper or create my own fancy module_exec settings then I can easily advertise these .conf file settings to others.

    In time we could also package up plugins and their configuration files and this makes it trivial to add to a server because the package maintainer just sets up their script to copy any plugins to the plugins directory and the relevant .conf file into the pandora/conf.d directory and then re-hups the agent daemon.

    The daemon reads the pandora_agent.conf and the ./conf.d/*.conf files and then runs with those as if they were all in one big .conf file.

    Thoughts ?  – this is kind of trivial to implement as its just telling the perl script to pipe in the contents of all the files that match a particular file spec rather than just reading the one pandora_agent.conf file.

    openmtl replied 13 years, 10 months ago 1 Member · 2 Replies
  • 2 Replies
  • openmtl

    Member
    February 18, 2011 at 06:43
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Attached is my patch. I just svn checked out 3.2 and then went to /trunk/pandora_agents/unix  and edited pandora_agent perl script and then did svn diff

    Seems to work OK on my system.

    Comments ?

  • openmtl

    Member
    February 19, 2011 at 11:37
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    As the logic all works I’m now adding the remote configuration settings. To do this I’m going to TGZ the conf.d/*.conf  directory into a tarball.

    This is then uploaded as $AgentMD5.tgz

    Then through the same logic as the regular configuration file what I do on download to the remote is delete the old conf.d/*.conf files and then untar the $AgentMD5.tgz and then reload these configurations.

    You’ll still have to add the hooks to drop in new files into the tarball on the central Pandora FMS server but at least the agent would be happy to pick up the tarball and unpack it and run the contents just like it does the regular pandora_agent.conf file.