Error enabling filebeat

Bug #1911667 reported by David
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MicroStack
New
Undecided
Unassigned

Bug Description

Got this error when enabling filebeat:

$ sudo snap install microstack --devmode --channel edge
microstack (edge) ussuri from Canonical✓ installed
$ sudo snap set microstack config.network.ports.dashboard=8080
$ sudo microstack.init --control
Would you like to configure clustering? (yes/no) [default=yes] >
2021-01-14 11:44:03,598 - microstack_init - INFO - Configuring clustering ...
Please enter the ip address of the control node [default=192.168.0.12] >
2021-01-14 11:44:10,367 - microstack_init - INFO - Setting up as a control node.
2021-01-14 11:44:12,602 - microstack_init - INFO - Configuring networking ...
2021-01-14 11:44:18,718 - microstack_init - INFO - Opening horizon dashboard up to *
2021-01-14 11:44:19,409 - microstack_init - INFO - Waiting for RabbitMQ to start ...
Waiting for 192.168.0.12:5672
2021-01-14 11:44:24,971 - microstack_init - INFO - RabbitMQ started!
2021-01-14 11:44:24,971 - microstack_init - INFO - Configuring RabbitMQ ...
2021-01-14 11:44:25,787 - microstack_init - INFO - RabbitMQ Configured!
2021-01-14 11:44:25,811 - microstack_init - INFO - Waiting for MySQL server to start ...
Waiting for 192.168.0.12:3306
2021-01-14 11:44:31,347 - microstack_init - INFO - Mysql server started! Creating databases ...
2021-01-14 11:44:32,843 - microstack_init - INFO - Configuring Keystone Fernet Keys ...
2021-01-14 11:44:43,046 - microstack_init - INFO - Bootstrapping Keystone ...
2021-01-14 11:44:49,756 - microstack_init - INFO - Creating service project ...
2021-01-14 11:44:53,943 - microstack_init - INFO - Keystone configured!
2021-01-14 11:44:53,958 - microstack_init - INFO - Configuring the Placement service...
2021-01-14 11:45:09,132 - microstack_init - INFO - Running Placement DB migrations...
2021-01-14 11:45:11,927 - microstack_init - INFO - Configuring nova control plane services ...
2021-01-14 11:45:20,467 - microstack_init - INFO - Running Nova API DB migrations (this may take a lot of time)...
2021-01-14 11:45:37,929 - microstack_init - INFO - Running Nova DB migrations (this may take a lot of time)...
Waiting for 192.168.0.12:8774
2021-01-14 11:46:17,433 - microstack_init - INFO - Creating default flavors...
2021-01-14 11:46:37,025 - microstack_init - INFO - Configuring nova compute hypervisor ...
2021-01-14 11:46:38,615 - microstack_init - INFO - Configuring the Spice HTML5 console service...
2021-01-14 11:46:39,155 - microstack_init - INFO - Configuring Neutron
Waiting for 192.168.0.12:9696
2021-01-14 11:47:42,533 - microstack_init - INFO - Configuring Glance ...
Waiting for 192.168.0.12:9292
2021-01-14 11:48:12,276 - microstack_init - INFO - Adding cirros image ...
2021-01-14 11:48:14,217 - microstack_init - INFO - Creating security group rules ...
2021-01-14 11:48:21,894 - microstack_init - INFO - Configuring the Cinder services...
2021-01-14 11:49:05,120 - microstack_init - INFO - Running Cinder DB migrations...
(experimental) Would you like to setup a loop device-backed LVM volume backend for Cinder? (yes/no) [default=no] >
2021-01-14 11:49:54,424 - microstack_init - INFO - restarting libvirt and virtlogd ...
2021-01-14 11:50:01,817 - microstack_init - INFO - Complete. Marked microstack as initialized!
Would you like to setup extra services? (yes/no) [default=no] > yes
Would you like to enable Filebeat? (yes/no) [default=no] > yes
2021-01-14 11:50:45,685 - microstack_init - INFO - enabling and starting Filebeat
Traceback (most recent call last):
  File "/snap/microstack/223/bin/microstack_init", line 11, in <module>
    load_entry_point('microstack-init==0.0.1', 'console_scripts', 'microstack_init')()
  File "/snap/microstack/223/lib/python3.8/site-packages/init/main.py", line 58, in wrapper
    return func(*args, **kwargs)
  File "/snap/microstack/223/lib/python3.8/site-packages/init/main.py", line 206, in init
    question.ask()
  File "/snap/microstack/223/lib/python3.8/site-packages/init/questions/question.py", line 210, in ask
    self.yes(awr)
  File "/snap/microstack/223/lib/python3.8/site-packages/init/questions/__init__.py", line 949, in yes
    question.ask()
  File "/snap/microstack/223/lib/python3.8/site-packages/init/questions/question.py", line 210, in ask
    self.yes(awr)
  File "/snap/microstack/223/lib/python3.8/site-packages/init/questions/__init__.py", line 923, in yes
    enable(service)
  File "/snap/microstack/223/lib/python3.8/site-packages/init/shell.py", line 162, in enable
    check('snapctl', 'start', '--enable', 'microstack.{}'.format(service))
  File "/snap/microstack/223/lib/python3.8/site-packages/init/shell.py", line 69, in check
    raise subprocess.CalledProcessError(proc.returncode, " ".join(args))
subprocess.CalledProcessError: Command 'snapctl start --enable microstack.microstack.filebeat' returned non-zero exit status 1.

Revision history for this message
Billy Olsen (billy-olsen) wrote :

Looks to be the same root cause as bug 1900075

Revision history for this message
xiaokunfeng (kele1997) wrote :

when I install run `sudo microstack init --control --debug`, and try to enable filebeat, I got the errors as below:

2021-04-28 08:57:55,164 - microstack_init - DEBUG - error: error running snapctl: unknown service: "microstack.microstack.filebeat"

Traceback (most recent call last):
....
....

So as we can see, the real error is `unkown service microstack.microstack.filebeat`, the **microstack** appears twice.

Maybe the solution is :

modify file `lib/python3.8/site-packages/init/questions/__init__.py`, modify class `Filebeat`, `Telegraf`,`Nrpe` like this:

```python3
class Filebeat(SimpleServiceQuestion):
    _type = 'boolean'
    _question = 'Would you like to enable Filebeat?'
    config_key = 'config.services.extra.filebeat'
    interactive = True

    @property
    def services(self):
        return [
- '{SNAP_INSTANCE_NAME}.filebeat'.format(**_env)
+ 'filebeat'.format(**_env)
        ]
```

just remove `{SNAP_INSTANCE_NAME}`,and then works

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.