How to trigger alert when items are unavailable? - zabbix

Using Zabbix, how can I trigger an alert if an item is unreachable (e.g. 'ZBX_NOTSUPPORTED' or any error that is traced when the zabbix agent could not provide the expected item format) ?
The goal is to prevent hosts to silently fail on retrieving data on items.

From the documentation:
Receiving notifications on unsupported items is supported since Zabbix
2.2.
It is part of the concept of internal events in Zabbix, allowing users
to be notified on these occasions. Internal events reflect a change of
state:
when items go from 'normal' to 'unsupported' (and back) when triggers
go from 'normal' to 'unknown' (and back) when low-level discovery
rules go from 'normal' to 'unsupported' (and back)

when item is unsupported, it means that the item has not received any data.So you can use nodata() funcation.
nodata(sec)
Checking for no data received.
Supported value types: any
Returns:
1 - if no data received during the defined period of time
0 - otherwise

Related

Why my Soffid JSON REST Web Services Connector does not update an object in the target system?

I am trying to connect my Soffid 3 server with our custom web application named Schrift. I am using а JSON REST Web Services Connector for this purpose. I added REST Web service plugin and then configured an agent with JSON/XML/SOAP Rest webservice type.
Loading of objects is working fine. My REST connector connects to the web service successfully and gets data of the accounts.
The problem is when I am trying to update some data (for example, I am trying to lock an account), nothing happens. And unfortunately I don't know what should be happening. When should REST connector send updated data to the managed system and in which way? I didn't find any log entries saying that REST connector was trying to update an object on managed system. Maybe I did smth wrong or missed something.
I would appreciate for any help. I can post any conf or log details if you need.
Update#1
(I did some investigation after the first answer)
I checked the agent settings: Read only and Manual account creation are set to no
The account was set to unmanaged type, but I succeeded in changing its type to shared and then to single without getting an error. Now it is set to single
The task queue is empty.
Also I've checked that update method is present and update properties are set correctly. updateParams is not set (it means that all attributes should be sent to the managed system).
But when I change status of the account (from Enable to Disable), nothing happens.
In the console log I can see only these lines
14-Sep-2021 13:26:29.708 INFO [BPM-Scheduler:192.168.7.121:1] com.soffid.iam.bpm.job.JobExecutorThread.run No job to execute
When I manually run the task Analize impact for changes on Schrift, Execution log shows
Changes detected for accounts
=============================
NO CHANGE DETECTED
Changes detected for roles
=============================
NO CHANGE DETECTED
Update#2
After many attempts I made some progress. Now when I make some changes in the account, the task named UpdateAccount baklykov#irf.com.ua#Schrift appears, but runs with an error.
At first it was 415 Unsupported Media Type error as I wrote in comments, but now it looks a little different
Throws exception updating object : Extensible object [type = account]
EmployeeEmail: baklykov#irf.com.ua
IsLockedOut: true (log truncated) ...
caused by Unexpected response, Content-Type: null
Update#3
I found out that soffid's request for updating the object was in improper format (all the parameters were passed in the html request instead of putting them in json body)
After researching I found a method's property called Encoding and set it to application/json value.
Now the parameters are passed in json body (that's what I need), but now the problem is that soffid puts all the parameters in json body, including the key parameter by which the object for updating should be determined. My guess this is the reason why the object in the target system is still not updated.
In other words my application expects a request like this:
https://myapp.mysite.com/api/v1/Soffid/Employees?EmployeeEmail=baklykov%40irf.com.ua :
{"EmployeeLastName":"Baklykov","EmployeeFirstName":"Ivan"}
but Soffid sends this:
https://myapp.mysite.com/api/v1/Soffid/Employees:
{"EmployeeLastName":"Baklykov","EmployeeFirstName":"Ivan","EmployeeEmail":"baklykov#irf.com.ua"}
The system should have created a UpdateAccount task in the task queue. Please, verify:
The task engine is in automatic mode. In read-only or manual mode, no task will be created.
If you are updating an account, check the account is not set as unmanaged. In that case, no tasks is created.
Finally, verify the task queue has not held the task up.
Have you checked the engine mode? Look at Main Menu > Administration > Configure Soffid > Integration engine > Smart engine settings
It should be set to automatic.

NATS - just one subscriber to take action for published event in a microservicearchitecture

I'm new to NATS and have read all the examples for:
https://nats.io/documentation/concepts/nats-messaging/
I'm in Microservciearchitecture where in microservice-Y (MSY) need to store some information published from other microservice-X (MSX) I have 2-10 instances of MSY so when changes are made in MSX and MSX-instance publishes event I want that only 1 instance of MSY should save information so not all of them save the same data.
I have read Request-Repy:
https://nats.io/documentation/concepts/nats-req-rep/
but there seems that all of instances receives message (and will handle it) even if it is point-to-point and reply is handled just for the one instance that is quickest to reply
Is this correct or have I missunderstood example?
If I only need that 1 instance of MSY should handle given message (store data in db) what can I do to acheve this?
Use queue groups. If you have multiple subscriptions on the same subject with the same queue group, only one of the members of the group will receive the message.
Check this out: https://nats.io/documentation/concepts/nats-queueing/

Orion Context Broker delivery guarantees?

Thinking of 'production' usage of Orion Context Broker, I wonder what kind of guarantees are provided by the Orion Context Broker in terms of delivery of messages -- both from producer and consumer perspective? In particular, keeping in mind various possible failure scenarios (CB failure/restart, network transient failure, consumer failure/restart, etc), as well as possibility of resource congestion in the CB. Few examples:
1) if a context update operation succeeds, is it guaranteed that consequent queries will return the latest data (e.g., even if CB failed right after acknowledging the update request, and then restarted)?
2) if a consumer subscribed for certain context information, is it guaranteed that it will receive all the relevant updates -- exactly once, at least once, or even at all? (e.g., in case of transient network failure between CB and the consumer)
3) if a consumer updated its subscription, is it guaranteed that the consequent updates will accurately reflect it? (e.g., if CB failed right after acknowledging the subscription request, and then restarted)
4) if a consumer is subscribed for context changes ('onchange', no throttling), and there are multiple consequent updates from the producer affecting the same attribute, is it guaranteed that each of the changes will be sent (or some might be skipped -- e.g., due to too many notifications that CB needs to send during a certain period of time), in any particular order?
etc...
Thanks!
Answering bullet by bullet:
In general, if the client receives a 2xx response (inside of the response payload in the case of NGSIv1, HTTP response code in the case of NGSIv2) it can assume that the update has been persisted in context database, so subsequent queries will return that data (except in the case of running CB with -writeConcern 0 if the DB fails before the update can be persisted from DB memory to disk).
In order to keep things simpler, CB uses a "fire and forget" notification policy. However, CB can be combined with HTTP relaying software (e.g. Rush, event buses, etc.) in order to implement retries, etc.
Similar to case 1, if the client receives a 2xx response (inside of the response payload in the case of NGSIv1, HTTP response code in the case of NGSIv2) it can assume that the update has been persisted in context database (except in the case of running CB with -writeConcern 0 if the DB fails before the update can be persisted from DB memory to disk), so notifications of such data (due to either existing subscriptions or new ones) will use the new value.
All notifications will be sent as long as thread saturation (in the case of -notificationMode transient) or queue saturation (-notification threadpool:q:n) don't occur. You can find more information about notification modes in Orion documentation.

