So I am trying to do a simple DNS check on a record by doing a lookup and verifying its value. Should be simple, right? Wrong..
Using Zabbix 4.0.4
ITEM SETUP
I set up the 'Item' as follows:
Name
NS Query Check [Internal]
Type: Zabbix agent
Key: net.dns.record[127.0.0.1,pi-ncid,A,2,1]
Type of information: Text
I know this 'Item' works because I can look at the Data received, and the value comes back as expected (as follows, w/out quotes):
"pi-ncid A 10.10.1.26" Side note: I also made sure there was no leading or trailing whitespace attached to that data (by temporarily prepending and appending <> via preprocessing).
TRIGGER SETUP
I set up the 'Trigger' as follows:
Name: DNS Internal Check
Severity: Warning
Expression: {pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].str(pi-ncid A 10.10.1.26)}=0
So this simply does not work. Using the 'Expression constructor' test returns a 'True' result for above when it should return 'False'.
The expression {pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].str(pi-ncid A 10.10.1.26)} should return a value of 1, but it returns a value of 0.
I've tried all combinations of expressions/functions and they all behave similarly; I've tried the following (to mention a few):
{pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].str(pi-ncid A 10.10.1.26)} <- the origninal
{pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].regexp(.*10.10.1.26.*)}=0 <- trying regular expression function now
{pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].regexp(".*10.10.1.26.*")}=0 <- not sure if quotes were necessary or not
{pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].regexp(.*)}=0 <- this should match literally 'anything', but still returns a 0
{pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].regexp(".*")}=0 <- not sure if quotes were necessary or not
ADDITIONAL
I even tried a different 'Item Key' as I started to wonder if the str and regexp functions may not work with net.dns.record:
Changing the key to system.run[dig +short pi-ncid], produced a data text value of "10.10.1.26", as expected. However, the Trigger expression {pi-hole:system.run[dig +short pi-ncid].str(10.10.1.26)}=0 still produced a 'True' value during testing.
Appreciate any help you can provide.
Cheers
Using Zabbix 4.0.4
ITEM SETUP
I set up the 'Item' as follows:
Name
NS Query Check [Internal]Type: Zabbix agent
Key: net.dns.record[127.0.0.1,pi-ncid,A,2,1]
Type of information: Text
I know this 'Item' works because I can look at the Data received, and the value comes back as expected (as follows, w/out quotes):
"pi-ncid A 10.10.1.26" Side note: I also made sure there was no leading or trailing whitespace attached to that data (by temporarily prepending and appending <> via preprocessing).
TRIGGER SETUP
I set up the 'Trigger' as follows:
Name: DNS Internal Check
Severity: Warning
Expression: {pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].str(pi-ncid A 10.10.1.26)}=0
So this simply does not work. Using the 'Expression constructor' test returns a 'True' result for above when it should return 'False'.
The expression {pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].str(pi-ncid A 10.10.1.26)} should return a value of 1, but it returns a value of 0.
I've tried all combinations of expressions/functions and they all behave similarly; I've tried the following (to mention a few):
{pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].str(pi-ncid A 10.10.1.26)} <- the origninal
{pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].regexp(.*10.10.1.26.*)}=0 <- trying regular expression function now
{pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].regexp(".*10.10.1.26.*")}=0 <- not sure if quotes were necessary or not
{pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].regexp(.*)}=0 <- this should match literally 'anything', but still returns a 0
{pi-hole:net.dns.record[127.0.0.1,pi-ncid,A,2,1].regexp(".*")}=0 <- not sure if quotes were necessary or not
ADDITIONAL
I even tried a different 'Item Key' as I started to wonder if the str and regexp functions may not work with net.dns.record:
Changing the key to system.run[dig +short pi-ncid], produced a data text value of "10.10.1.26", as expected. However, the Trigger expression {pi-hole:system.run[dig +short pi-ncid].str(10.10.1.26)}=0 still produced a 'True' value during testing.
Appreciate any help you can provide.
Cheers
Comment