Prototype-X / Zabbix-Template-Juniper-MX-BGP4-ipv4-ipv6

Zabbix Template for Juniper MX discovery BGP4 peers ipv4 and ipv6, RE, interfaces
GNU General Public License v3.0
36 stars 23 forks source link

Value should be a JSON object #11

Open vnv099 opened 3 years ago

vnv099 commented 3 years ago

Hi! I use zabbix 3.0.22 and latest template and script. When I run script from console, it works fine and shows my BGP peers

{
    "data": [
        {
            "{#ADDRTYPE}": "1",
            "{#ASNUM}": "6768",
            "{#PEERADDR}": "45.14.111.26",
            "{#PREFXTBL}": "7",
            "{#SNMPINDEX}": "0.1.45.14.111.27.1.45.14.111.26"
        },
        {
            "{#ADDRTYPE}": "1",
            "{#ASNUM}": "6768",
            "{#PEERADDR}": "45.14.111.30",
            "{#PREFXTBL}": "6",
            "{#SNMPINDEX}": "0.1.45.14.111.31.1.45.14.111.30"
        },
        {
            "{#ADDRTYPE}": "1",
            "{#ASNUM}": "15738",
            "{#PEERADDR}": "80.84.186.13",
            "{#PREFXTBL}": "11",
            "{#SNMPINDEX}": "0.1.80.84.186.14.1.80.84.186.13"
        },
        {
            "{#ADDRTYPE}": "1",
            "{#ASNUM}": "15738",
            "{#PEERADDR}": "80.254.9.189",
            "{#PREFXTBL}": "10",
            "{#SNMPINDEX}": "0.1.80.254.9.190.1.80.254.9.189"
        },
        {
            "{#ADDRTYPE}": "1",
            "{#ASNUM}": "30777",
            "{#PEERADDR}": "193.201.152.129",
            "{#PREFXTBL}": "12",
            "{#SNMPINDEX}": "0.1.193.201.152.157.1.193.201.152.129"
        },
        {
            "{#ADDRTYPE}": "1",
            "{#ASNUM}": "3326",
            "{#PEERADDR}": "194.146.196.25",
            "{#PREFXTBL}": "4",
            "{#SNMPINDEX}": "0.1.194.146.196.26.1.194.146.196.25"
        },
        {
            "{#ADDRTYPE}": "2",
            "{#ASNUM}": "3326",
            "{#PEERADDR}": "2a01:758:ffe8:1::",
            "{#PREFXTBL}": "5",
            "{#SNMPINDEX}": "0.2.42.1.7.88.255.232.0.1.0.0.0.0.0.0.0.1.2.42.1.7.88.255.232.0.1.0.0.0.0.0.0.0.0"
        },
        {
            "{#ADDRTYPE}": "2",
            "{#ASNUM}": "6768",
            "{#PEERADDR}": "2a01:4a60:0:1::91",
            "{#PREFXTBL}": "8",
            "{#SNMPINDEX}": "0.2.42.1.74.96.0.0.0.1.0.0.0.0.0.0.0.146.2.42.1.74.96.0.0.0.1.0.0.0.0.0.0.0.145"
        },
        {
            "{#ADDRTYPE}": "2",
            "{#ASNUM}": "6768",
            "{#PEERADDR}": "2a01:4a60:0:1::99",
            "{#PREFXTBL}": "9",
            "{#SNMPINDEX}": "0.2.42.1.74.96.0.0.0.1.0.0.0.0.0.0.0.154.2.42.1.74.96.0.0.0.1.0.0.0.0.0.0.0.153"
        },
        {
            "{#ADDRTYPE}": "2",
            "{#ASNUM}": "15738",
            "{#PEERADDR}": "2a06:ff40:0:741::1",
            "{#PREFXTBL}": "13",
            "{#SNMPINDEX}": "0.2.42.6.255.64.0.0.7.65.0.0.0.0.0.0.0.2.2.42.6.255.64.0.0.7.65.0.0.0.0.0.0.0.1"
        }
    ]
}

but in zabbix i get "Not supported" and 'Value should be a JSON object.' How can I make it working?

AmandaJangrossi commented 2 years ago

Hey, how are you doing? I knowit's a bit late, but I found the solution for this, if you are using Zabbix v5.XX or above, probably you gonna find two problems, in my case it gave me an error in the graphics prototype and the same as yours ("Not supported" and "Value should be a JSON object.") in the item key. For the graph prototype the solution is just open the XML file in a notepad/code editor (I used VSCode) and remove everything is inside the <GraphPrototypes> tag image (On left it's the original template and on the right it's how it's supposed to be).

Next, to solve the issue that both of us had, you have to change some of the key sintaxe in your Zabbix Template. Access your JunOS BGP4 discovery rule, and on the key adapt like this: LLD.py[-h, {HOST.CONN}, -v2c, -c, {$SNMP_COMMUNITY},"-mi", "{#PEERADDR}", "-m", "{#PREFXTBL}", "{#ADDRTYPE}", "{#ASNUM}"] I assume that you already register you SNMP_COMMUNITY macro, but if not, just access Administration -> Geral -> Macros and set your community. I highly suggest testing before accept, if everything it's fine it gonna come up like this: image

I hope it helps!