{"action":"created","issue":{"url":"https://api.github.com/repos/schubergphilis/nagios/issues/419","labels_url":"https://api.github.com/repos/schubergphilis/nagios/issues/419/labels{/name}","comments_url":"https://api.github.com/repos/schubergphilis/nagios/issues/419/comments","events_url":"https://api.github.com/repos/schubergphilis/nagios/issues/419/events","html_url":"https://github.com/schubergphilis/nagios/issues/419","id":106261614,"number":419,"title":"check_interval and similar settings render as float","user":{"login":"bitmonk","id":526479,"avatar_url":"https://avatars.githubusercontent.com/u/526479?v=3","gravatar_id":"","url":"https://api.github.com/users/bitmonk","html_url":"https://github.com/bitmonk","followers_url":"https://api.github.com/users/bitmonk/followers","following_url":"https://api.github.com/users/bitmonk/following{/other_user}","gists_url":"https://api.github.com/users/bitmonk/gists{/gist_id}","starred_url":"https://api.github.com/users/bitmonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitmonk/subscriptions","organizations_url":"https://api.github.com/users/bitmonk/orgs","repos_url":"https://api.github.com/users/bitmonk/repos","events_url":"https://api.github.com/users/bitmonk/events{/privacy}","received_events_url":"https://api.github.com/users/bitmonk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-14T02:51:08Z","updated_at":"2015-09-28T23:37:54Z","closed_at":null,"body":"Nagios seems to interpret these as minutes instead of seconds, so e.g. instead of 15s, the default intervals are 15min.\r\n\r\n    $ grep interval /etc/nagios3/conf.d/templates.cfg\r\n      check_interval         15.0\r\n      retry_interval         15.0\r\n      notification_interval  300.0\r\n      check_interval        60.0\r\n      retry_interval        15.0\r\n      check_interval                60.0\r\n      retry_interval                15.0\r\n      notification_interval         1200.0\r\n      check_interval         60.0\r\n      retry_interval         15.0\r\n      notification_interval  1200.0\r\n\r\nThis is on Ubuntu 14.04 with chef 12.4.1.\r\n\r\nI'm happy to help test variations of my current setup and produce a chefspec test that fails or somesuch, but I wanted to start documenting this as I've spent a good bit of time digging into it.\r\n\r\nIt seems like there might be code validating this input as an integer, starting in libraries/host.rb:\r\n\r\n    def check_interval=(int)\r\n      @check_interval = check_integer(int)\r\n    end\r\n\r\nwhich, when i grep around, leads me to an interesting blurb in libraries/_load_default_config.rb:\r\n\r\n    nagios_host 'server' do\r\n      options 'name'                   => 'server',\r\n              'use'                    => 'default-host',\r\n              'check_period'           => nagios_attr(:default_host)[:check_period],\r\n              'check_interval'         => nagios_interval(nagios_attr(:default_host)[:check_interval]),\r\n              'retry_interval'         => nagios_interval(nagios_attr(:default_host)[:retry_interval]),\r\n              'max_check_attempts'     => nagios_attr(:default_host)[:max_check_attempts],\r\n              'check_command'          => nagios_attr(:default_host)[:check_command],\r\n              'notification_interval'  => nagios_interval(nagios_attr(:default_host)[:notification_interval]),\r\n              'notification_options'   => nagios_attr(:default_host)[:notification_options],\r\n              'contact_groups'         => nagios_attr(:default_contact_groups),\r\n              'register'               => 0\r\n    end\r\n\r\nwhich points me nagios_interval, defined in libraries/default.rb:\r\n\r\n    def nagios_interval(seconds)\r\n      if seconds.to_i != 0 && seconds.to_i < node['nagios']['interval_length'].to_i\r\n        fail ArgumentError, \"Specified nagios interval of #{seconds} seconds must ether be zero or be equal to or greater than the default interval length of #{node['nagios']['interval_length']}\"\r\n      end\r\n      interval = seconds.to_f / node['nagios']['interval_length']\r\n      if interval != interval.to_i\r\n        fail ArgumentError, \"Specified nagios interval of #{seconds} seconds must be a multiple of the interval length of #{node['nagios']['interval_length']}\"\r\n      end\r\n      interval\r\n    end\r\n\r\nSeems to me like it's passing a number of tests, it's not really clear how it ends up rendering as a float, or if I am somehow doing something that causes this.  I'm happy to share my wrapper cookbook, which basically just includes the nagios cookbook and sets a couple of default attributes related mostly to the apache config."},"comment":{"url":"https://api.github.com/repos/schubergphilis/nagios/issues/comments/143902391","html_url":"https://github.com/schubergphilis/nagios/issues/419#issuecomment-143902391","issue_url":"https://api.github.com/repos/schubergphilis/nagios/issues/419","id":143902391,"user":{"login":"bitmonk","id":526479,"avatar_url":"https://avatars.githubusercontent.com/u/526479?v=3","gravatar_id":"","url":"https://api.github.com/users/bitmonk","html_url":"https://github.com/bitmonk","followers_url":"https://api.github.com/users/bitmonk/followers","following_url":"https://api.github.com/users/bitmonk/following{/other_user}","gists_url":"https://api.github.com/users/bitmonk/gists{/gist_id}","starred_url":"https://api.github.com/users/bitmonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitmonk/subscriptions","organizations_url":"https://api.github.com/users/bitmonk/orgs","repos_url":"https://api.github.com/users/bitmonk/repos","events_url":"https://api.github.com/users/bitmonk/events{/privacy}","received_events_url":"https://api.github.com/users/bitmonk/received_events","type":"User","site_admin":false},"created_at":"2015-09-28T23:37:54Z","updated_at":"2015-09-28T23:37:54Z","body":"BTW, looking into this again today, but it's still unclear why some values render as decimal, and how that can be prevented.\r\n\r\nMaybe there are two issues: one with the rendering of the values, another with the default values themselves."}}