oliver006/redis_exporter

Issues with running custom LUA scripts

pszemazzz opened this issue · 1 comments

Describe the problem
I am not able to run custom LUA scripts. Any script that tries to run gives an error.

time="2024-03-20T14:31:41Z" level=error msg="LuaScript error: ERR user_script:1: Attempt to modify a readonly table script: 9acab1863327e929b7d8cc9f294a33e4176c0b4a, on @user_script:1."

Simple LUA script I am trying to run, just for testing purposes:

collect_list_depth.lua

    a = "test"
    print(a)
    return a

All other metrics are collected correctly, but struggling with custom ones.
Do I need any additional configuration ? Am I using REDIS_EXPORTER_SCRIPT correctly ? Any help to make it running ?

What version of redis_exporter are you running?
[ ] 0.3x.x
[X ] 1.x.x

Running the exporter
As deployment on K8s

  containers:
  - name: redis-metrics-exporter
    image: oliver006/redis_exporter:alpine
    securityContext:
      runAsUser: 59000
      runAsGroup: 59000
      allowPrivilegeEscalation: false
      capabilities:
        drop:
        - ALL
    env:
      - name: REDIS_ADDR
        value: {{ redis_dbaddress }}
      - name: REDIS_USER
        value: {{ redis_username }}
      - name: REDIS_PASSWORD
        value: << HIDDEN >>
      - name: REDIS_EXPORTER_SCRIPT
        value: /etc/redis-exporter/scripts/collect_list_depth.lua
      - name: REDIS_QUEUES_TO_MONITOR
        value: {{ redis_queues_to_monitor }}
    volumeMounts:
      - name: redis-exporter-cm
        mountPath: "/etc/redis-exporter/scripts/collect_list_depth.lua"
        subPath: collect_list_depth.lua
        readOnly: false

I personally don't use lua scripts with the exporter so I won't be of much help here.
That said, the tests include a lua script and they pass so this might be something related to your Redis instance setup.