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

ipaddress_eth1 Puppet fact not available with VirtualBox ("predictable interface names") #141

Closed
nbuchwitz opened this issue Mar 5, 2018 · 6 comments · Fixed by #142
Closed
Assignees
Labels
Milestone

Comments

@nbuchwitz
Copy link
Member

nbuchwitz commented Mar 5, 2018

If you try to open the host or service detail page, the page shows only the following error message:

Could not resolve host: icingaweb2; Name or service not known

The error is caused by the graphite module in whose configuration the URL is missing / broken.

/etc/icingaweb2/modules/graphite/config.ini:

[graphite]
url = "http://:8003"

[ui]
default_time_range = "5"
default_time_range_unit = "minutes"
disable_no_graphs_found = "0"

Expected Behavior

Host or service detail page is shown.

Current Behavior

Both pages terminate with the error message.

Possible Solution

Set the hostname to the IP 192.168.33.5

Steps to Reproduce (for bugs)

  1. Clone icinga-vangrant git repository
  2. cd icinga-vagrant/standalone && vagrant up

Context

GIT master

Your Environment

  • Vagrant version (vagrant -v): 2.0.2
  • Box name: standalone
  • Release version: git master
  • Operating system: Fedora 27
  • Provider (VirtualBox, Parallels, libvirt): VirtualBox
@nbuchwitz
Copy link
Member Author

After some digging, it seems that the ip lookup fails, because eth1 is named enp0s8 my environment.

graphite::web::listen_ip: "%{ipaddress_eth1}"

This also affects the other ip addresses.

@dnsmichi
Copy link
Contributor

dnsmichi commented Mar 5, 2018

Neinnnnnnnnn. Not again this foobar.

@dnsmichi
Copy link
Contributor

dnsmichi commented Mar 6, 2018

Ok, this affects VirtualBox which uses the "predictable if name schema". Parallels does not for some reason.

