Ad Widget

Collapse

New Template for TrueNas Api + LLD

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • galvy
    Junior Member
    • Jun 2020
    • 19

    #1

    New Template for TrueNas Api + LLD

    Good morning Zabbix Users,
    I'm creating (should be) first Zabbix Template for monitoring TrueNas with Api function but I have some problems.
    the Github link i'll post when the first release is ready.
    My idea is to create an item / trigger for each alert that is not "dismissed" in order to monitor all my Truenas.
    Given the notification I connect to the freenas I check what I have to do, and set notification to dismissed true so zabbix at the next check will delete item / trigger
    Example of api output
    [
    {
    "uuid": "3317bc69-355d-459b-8521-3c321d928927",
    "source": "ReportingDb",
    "klass": "ReportingDb",
    "args": {
    "used": "1.65 GiB",
    "threshold": "1.05 GiB"
    },
    "node": "Controller A",
    "key": "null",
    "datetime": {
    "$date": 1625827858961
    },
    "last_occurrence": {
    "$date": 1660745619351
    },
    "dismissed": true,
    "mail": null,
    "text": "Reporting database used size %(used)s is larger than %(threshold)s.",
    "id": "3317bc69-355d-459b-8521-3c321d928927",
    "level": "WARNING",
    "formatted": "Reporting database used size 1.65 GiB is larger than 1.05 GiB.",
    "one_shot": false
    },
    {
    "uuid": "9721e6ec-ed6c-449b-a0a7-efaac3461eeb",
    "source": "",
    "klass": "UPSReplbatt",
    "args": {
    "ups": "ups"
    },
    "node": "Controller A",
    "key": "{"ups": "ups"}",
    "datetime": {
    "$date": 1660727945477
    },
    "last_occurrence": {
    "$date": 1660727945477
    },
    "dismissed": false,
    "mail": null,
    "text": "UPS %(ups)s Battery needs replacement.",
    "id": "9721e6ec-ed6c-449b-a0a7-efaac3461eeb",
    "level": "CRITICAL",
    "formatted": "UPS ups Battery needs replacement.",
    "one_shot": false
    }
    ]


    with this Item I'll retrive one array of alerts (both bismissed true and false)
    Click image for larger version  Name:	general.jpg Views:	0 Size:	131.6 KB ID:	450024


    with this "item prototipe" i create one item for each notifications presente in TrueNas


    Click image for larger version  Name:	prototipe_item.jpg Views:	0 Size:	191.0 KB ID:	450025


    Problem:
    1: how to create item only for alter with dismissed = false:
    2) for each created item in "value filed" i see all entire json content


    Click image for larger version  Name:	problem.jpg Views:	0 Size:	171.3 KB ID:	450026
    Last edited by galvy; 18-08-2022, 11:30.
Working...