StackStorm/st2

nagios invalid triggertype

MaheshSankaran opened this issue · 0 comments

SUMMARY

Provide a quick summary of your bug report.
I am working nagios and stackstorm integration.
I have used kubernetes to deploy stackstorm.
I have installed nagios pack and
getting invalid endpoints when i test with st2service_handler.py like below,

STACKSTORM VERSION

Paste the output of st2 --version:
st2 3.8.1, on Python 3.8.10

OS, environment, install method

Kubernetes

Steps to reproduce the problem

Show how to reproduce the problem, using a minimal test-case. Make sure to include any content
(pack content - workflows, actions, etc.) which are needed to reproduce the problem.
Install kubernetes stackstorm HA with helm
Install nagios pack
git clone stackstorm-nagios
update config yaml with stackstorm username and password

Expected Results

What did you expect to happen when running the steps above?
I expect that all Events come to ST2.

Actual Results

What happened? What output did you get?

python3 st2service_handler.py st2service_handler.yaml 1 testing CRITICAL 1 HARD 1 my_super_cool_router --verbose
Contents of config file: {'st2_api_key': 'Njk1OTVjNjIzMDhiZmE2NzZlNWQzMD****ZGMzODg2MjBhNjYxN2Q3MDYwZGE0YzVjNTEyNDk0YTM0NA', 'st2_username': 'st2admin', 'st2_password': '********', 'st2_api_base_url': 'http://10.182.0.45:32349/api/v1/', 'st2_auth_base_url': 'http://10.182.0.4:31182/auth/v1/', 'unauthed': False, 'ssl_verify': False}
Unauthed? : False
API key auth?: True
SSL Verify? : False

Checking if trigger "nagios.service_state_change" registered with st2.
Will GET from URL http://10.182.0.45:32349/api/v1/triggertypes/nagios.service_state_change for detecting trigger nagios.service_state_change.

Request headers: {'St2-Api-Key': 'Njk1OTVjNjIzMDhiZmE2NzZlNWQzMD******ZGMzODg2MjBhNjYxN2Q3MDYwZGE0YzVjNTEyNDk0YTM0NA'}

POST to URL http://10.182.0.45:32349/api/v1/triggertypes for registering trigger. Body = {'name': 'service_state_change', 'pack': 'nagios', 'description': 'Trigger type for nagios event handler.'}, headers = {'St2-Api-Key': 'Njk1OTVjNjIzMDhiZmE2NzZlNWQzMDgxMjRhNTA0ZGMzODg2MjBhNjYxN2Q3MDYwZGE0YzVjNTEyNDk0YTM0NA', 'Content-Type': 'application/json; charset=utf-8'}.

Traceback (most recent call last):
  File "/root/st2service_handler.py", line 183, in _register_trigger_with_st2
    _create_trigger_type(verbose=verbose)
  File "/root/st2service_handler.py", line 95, in _create_trigger_type
    raise Exception(msg)
Exception: Got response 404. Invalid triggers endpoint http://10.182.0.45:32349/api/v1/triggertypes.Check configuration!
Traceback (most recent call last):
  File "/root/st2service_handler.py", line 183, in _register_trigger_with_st2
    _create_trigger_type(verbose=verbose)
  File "/root/st2service_handler.py", line 95, in _create_trigger_type
    raise Exception(msg)
Exception: Got response 404. Invalid triggers endpoint http://10.182.0.45:32349/api/v1/triggertypes.Check configuration!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/st2service_handler.py", line 160, in _register_with_st2
    _register_trigger_with_st2(verbose=verbose)
  File "/root/st2service_handler.py", line 190, in _register_trigger_with_st2
    raise Exception('Unable to connect to st2 endpoint {0}.\n'
Exception: Unable to connect to st2 endpoint http://10.182.0.45:32349/api/v1/triggertypes/nagios.service_state_change.

Failed registering with st2. Won't post event.

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!