Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check "type" field lost in json file while upgrading module #860

Closed
exeral opened this issue Dec 20, 2017 · 3 comments
Closed

check "type" field lost in json file while upgrading module #860

exeral opened this issue Dec 20, 2017 · 3 comments
Assignees

Comments

@exeral
Copy link

exeral commented Dec 20, 2017

Description of problem

Upgrading sensu puppet module from 2.1.0 to 2.42
(yes that's a high jump !)

checks config file lost the "type" attribute
resulting in our metric not being sent anymore

Command used and debugging output

the code that create metrics checks

    # Metrics going to graphite
    $metrics = {
      'loadmetrics' => { command => 'PATH=/opt/sensu/embedded/bin/:$PATH metrics-load.rb --scheme "sensu.metrics.:::shortname:::.load"', },
      'cpumetrics' => { command => 'PATH=/opt/sensu/embedded/bin/:$PATH metrics-cpu-pcnt-usage.rb --scheme "sensu.metrics.:::shortname:::.cpu"', },
      'netmetrics' => { command => 'PATH=/opt/sensu/embedded/bin/:$PATH metrics-interface.rb --scheme "sensu.metrics.:::shortname:::.interface"', },
      'netstatmetrics' => { command => 'PATH=/opt/sensu/embedded/bin/:$PATH metrics-netstat-tcp.rb --scheme "sensu.metrics.:::shortname:::.netstat"', },
      'diskmetrics' => { command => 'PATH=/opt/sensu/embedded/bin/:$PATH metrics-disk.rb --scheme "sensu.metrics.:::shortname:::.disk"', },
      'diskfree' => { command => 'PATH=/opt/sensu/embedded/bin/:$PATH metrics-disk-usage.rb --scheme "sensu.metrics.:::shortname:::.df"', },
      'memorymetrics' => { command => 'PATH=/opt/sensu/embedded/bin/:$PATH metrics-memory.rb --scheme "sensu.metrics.:::shortname:::.memory"', },
      'threadmetrics' => { command => 'PATH=/opt/sensu/embedded/bin/:$PATH metrics-processes-threads-count.rb --scheme "sensu.metrics.:::shortname:::.threads"', },
    }
    # lint:endignore

    $metrics_default = {
        'type'        => 'metric',
        'handlers'    => ['graphite_tcp','graphite_metrictank'],
        'standalone'  => false,
        'subscribers' => 'default',
    }

    create_resources(sensu::check, $metrics, $metrics_default)

puppet master 4.10 /agent setup

Platform and version information

  • Your OS: CentOS release 6.9
  • Your Ruby version: 2.1.8 (puppet embedded)
  • Your version of Puppet: 4.10
  • Your version of Sensu: 1.1.2
  • Your version of this module: 2.42

Anything else to add that you think will be helpful?

As you can see, the "type" attribute is passed to sensu::check
why it would be dropped by sensu module ?

@exeral
Copy link
Author

exeral commented Dec 20, 2017

I wonder if it's something about the sensu puppet libs not correctly up to date at the puppet run.
but multiple puppet runs occured on the sensu server, so i still don't understand

@alvagante alvagante self-assigned this Dec 22, 2017
alvagante added a commit to alvagante/sensu-puppet that referenced this issue Dec 22, 2017
@alvagante
Copy link
Collaborator

alvagante commented Dec 22, 2017

@exeral I'm not able to reproduce the issue.
Testing using the Vagrant environment with your code here:
alvagante@756b9e8

This is what I get on the Centos 6 (and the other client) with current master (and the code in the linked commit):

[root@el6-client ~]# cat /etc/sensu/conf.d/checks/threadmetrics.json
{
    "checks": {
        "threadmetrics": {
            "command": "PATH=/opt/sensu/embedded/bin/:$PATH metrics-processes-threads-count.rb --scheme \"sensu.metrics.:::shortname:::.threads\"",
            "handlers": [
                "graphite_tcp",
                "graphite_metrictank"
            ],
            "interval": 60,
            "standalone": false,
            "subscribers": [
                "default"
            ],
            "type": "metric"
        }
    }
}

[root@el6-client ~]# facter os
{
  architecture => "x86_64",
  family => "RedHat",
  hardware => "x86_64",
  name => "CentOS",
  release => {
    full => "6.9",
    major => "6",
    minor => "9"
  },
  selinux => {
    config_mode => "enforcing",
    current_mode => "enforcing",
    enabled => true,
    enforced => true,
    policy_version => "24"
  }
}
[root@el6-client ~]# puppet --version
4.10.9
[root@el6-client ~]# rpm -qa | grep sensu
sensu-1.2.0-1.el6.x86_64

@exeral
Copy link
Author

exeral commented Dec 22, 2017

well, we were not able to reproduce too in a Vagrant box
We rollbacked, so we will give another try.

since we are not able to reproduce I think we can close the issue.

I'm pretty sure it's something about the functions in lib/puppet/ were not properly loaded somewhere

@exeral exeral closed this as completed Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants