Git Product home page Git Product logo

Comments (6)

dj-wasabi avatar dj-wasabi commented on September 17, 2024

Hi simon-kerckhof,

Thank you for making time to create this issue!
Will take a look at it.

Kind regards,
Werner

from puppet-zabbix.

dj-wasabi avatar dj-wasabi commented on September 17, 2024

Hi simon-kerckhof,

I just pushed an fix for this.
Please let me know if something isn't working as it supposed to.

Kind regards,
Werner

from puppet-zabbix.

PHaroZ avatar PHaroZ commented on September 17, 2024

puppetlabs/postgresql v4.3.0
wdijkerman/zabbix v1.4.0

same issue on postgresql with {data,images,schema}.sql

from puppet-zabbix.

dj-wasabi avatar dj-wasabi commented on September 17, 2024

Hi PHaroZ,

So these are also found on the system as {data,images,schema}.sql.gz ?

Kind regards,
Werner

from puppet-zabbix.

PHaroZ avatar PHaroZ commented on September 17, 2024

yep, I've juste edit my postgres.pp as mentioned by simon.

It results as

cat manifests/database/postgresql.pp 
# == Class: zabbix::database::postgresql
#
#  This will install and load the sql files for the tables
#  and other data which is needed for zabbix.
#
#  Please note:
#  This class will be called from zabbix::database. No need for calling
#  this class manually.
#
# === Authors
#
# Author Name: [email protected]
#
# === Copyright
#
# Copyright 2014 Werner Dijkerman
#
class zabbix::database::postgresql (
  $zabbix_type          = '',
  $zabbix_version       = $zabbix::params::zabbix_version,
  $database_schema_path = '',
  $database_name        = '',
  $database_user        = '',
  $database_password    = '',
  $database_host        = '',
  $database_path        = $zabbix::params::database_path,
) {
# Allow to customize the path to the Database Schema,
  if ! $database_schema_path {
    case $::operatingsystem {
      'centos','redhat','oraclelinux' : {
            $schema_path   = "/usr/share/doc/zabbix-*-pgsql-${zabbix_version}*/create"
          }
        default : {
            $schema_path   = '/usr/share/zabbix-*-pgsql'
      }
    }
  }else {
      $schema_path = $database_schema_path
  }


  exec { 'update_pgpass':
    command => "echo ${database_host}:5432:${database_name}:${database_user}:${database_password} >> /root/.pgpass",
    path    => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
    unless  => "grep \"${database_host}:5432:${database_name}:${database_user}:${database_password}\" /root/.pgpass",
    require => File['/root/.pgpass'],
  }

  file { '/root/.pgpass':
    ensure  => present,
    mode    => '0600',
    owner   => 'root',
    group   => 'root',
    require => Class['postgresql::client'],
  }

  case $zabbix_type {
    'proxy': {
      exec { 'zabbix_proxy_create.sql':
        command  => "cd ${schema_path} && if [ -f schema.sql.gz ]; then gunzip schema.sql.gz ; fi && psql -h '${database_host}' -U '${database_user}' -d '${database_name}' -f schema.sql && touch /etc/zabbix/.schema.done",
        path     => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
        unless   => 'test -f /etc/zabbix/.schema.done',
        provider => 'shell',
        require  => [
          Exec['update_pgpass'],
        ],
      }
    }
    'server': {
      exec { 'zabbix_server_create.sql':
        command  => "cd ${schema_path} && if [ -f schema.sql.gz ]; then gunzip schema.sql.gz ; fi && psql -h '${database_host}' -U '${database_user}' -d '${database_name}' -f schema.sql && touch /etc/zabbix/.schema.done",
        path     => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
        unless   => 'test -f /etc/zabbix/.schema.done',
        provider => 'shell',
        require  => [
          Exec['update_pgpass'],
        ],
      } ->
      exec { 'zabbix_server_images.sql':
        command  => "cd ${schema_path} && if [ -f images.sql.gz ]; then gunzip images.sql.gz ; fi && psql -h '${database_host}' -U '${database_user}' -d '${database_name}' -f images.sql && touch /etc/zabbix/.images.done",
        path     => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
        unless   => 'test -f /etc/zabbix/.images.done',
        provider => 'shell',
        require  => [
          Exec['update_pgpass'],
        ],
      } ->
      exec { 'zabbix_server_data.sql':
        command  => "cd ${schema_path} && if [ -f data.sql.gz ]; then gunzip data.sql.gz ; fi  && psql -h '${database_host}' -U '${database_user}' -d '${database_name}' -f data.sql && touch /etc/zabbix/.data.done",
        path     => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
        unless   => 'test -f /etc/zabbix/.data.done',
        provider => 'shell',
        require  => [
          Exec['update_pgpass'],
        ],
      }
    }
    default: {
      fail 'We do not work.'
    }
  }
}

from puppet-zabbix.

dj-wasabi avatar dj-wasabi commented on September 17, 2024

Hi PHaroZ,

It is also done now in the module.

Kind regards,
Werner

from puppet-zabbix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.