[root@icinga2 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:ed:e3:61 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 85514sec preferred_lft 85514sec
    inet6 fe80::1b76:3522:f94e:cc7e/64 scope link
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 08:00:27:2d:1c:13 brd ff:ff:ff:ff:ff:ff
    inet 192.168.33.5/24 brd 192.168.33.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe2d:1c13/64 scope link
       valid_lft forever preferred_lft forever

Workaround: Edit .puppet/hieradata/common.yaml and replace eth1 with enp0s8.

I am still not convinced if enp0s8 always stays the same. There are some guides on the net which allow to disable predictable names and just use eth0/eth1. Still, hiera lookup with a fallback would be better.

@dnsmichi
Copy link
Contributor

dnsmichi commented Mar 6, 2018

hashicorp/vagrant#7361 (comment)
elastic/logstash#5467

Note that the bento boxes do not disable predictable network interface names

@dnsmichi
Copy link
Contributor

dnsmichi commented Mar 6, 2018

[root@icinga2 ~]# puppet facts
...
    "interfaces": "enp0s3,enp0s8,lo",
    "ipaddress": "10.0.2.15",
    "ipaddress6": "fe80::1b76:3522:f94e:cc7e",
    "ipaddress6_enp0s3": "fe80::1b76:3522:f94e:cc7e",
    "ipaddress6_enp0s8": "fe80::a00:27ff:fe2d:1c13",
    "ipaddress6_lo": "::1",
    "ipaddress_enp0s3": "10.0.2.15",
    "ipaddress_enp0s8": "192.168.33.5",
    "ipaddress_lo": "127.0.0.1",

    "mtu_enp0s3": 1500,
    "mtu_enp0s8": 1500,
    "mtu_lo": 65536,
    "netmask": "255.255.255.0",
    "netmask6": "ffff:ffff:ffff:ffff::",
    "netmask6_enp0s3": "ffff:ffff:ffff:ffff::",
    "netmask6_enp0s8": "ffff:ffff:ffff:ffff::",
    "netmask6_lo": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
    "netmask_enp0s3": "255.255.255.0",
    "netmask_enp0s8": "255.255.255.0",
    "netmask_lo": "255.0.0.0",
    "network": "10.0.2.0",
    "network6": "fe80::",
    "network6_enp0s3": "fe80::",
    "network6_enp0s8": "fe80::",
    "network6_lo": "::1",
    "network_enp0s3": "10.0.2.0",
    "network_enp0s8": "192.168.33.0",
    "network_lo": "127.0.0.0",
    "networking": {
      "dhcp": "10.0.2.2",
      "domain": "vagrant.demo.icinga.com",
      "fqdn": "icinga2.vagrant.demo.icinga.com",
      "hostname": "icinga2",
      "interfaces": {
        "enp0s3": {
          "bindings": [
            {
              "address": "10.0.2.15",
              "netmask": "255.255.255.0",
              "network": "10.0.2.0"
            }
          ],
          "bindings6": [
            {
              "address": "fe80::1b76:3522:f94e:cc7e",
              "netmask": "ffff:ffff:ffff:ffff::",
              "network": "fe80::"
            }
          ],
          "dhcp": "10.0.2.2",
          "ip": "10.0.2.15",
          "ip6": "fe80::1b76:3522:f94e:cc7e",
          "mac": "08:00:27:ed:e3:61",
          "mtu": 1500,
          "netmask": "255.255.255.0",
          "netmask6": "ffff:ffff:ffff:ffff::",
          "network": "10.0.2.0",
          "network6": "fe80::"
        },
        "enp0s8": {
          "bindings": [
            {
              "address": "192.168.33.5",
              "netmask": "255.255.255.0",
              "network": "192.168.33.0"
            }
          ],
          "bindings6": [
            {
              "address": "fe80::a00:27ff:fe2d:1c13",
              "netmask": "ffff:ffff:ffff:ffff::",
              "network": "fe80::"
            }
          ],
          "ip": "192.168.33.5",
          "ip6": "fe80::a00:27ff:fe2d:1c13",
          "mac": "08:00:27:2d:1c:13",
          "mtu": 1500,
          "netmask": "255.255.255.0",
          "netmask6": "ffff:ffff:ffff:ffff::",
          "network": "192.168.33.0",
          "network6": "fe80::"
        },
        "lo": {
          "bindings": [
            {
              "address": "127.0.0.1",
              "netmask": "255.0.0.0",
              "network": "127.0.0.0"
            }
          ],
          "bindings6": [
            {
              "address": "::1",
              "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
              "network": "::1"
            }
          ],
          "ip": "127.0.0.1",
          "ip6": "::1",
          "mtu": 65536,
          "netmask": "255.0.0.0",
          "netmask6": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
          "network": "127.0.0.0",
          "network6": "::1"
        }
      },
      "ip": "10.0.2.15",
      "ip6": "fe80::1b76:3522:f94e:cc7e",
      "mac": "08:00:27:ed:e3:61",
      "mtu": 1500,
      "netmask": "255.255.255.0",
      "netmask6": "ffff:ffff:ffff:ffff::",
      "network": "10.0.2.0",
      "network6": "fe80::",
      "primary": "enp0s3"
    },
...

@dnsmichi
Copy link
Contributor

dnsmichi commented Mar 6, 2018

Ok, fuck it. You cannot reliably determine the secondary interface. Either you attempt to extract that with hiera lookup(), modify hiera to support regexp on key/values. Or you'll go by the route of writing a custom fact which attempts to extract the secondary ip address.

Nothing which works reliably, therefore hieradata gets node specific ip addresses configured like anything else (the distributed boxes already override common.yaml with node specific data). This is how Puppet works, Vagrant is just a bonus on top for the host only bridge.

==> icinga2: Notice: /Stage[main]/Profiles::Icinga::Icingaweb2/Icingaweb2::Module[graphite]/Icingaweb2::Inisection[module-graphite-general]/Concat[/etc/icingaweb2/modules/graphite/config.ini]/File[/etc/icingaweb2/modules/graphite/config.ini]/content: content changed '{md5}960425c353d7d14a88ffab929f9ebb89' to '{md5}6f54e822aca78fded6e6771ad25e8c41'

michi@mbmif ~/coding/icinga/icinga-vagrant/standalone (master *+=) $ vagrant ssh -c 'sudo cat /etc/icingaweb2/modules/graphite/config.ini'
[graphite]
url = "http://192.168.33.5:8003"

[ui]
default_time_range = "5"
default_time_range_unit = "minutes"
disable_no_graphs_found = "0"

Connection to 127.0.0.1 closed.

PR is coming soon.

@dnsmichi dnsmichi self-assigned this Mar 6, 2018
@dnsmichi dnsmichi added the bug label Mar 6, 2018
@dnsmichi dnsmichi added this to the 2.0.0 milestone Mar 6, 2018
@dnsmichi dnsmichi changed the title Could not resolve host: icingaweb2; Name or service not known ipaddress_eth1 Puppet fact not available with VirtualBox ("predictable interface names") Mar 6, 2018
dnsmichi pushed a commit that referenced this issue Mar 6, 2018
… anymore

Parallels as Vagrant provider ignores "predictable interface names" coming with CentOS7.
The VirtualBox provider from Vagrant itself enables this as default with > 1.8.3.

Therefore we have `enp0s8` vs `eth1`.

Doesn't work reliably, and therefore `hierdata/node/{::fqdn}.yaml` defines the hostonly
primary listen interface where needed. This is possible with interpolation in Hiera 5 by
doing a reverse lookup() call.

fixes #141
pull bot pushed a commit to Mattlk13/icinga-vagrant that referenced this issue Jun 14, 2019
e2e1d02a Bump to version 2.3.0
67ad3297 Add support for Filebeat 6 (Icinga#141)
f38bb372 Support for hash.random (Icinga#142)
9b4a45ed Update archive version_requirement (Icinga#138)
6e8ff5b2 Increment version to 2.2.0
c3e32e65 Release tagged builds to the forge automatically
f5446a5f Don't skip installing development packages
b02468bd Don't install rake explicitly the the travis setup
35bf62b2 Install rake in travis directly
6df1a5f3 Explicitly add rake to the bundle
707a26b0 Follow the PDK format for metadata.json
4b1628f4 Follow PDK format for non-test files
81579d16 Rework all tests to match PDK format
c82dfafa Style fixes in ruby files
7e9ee6ed Cleanup lint for better linting
7c0bd56c Add support for pipeline configuration in prospectors (Icinga#134)
638dc25e Wrong regex for windows, doesn't accept . in URL (Icinga#135)
c0749a24 remove duplicate entry for disable_config_test (Icinga#133)
7a9dd2d7 Upgrade to 2.1.0
cae9db2d Fix test's lint
bb392435 Make configuration directory/file ownership configurable
4603793f Add additional tests
f24a6fc1 Processors should be passed as a hash, not array
5f89f717 Chagne beat_name configuration parameter to name (Fixes Icinga#126)
367d5339 Fix typo in changelog
85987da0 Release version 2.0.0
d41cde9c Fixes Icinga#124 - Use correct url for 32 bit windows (Icinga#125)
01e36b74 Update apt dependency (Icinga#123)
baf7c7bf Drop support for Puppet 3 and Filebeat <5 (Icinga#118)
ee343811 Release 1.0
acf48c80 Fix testing environment variables
59d50468 Add loadbalance for ES in filebeat5.yml.erb (Icinga#119)
6683ba5e Fix Logstash SSL template (Icinga#121)
970b35a5 Note breaking changes that will follow the next release
f802ff45 Update changelog and note puppet 5 support
ec768ede filebeat 5 ssl support (Icinga#117)
54a6fca6 Fix style typo in changelog
d288ea60 Increment version number to 0.12.0
a5e44f8e Update changelog to reflect recent features
3ede14a4 Update puppet dependency to 3.5+
9e5cc2ce Merge pull request Icinga#115 from MiamiOH/master
b7e008e5 Typo fix; Also use install_dir in config validate_cmd
5e3f86be Merge pull request Icinga#114 from MiamiOH/master
57336544 Some windows install clean up
30d58b2e Merge pull request Icinga#113 from MiamiOH/master
2a9ad254 Fix filebeat_spec
a9c86360 Pin apt in fixtures to continue puppet 3 support
17a33d1e Clean up temp file on Windows install
1a286627 Use package_ensure for the same thing on windows and linux
7c1b1fda Fixes Icinga#109 - Windows update support
0912b163 install locales on ubuntu-16.04 nodeset (Icinga#111)
758656ed add optional repo_priority parameter (Icinga#110)
00e0b723 Increment version to 0.11.2
0fc9c46a support kafka codec.format option (Icinga#106)
5b6d42d4 Explicitly support newer versions of the puppetlabs/powershell module
c48422cc The `add_locale` processor doesn't require parameters (Icinga#104)
5f8adb23 Don't check boolean value of certain config parameters
e818c827 processor: Checking for the drop_event processor instead of the non-existent drop_field (Icinga#101)
f4b5699e Properly allow failures for puppet 3.8.7
72cd00d5 Fix yaml syntax
aa883e96 Allow failures when testing puppet 3.x
89e30ef2 Increment version number to 0.11.1
0d1d5a40 Test with a specific version of puppet 3.8
bdd9c981 Restore puppet 3 compatibility (for now)
607c62aa Increment version to v0.11.0
56bfa125 Support for round_robin algo and group_events (Icinga#100)
d2a2b524 Update changelog with fix for Icinga#63
47a608b5 Check for nil instead of undef in max_procs
da9c06bf Update Changelog
e904898b Conditional pipeline in output.elasticsearch (Icinga#98)
ea395267 Update chaining to match latest style guide
f542ee28 Merge branch 'master' of github.com:pcfens/puppet-filebeat
e17b449c Index conditional match in output elasticsearch (Icinga#97)
403a6692 Update README and CHANGELOG with breaking change information
c064eac3 Don't verify processor files (they don't have prospectors so they always fail)
3e408402 Move the default registry file
ea30d5b9 Pin version of rubocop gem
19a1ca75 Remove trailing whitespace in spec test
228b9b17 Fix style in spec test
3b81c8a8 Style changes to metadata.json and fixes
696e37b5 Create a method for removing filebeat using puppet
38ffce20 Add proxy server support to download files (Windows) (Icinga#90)
1407b090 Reworking the processor implementation. (Icinga#85)
8499ee8c Increment version number to v0.10.4
3ae5d968 Add support for output.console
ede4c4a3 Conform to strict_variables
8afca8dd Increment version number to v0.10.3
c44c0df2 Exempt facter confine line from the breaking rubocop test
92d5f513 Revert change to confine in filebeat_version
dd1c3535 Make an attempt at supporting processors in puppet < 4.x
93ef7e1f Allow http links for downloading filebeat for windows (Icinga#82)
adc80458 Remove Ruby 1.9.3/Puppet 3.8 travis tests
e858f2da Add a check to see if processors.params is emtpy before using it.
4cb659d0 Increment version to v0.10.2
53254830 add close_older and force_close_files within prospector v5 (Icinga#77)
1aa78c0d Update rubocopy to match voxpupuli's latest modulesync
2482954b Increment version number
e9f1dd05 Assume that windows paths will have spaces in them (Fixes Icinga#75)
a07192ad support harvesting symlinks (Icinga#74)
ca733c51 Fix typo in changelog diff links
930d8a17 Merge in changes from a previous release
dea9678f Increment version number to v0.10.0
4917f249 Add JSON decoding to the changelog
7fb3d094 Add support for json decoding (filebeat >= 5.0) (Icinga#72)
3f9a7142 Increment version to 0.9.2
abf7f99a Add close and clean harvesting  (Icinga#70)
50409d58 Increment version number to 0.9.1
b5532281 Fixing yaml spacing and README tutorials for params.
77b4a4f5 Increment version to 0.9.0
1b185044 Don't install development packages when testing
7b86bd16 Lint fixes
6287d6d6 Clean up tests some more
e5ebb2e6 Improve testing and attempt to meet voxpupuli's style standards
a38244c3 Update changelog
b6b8386f Add a note about the registry_path to the readme
25054a2f Update download URL for windows to latest
b6365393 Align params.pp file
a6d371ea Update the changelog to reflect changes over last few days
194158f8 Validate config files before restarting services
61cbcce7 All filebeat templates should include the major version number in them
a12f7eda Fix a regression in filebeat_version that caused warnings before filebeat was installed
1b6b4ef2 Fix the filebeat_version fact in windows
b0674fbc Add Support for Filebeat Processors
2d3d2402 Merge pull request Icinga#68 from plarivee/add_tags_to_prospector
077be4a0 Adding support for tags in prospector
1404171e Increment version number
d513528d Update windows URL again
3e9e117a Merge pull request Icinga#65 from elconas/fix_broken_max_procs
3a952d38 Fix error when max_procs is empty

git-subtree-dir: modules/filebeat
git-subtree-split: e2e1d02a51cfeb7ae880e08b21267fca95183fc9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants