Alert for reading Physical and Swap memory after the last update has stopped working

Hi support,

We have an alert to be warned when the Physical Memory of our device is greater 95% and when the Swap Memory is greater than 20%.

This alert was working perfectly. Today we have noticed that our device that satisfy the above mention criteria do not much the alert.

Please assist. We are waiting for your response.

hi,

mempool.mempool_perc is a value
i would remove “%” in beginning

Hi,

We have tested the alert with and without the “%” and none of our devices match the alert.

KR,

i would group swap stuff, to be easier to read and also prevent an logical error there
after fhat you can rebuild your query …

device up
AND
Swap with value
AND
physical with value

much easier to read, values are more clearly associated

and in value fields please only values :slight_smile:

Hi,

What is the logical error here? All conditions are connected with an ‘AND’.

Find the SQL query below for better understanding.

macros.device_up = 1 AND (mempools.mempool_descr LIKE ‘%Swap%’ AND mempools.mempool_perc >= 20 AND (mempools.mempool_descr LIKE ‘%Physical%’ AND mempools.mempool_perc > 92))

Hi,

I’ve got your point.
I have updated the alert. Find below the relevant query.

macros.device_up = 1 AND (mempools.mempool_descr LIKE ‘%Swap%’ AND mempools.mempool_perc > 20) AND (mempools.mempool_descr LIKE ‘%Physical%’ AND mempools.mempool_perc > 96)

hoping it solves the problem :slight_smile:

Hi,

Unfortunately, the issue has not been resolved.

change Interval to a Number different from 0
maybe delay too

The intervals have been set to 0 for troubleshooting reasons.
As i said before the alerts were working normally before the update.

After the update the devices do not even match the alert. Is there anything that we have to change/check after the last update?

not sure if 0 even works, as i know is 1 (1minute) the working minimum

is the device you check with, detected as up?
are the percentale useages of swap and physical reached?

Yes the devices are satisfying all the conditions of the alert but no alert is triggered.

could you print a screenshot of the now configured Alert Rule?

i tried it directly in SQL
Problem is you check in a key/value table
columna=%mempool_descr1% and columna=%mempool_descr2%
that’s a case which will never catch.
Even Grouping doesn’t solve it.

Don’t know at moment how to solve what you need to check

Probably the only workaround for now is two rules or the advanced query.

Because you can’t select two items in the same table.
It just ends up where mempools.mempool_descr = Swap AND Physical which is always false.

Keep in mind you are actually trying to select TWO different rows in the database. The only way to do what you want is a sub-select.

Another, workaround should be if the remaining Physical memory (unused) is queried and the used memory Swap instead of used Physical and used Swap? Or again we end up with a wrong query?

Can you provide a sample of a query?

it will end up also in an always false …
when creating an Alert Rule you create a SQL Query. This Query checks for matching row’s.
If a row matches it gives an Alert.

for better understanding, a look into database table:
MariaDB [librenms]> select device_id, mempool_descr, mempool_used, mempool_free from mempools where device_id = 2;
±----------±----------------±-------------±-------------+
| device_id | mempool_descr | mempool_used | mempool_free |
±----------±----------------±-------------±-------------+
| 2 | Physical memory | 33359335424 | 392658944 |
| 2 | Virtual memory | 36316729344 | 7434481664 |
| 2 | Swap space | 2957393920 | 7041822720 |
±----------±----------------±-------------±-------------+

as you see Physical and Swap are different columns
so you have two row’s which have to match at same time for getting an alert

Hi,

Thanks for your response. I understand what you are trying to say but as far as i know there is no limitation in queering two rows at the same time.

Moreover, we have performed some other combinations like the below and there is no match again at all.

SELECT * FROM devices,mempools WHERE (devices.device_id = ? AND devices.device_id = mempools.device_id) AND (devices.status = 1 && (devices.disabled = 0 && devices.ignore = 0)) = 1 AND (mempools.mempool_perc > 96 AND mempools.mempool_descr LIKE ‘%Physical%’) AND (mempools.mempool_type LIKE ‘%hrstorage%’ AND mempools.mempool_index = 10 AND mempools.mempool_used > 1000000000)

have you tried to recheck this query in database itself?
on test and productivsystem i have no mempool row combination which matches this query.