Zabbix trigger to detect no data

I need trigger able to detect that polled Zabbix agent items does not returns data.
For zabbix trapper items this functionality is covered by nodata() function (Heartbeat lost detection in Zabbix documentation) but I need similar functionality supported for Zabbix agent items.
For example, a have defined Zabbix agent UserParameter:
UserParameter=custom.mssqlping,/usr/local/scripts/mssqlping.sh.
The script mssqlping.sh returns 0/1. I need to cover situation when mssqlping.sh script is broken and returns empy string, which is not stored in zabbix because it is not number.
How to detect that periodically polled item data are no longer coming?
It is not that it's not stored that creates the problem but the fact that it is not being considered as a valid item anymore so you can't trigger anything out of it. There is a plenty of related bug reports related to it. AFAIk your options:
Adjust the script to return a numeric value in case of errors
Use 2.2's "internal events" to detect the "becomes unsupported" event
Make and external script that will query the database directly and will notify you on its own or triggering a condition through zabbix's trappers
Or the option here is to trigger based on nodata()
from: https://www.zabbix.com/forum/zabbix-help/41652-zabbix-trigger-timeout?p=245422#post245422
{myserver:example.iregexp("/string/",1m)}=1 AND {myserver:example.nodata(1m)}=0
some more reading: https://zabbix.org/wiki/Trigger_examples

Databinding issue about updating data issue between MySQL database and my devexpress Gauge value?

Background:
Developing a trading system which subscribe to many events which are sent by API of Interactive Brokers. One interesting event is about my trading account value which fluctuates during trading hour so I would prefer to see the information with accountvalueupdate event immediately. I develop this one based on ActiveX api and c# in Visual Studio 2010.
the presentation I wanna check this information is to use a gauge developed by(http://www.devexpress.com/Products/NET/Controls/WinForms/Gauges/). This gauge looks fancy but the principle should be similar to the normal gauge we use in Visual Studio. It seems like I could only update the value of the gauge by databinding since I tried to assign updated account value to this.myGauge.value and failed.
I build up MySql connection between MySql and VS2010. I create only one table in MySQL which is called account. For the sake of simplicity, i only have two column(accountID and accountValue) and one row|(which means when event comes with new accountValue, I just overwrite the value of accountValue last session then the number of row is always one. really simple idea.....).In that Gauge proporties I found databinng option and I setted up by using advanced option to navigate throw available table and bind it to the only useful column accountValue.
Issue:
I set up the default value of the accountValue as 500 as default for test. I build my software. The gauge shows 500 correctly.
Of course, my real account value is not 500, so Now I click one button to connect to API and start listening the event. After few seconds, event arrives since I opened on Console for managing the mysql table and use select * from account to continuously watch the update. I noticed the value of accountValue column(TABLE WORKS RIGHT AND WE ONLY HAVE ONE ROW, OEVERWRITTING MODE) becomes the right one, for example, 35000.
HOWEVER, THE GAUGE DOES NOT CHANGE AT ALL...!! Now If i closed my software and build again, the gauge shows the right value 35000. Now I shut down the api and no coming event and only use commandline of mysql to change the value of accountValue again to 500. NO UPDATING in gauge as well.
It looks like the gauge only read the value of table during the build session or when it starts and never listen to the update of binding databases.
By the way, I tried to set up the biding data mode to either "onValidation" or "onPropertieschanged" but it does not solve although the "onPropertieschanged" looks the right one....
I tried to assign updated account value to this.myGauge.value...
Unfortunately, the information you provided doesn't allow to clearly diagnose this problem. There is no the Value property neither in WinForms GaugeControl nor in CircularGauge (as soon as in Linear/Digital/StateIndicator gauge), but only in ASPxGaugeControl (ASPxGaugeControl.Value). So, please provide a full sample code that doesnot work on your side.
All these properties can be changed manually in code or data-bound to data sources using the standard .NET data-binding mechanism:
The ArcScaleComponent.DataBindings property allows you to data-bind
to the current value of a circular gauge's scale (ArcScale.Value).
The LinearScaleComponent.DataBindings property allows you to
data-bind to the current value of a linear gauge's scale
(LinearScale.Value).
The DigitalGauge.DataBindings property allows you to data-bind to the
text displayed by a digital gauge.
The StateIndicatorComponent.DataBindings property allows you to
data-bind to a state of a state indicator gauge.
Please, review the following articles for more details: Data Binding.
The databinding feature is demonstrated in the Gauge's Main Demo project (the DataBinding module):
this.arcScaleComponent2.DataBindings.Add(
new System.Windows.Forms.Binding("Value", this.productsBindingSource,
"UnitsOnOrder", true, System.Windows.Forms.DataSourceUpdateMode.Never));
P.S. Please use the DevExpress Support Center to ask a questions or report issues, because there is no guarantee of DX involvement when you use the communities, newsgroups or other communication channels.