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

[DRAFT] collectd: minor dsl lua script changes #23011

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions utils/collectd/files/lua-scripts/dsl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ local line_vars = {
},
{
name = "satn",
type = "snr"
type = "gauge"
},
{
name = "latn",
type = "snr"
type = "gauge"
},
{
name = "attndr",
Expand Down Expand Up @@ -58,13 +58,29 @@ local errors = {
name = "rx_corrupted",
type = "errors"
},
{
name = "rx_uncorrected_protected",
type = "errors"
},
{
name = "rx_retransmitted",
type = "errors"
},
{
name = "rx_corrected",
type = "errors"
},
{
name = "tx_retransmitted",
type = "errors"
},
{
name = "crc_p",
type = "errors"
},
{
name = "crcp_p",
type = "errors"
}
}

Expand Down Expand Up @@ -105,11 +121,17 @@ end
local function get_values(hostname, variables, metrics, direction)
for _, information in pairs(variables) do
local name = information["name"]
local type = information["type"]

if metrics and metrics[name] ~= nil then
local value = metrics[name]
local metric = build_metric(name, direction)
if information["type"] == "bool" then

if name = type then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intended to be an assignment? Looks like it should be == to me.

Also, I'm not a fan of this special case. I don't see much benefit but unnecessary extra complexity, but that might be just me :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, you're right. That's just a typo. As I said, I haven't yet tested these changes lol.

You're probably right. I mean, it doesn't really make any difference so it could also just be a waste of time to put any more thought into it. Ultimately, it ain't my call. If you want this change removed, I'll happily do so.

local metric = direction
else
local metric = build_metric(name, direction)
end
if type == "bool" then
if metrics[name] == true then
value = 1
else
Expand All @@ -120,7 +142,7 @@ local function get_values(hostname, variables, metrics, direction)
local t = {
host = host,
plugin = 'dsl',
type = information["type"],
type = type,
type_instance = metric,
values = {value}
}
Expand Down