Search code examples
puppethyperic

How do I automate the installation of hyperic with Puppet?


I'm trying to automate the installation of Hyperic using puppet.

However instead of prompting the user for inputs, I want to hard code the values into one of the .sh file...

I'm having trouble trying to figure out what file should be edited?


Solution

  • So, I've automated the installation of Hyperic with Puppet at some point, I'll see if I can open source the module in the future.

    But the gist of it, is that you need config for everything in the agent.properties file, then that's read when the /opt/hyperic/hyperic-hqee-agent/bin/hq-agent.sh start command is run for the first time.

    Something like this:

      $server_ip         = 'hypericserver.example.com'
      $server_port       = '7080'
      $ssl_port          = '7443'
      $secure            = 'no'
      $login             = 'hqadminuser'
      $password          = 'password1'
      $agent_ip          = '*default*'
      $agent_port        = '*default*'
      $resetup_tokens    = 'no'
      $accept_unverified = 'no'
      $unidirectional    = 'yes'
    
    file { "/opt/hyperic/hyperic-hqee-agent/conf/agent.properties":
      ensure  => file,
      mode    => '0640',
      content => template('hyperic/agent.properties.erb'),
    }
    

    With the template looking something like:

    # Agent configuration file
    #
    # The following are the properties that the Agent recognizes:
    #
    #    agent.listenPort
    #         Default:      "2144"
    #
    #         Description:  Port that the agent listens on.
    #
    #    agent.listenIp
    #         Default:      "*"
    #
    #         Description:  Address that the agent listens on.  If set to '*',
    #                       the agent will listen on all available interfaces.
    #
    #    agent.startupTimeOut
    #         Default:      "300"
    #
    #         Description:  This is the number of seconds that the agent startup
    #                       script will wait before determining that the agent
    #                       did not startup successfully.
    #
    #    agent.maxBatchSize
    #         Default:      "500"
    #
    #         Description:  This is the maximum number of metrics that the
    #                       agent will send per contact with HQ.
    #
    #
    #    agent.eventReportBatchSize
    #         Default:      "100"
    #
    #         Description:  The agent will send events to HQ in reports containing
    #                       at most this number of events until all events have been
    #                       sent to HQ.
    #
    #
    #    agent.proxyHost
    #         Default:      none
    #
    #         Description:  The host name or IP address of the proxy server that the
    #                       agent must connect to first when establishing a connection
    #                       to the HQ server.
    #
    #
    #    agent.proxyPort
    #         Default:      none
    #
    #         Description:  The port number of the proxy server that the agent
    #                       must connect to first when establishing a connection to
    #                       the HQ server.
    #
    #
    #    agent.enabledCiphers
    #         Default:      SSL_RSA_WITH_RC4_128_MD5,SSL_RSA_WITH_RC4_128_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_DSS_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_DSS_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA
    #
    #         Description:  The ciphers supported for secured communication with the agent.
    #
    
    
    ## Use the following if you'd like to have the agent setup
    ## automatically from these properties.  The values for these
    ## properties are used to answer the setup questions
    ##
    ## If any of these properties are left undefined, the setup
    ## process will prompt for their values
    ##
    ## If the value that should be used is the default when interactive
    ## setup is done, use the string *default* as the value for the option
    
    agent.setup.camIP=<%= @server_ip %>
    agent.setup.camPort=<%= @server_port %>
    agent.setup.camSSLPort=<%= @ssl_port %>
    agent.setup.camSecure=<%= @secure %>
    agent.setup.camLogin=<%= @login %>
    agent.setup.camPword=<%= @password %>
    agent.setup.agentIP=<%= @agent_ip %>
    agent.setup.agentPort=<%= @agent_port %>
    agent.setup.resetupTokens=<%= @resetup_tokens %>
    agent.setup.acceptUnverifiedCertificate=<%= @accept_unverified %>
    
    ##
    ## enables unidirectional communications between HQ Agent
    ## and HQ Server in HQ Enterprise Edition
    ##
    agent.setup.unidirectional=<%= @unidirectional %>
    ##
    ## the custom keystore private key alias for the agent
    ## used for unidirectional agents with a custom keystore
    ##
    #agent.keystore.alias=hq
    
    # required to find server/lib/weblogic.jar
    #weblogic.installpath=/usr/local/bea/weblogic-8.1
    
    # required to find websphere jars
    #websphere.installpath=/opt/WebSphere/AppServer
    
    # required to find jboss jars
    #jboss.installpath=/usr/local/jboss-4.0.0
    
    # mirror /proc/net/tcp on linux
    sigar.mirror.procnet=true
    
    ##
    ## Logging settings
    ##
    agent.logFile=${agent.logDir}/agent.log
    agent.logLevel=INFO
    log4j.rootLogger=${agent.logLevel}, R
    
    log4j.appender.R.File=${agent.logFile}
    log4j.appender.R.MaxBackupIndex=1
    log4j.appender.R.MaxFileSize=5000KB
    log4j.appender.R.layout.ConversionPattern=%d{dd-MM-yyyy HH:mm:ss,SSS z} %-5p [%t] [%c{1}@%L] %m%n
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    
    #redirect System.{err,out} to agent.log
    #commenting out will leave System.{out,err} directed to agent.log.startup
    agent.logLevel.SystemErr=ERROR
    agent.logLevel.SystemOut=INFO
    
    ##
    ## Disable overly verbose logging
    ##
    log4j.logger.org.apache.http=ERROR
    log4j.logger.org.springframework.web.client.RestTemplate=ERROR
    log4j.logger.org.hyperic.hq.measurement.agent.server.SenderThread=INFO
    log4j.logger.org.hyperic.hq.agent.server.AgentDListProvider=INFO
    log4j.logger.org.hyperic.hq.agent.server.MeasurementSchedule=INFO
    log4j.logger.org.hyperic.util.units=INFO
    log4j.logger.org.hyperic.hq.product.pluginxml=INFO
    
    log4j.logger.org.hyperic.hq.agent.server.CommandListener=INFO
    log4j.logger.org.hyperic.util.security.DbKeyStore=INFO
    log4j.logger.org.hyperic.util.security.MarkedStringEncryptor=INFO
    log4j.logger.org.hyperic.hq.stats.AbstractStatsWriter=INFO
    
    # Only log errors from naming context
    log4j.category.org.jnp.interfaces.NamingContext=ERROR
    log4j.category.org.apache.axis=ERROR
    
    #Agent Subsystems: Uncomment individual subsystems to see debug messages.
    #-----------------------------------------------------------------------
    #log4j.logger.org.hyperic.hq.autoinventory=DEBUG
    #log4j.logger.org.hyperic.hq.livedata=DEBUG
    #log4j.logger.org.hyperic.hq.measurement=DEBUG
    #log4j.logger.org.hyperic.hq.control=DEBUG
    
    #Agent Plugin Implementations
    #log4j.logger.org.hyperic.hq.product=DEBUG
    
    #Server Communication
    #log4j.logger.org.hyperic.hq.bizapp.client.AgentCallbackClient=DEBUG
    
    #Server Realtime commands dispatcher
    #log4j.logger.org.hyperic.hq.agent.server.CommandDispatcher=DEBUG
    
    #Agent Configuration parser
    #log4j.logger.org.hyperic.hq.agent.AgentConfig=DEBUG
    
    #Agent plugins loader
    #log4j.logger.org.hyperic.util.PluginLoader=DEBUG
    
    #Agent Metrics Scheduler (Scheduling tasks definitions & executions)
    #log4j.logger.org.hyperic.hq.agent.server.session.AgentSynchronizer.SchedulerThread=DEBUG
    
    #Agent Plugin Managers
    #log4j.logger.org.hyperic.hq.product.MeasurementPluginManager=DEBUG
    #log4j.logger.org.hyperic.hq.product.AutoinventoryPluginManager=DEBUG
    #log4j.logger.org.hyperic.hq.product.ConfigTrackPluginManager=DEBUG
    #log4j.logger.org.hyperic.hq.product.LogTrackPluginManager=DEBUG
    #log4j.logger.org.hyperic.hq.product.LiveDataPluginManager=DEBUG
    #log4j.logger.org.hyperic.hq.product.ControlPluginManager=DEBUG
    
    #--------------------------------------------------------------------------------------
    
    ##
    ## Auto-inventory options
    ##
    
    #autoinventory.defaultScan.interval.millis=86400000
    autoinventory.runtimeScan.interval.millis=86400000
    
    
    ##
    ## Disable deprecated response time feature by default
    ##
    hq.plugins.responsetime.disable=true
    
    
    ##
    ## SSL settings
    ##
    ## The path and password to the keystore file.  This is for setting up the SSL
    ## port on the agent. Use it only if you'd like to use your existing keystore.
    ## The path should be a absolute path.
    ##
    # agent.keystore.path=
    # agent.keystore.password=
    ##
    ## Automatically accept unverified certificates
    accept.unverified.certificates=false
    
    
    ##
    ## Configuration Monitoring settings
    ##
    # max diff size - default 5 Mb.
    hq.plugins.configmon.maxdiff=5120
    
    
    ## define vsphere plugin thread size (default is 1)
    scheduleThread.poolsize.vsphere=2
    
    #should the agent deduct the time offset of the server when sending metric results
    agent.deductServerTimeDiff=true