amidaware / tacticalrmm

A remote monitoring & management tool, built with Django, Vue and Go.
https://docs.tacticalrmm.com
Other
2.92k stars 422 forks source link

Serverside actions and cli #1823

Closed sadnub closed 4 days ago

sadnub commented 3 months ago

TODO/BUGS:

silversword411 commented 2 months ago

Fix Pattern column, limit max length. Change bottom scrollbar to always show Test at browser with width 900

2024-04-22_142818 - chrome_Tactical_RMM_-_Google_Chromeb
dinger1986 commented 2 months ago

When building out content for the webhook message ie "text": "Error on {{agent.hostname}} with severity of {{alert.severity}}, at {{alert.alert_time}}. The full content of the message is {{alert.message}}" it doesnt send more than the first variable, same behaviour with teams and slack

dinger1986 commented 2 months ago

Errors Running more advanced webhooks

POST

Header

{
    "Content-Type": "application/json",
    "User-Agent": "TacticalRMM/1.0"
}

Body

{
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "summary": "Issue with {{agent.hostname}}",
    "themeColor": "0078D7",
    "title": "{{alert.message}}",
    "sections": [{
        "activityTitle": "Issue",
        "activitySubtitle": "On {{alert.severity}}",
        "facts": [{
            "name": "Alert Time",
            "value": "{{alert.alert_time}}"
        }],
        "markdown": true
    }]
}

I have DM'd the URL

Error from debug log

[22/Apr/2024 22:22:51] ERROR [log.py:log_response:241] Internal Server Error: /core/urlaction/run/test/
Traceback (most recent call last):
  File "/rmm/api/env/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/env/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/env/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/env/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/rmm/api/env/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/tacticalrmm/core/views.py", line 454, in post
    result, _ = run_test_url_rest_action(
                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/tacticalrmm/core/utils.py", line 308, in run_test_url_rest_action
    response = _run_url_rest_action(
               ^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/tacticalrmm/core/utils.py", line 256, in _run_url_rest_action
    new_body = find_and_replace_db_values_dict(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/tacticalrmm/core/utils.py", line 246, in find_and_replace_db_values_dict
    new_value = find_and_replace_db_values_str(text=value, instance=instance)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rmm/api/tacticalrmm/core/utils.py", line 225, in find_and_replace_db_values_str
    for string, model, prop in re.findall(RE_DB_VALUE, text):
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/re/__init__.py", line 216, in findall
    return _compile(pattern, flags).findall(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'list'