D
D
Darkcloud2019-11-14 11:10:35
JavaScript
Darkcloud, 2019-11-14 11:10:35

How to calculate the average value of items in zabbix?

How to calculate the average value of 50 items, while not writing each time the name of each item? Something like avg([1-50])

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Belyaev, 2018-10-29
@SergeiB

var IGNORED_TYPES = [
    'file',
    'reset',
    'submit',
    'button'
].reduce(function(acc, type) {
    acc[type] = 1;
    return acc;
}, {});
var VALUE_MISSING_MESSAGES = {
    checkbox: msg.valueMissingCheckbox,
    radio: msg.valueMissingRadio,
    'select-one': msg.valueMissingSelect,
    'select-multiple': msg.valueMissingSelectMulti
};
var TYPE_MISMATCH_MESSAGES = {
    email: msg.typeMismatchEmail,
    url: msg.typeMismatchURL
};

function getError(field) {
    var validity = field.validity;
    var type = field.type;
    switch (true) {
    case (validity.valid || field.disabled || type in IGNORED_TYPES):
        return;
    case validity.valueMissing:
        return VALUE_MISSING_MESSAGES[type] || msg.valueMissing;
    case (validity.typeMismatch && type in TYPE_MISMATCH_MESSAGES):
        return TYPE_MISMATCH_MESSAGES[type];
    case validity.tooShort:
        return msg.tooShort(field);
    case validity.tooLong:
        return msg.tooLong(field);
    case validity.badInput:
        return msg.badInput;
    case validity.stepMismatch:
        return msg.stepMismatch;
    case validity.rangeOverflow:
        return msg.rangeOverflow;
    case validity.rangeUnderflow:
        return msg.rangeUnderflow;
    case validity.patternMismatch:
        if (field.hasAttribute('title'))
            return field.getAttribute('title');
        return msg.patternMismatch;
    }
    return msg.generic;
}

M
Mesuti, 2018-10-29
@Mesuti

If the code works, then it is better not to touch it)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question