0

Hi I want to monitor postgres database using ODBC and to show notification based on condition, I'm creating item with db.odbc.get[,{$DSN_NAME}], please find the screen shot my item configuration.

enter image description here

I can be able to get data, please find the below screen of receiving data enter image description here

Now I want to process this data and to show notification for user that these jobs are failed if status equals 8, I have tried it with trigger, but I can't get rid of it.

please find the screen shot for trigger configuration and also error that has been occured

enter image description here

The following error is occured

enter image description here

Can any one help me on this, and also please correct me if my approach is wrong, since I'm very new for this.

I'm also trying with low level discovery, but I don't exact way of doing it, I have tried below where I'm facing the following issue that

  Cannot create item: item with the same key "db.odbc.select[testing_odbc {#job_name},{$DSN_NAME}]" already exists.
.

Find the screen shot of discovery rule below enter image description here

Then I'm creating item prototype as below enter image description here

please find the sample data from discovery rule

{ 
  "data":[{"job_name":"job1","job_status":1},{"job_name":"job2","job_status":0},{"job_name":"job3","job_status":2}]
}

I'm scheduling the discovery rule for every 20 seconds and item prototype for every 30 seconds, and I guess for every 20 seconds it's trying to create item with same id as before.

How to resolve and for the sql query in item prototype what need to give.

saran k
  • 307
  • 2
  • 14

1 Answers1

0

That JSON text is not a number, so you can't compare it to a number.

Options:

  • change your query to return a number.
  • Use JSONPath preprocessing to select the number from the JSON (ie: $[0]["Status"])
Iron Bishop
  • 1,749
  • 1
  • 7
  • 16
  • thanks for your suggestion but I'll be getting multiple values from item and I also need to show which job is failed, how to handle this scenario – saran k Dec 03 '20 at 17:22
  • Then you need a LLD, but "Reload License Monitor" is present at least 3 times so there's something wrong in the first place. – Iron Bishop Dec 03 '20 at 17:37
  • Actually I'm trying with LLD there also I'm facing an issue, I'm doing the following steps, 1. creating discovery rule and then I'm creating item prototype with with the type data base monitoring where I'm getting the following error, Cannot create item: item with the same key "db.odbc.select[,{$DSN_NAME}]" already exists. please find my updated question. Thanks – saran k Dec 03 '20 at 17:55
  • please find my uodated post using LLD, could you please help me on resolving that issue. – saran k Dec 03 '20 at 18:08
  • You need to use `{#job_name}` instead of `job_name` to be in the correct Zabbix LLD format. Also, the discovery is supposed to run every 1h, not 20s. – Iron Bishop Dec 04 '20 at 08:30
  • thanks for that information, anyway I'm using {#job_name} not job_name, where you saw like that in my question and as you say I'll schedule discovery for every one hour and what about item prototype same, is that also need to be schedule for every 1 hour? – saran k Dec 04 '20 at 08:48
  • LDD usually run each 1h, item prototype can be whatever you need, usually 1m but can vary – Iron Bishop Dec 04 '20 at 09:50