Postfix alerting

Hi all.

Has anyone here set up altering for postfix?
queue and etc…

Thanks

Hi,

for example like this for deferred email’s

SELECT * FROM devices,applications,application_metrics WHERE (devices.device_id = ? AND devices.device_id = applications.device_id AND applications.app_id = application_metrics.app_id) AND applications.app_type = “postfix” AND application_metrics.metric = “deferredq” AND application_metrics.value >= 100

I will test and revert.

Thank you very much!

app_type is postfix

You need to more specify which one metric do you want for alert, for example like me where i specified deferredq

you can look at metric in mysql with

SELECT * FROM applications,application_metrics WHERE applications.app_type = "postfix";

when you want for queue, than you need specify which one

there is

MariaDB [librenms]> SELECT * FROM applications,application_metrics WHERE applications.app_type = "postfix" AND application_metrics.metric = "deferredq";;
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+-----------+-------+------------+
| app_id | device_id | app_type | app_state | discovered | app_state_prev | app_status | timestamp           | app_instance | app_id | metric    | value | value_prev |
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+-----------+-------+------------+
|      6 |        34 | postfix  | OK        |          1 | UNKNOWN        |            | 2019-05-20 13:03:03 |              |      6 | deferredq |    10 |         11 |
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+-----------+-------+------------+
1 row in set (0.00 sec)

ERROR: No query specified

MariaDB [librenms]> SELECT * FROM applications,application_metrics WHERE applications.app_type = "postfix" AND application_metrics.metric = "holdq";;
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+--------+-------+------------+
| app_id | device_id | app_type | app_state | discovered | app_state_prev | app_status | timestamp           | app_instance | app_id | metric | value | value_prev |
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+--------+-------+------------+
|      6 |        34 | postfix  | OK        |          1 | UNKNOWN        |            | 2019-05-20 13:03:03 |              |      6 | holdq  |     0 |       NULL |
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+--------+-------+------------+
1 row in set (0.00 sec)

ERROR: No query specified

MariaDB [librenms]> SELECT * FROM applications,application_metrics WHERE applications.app_type = "postfix" AND application_metrics.metric = "activeq";;
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+---------+-------+------------+
| app_id | device_id | app_type | app_state | discovered | app_state_prev | app_status | timestamp           | app_instance | app_id | metric  | value | value_prev |
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+---------+-------+------------+
|      6 |        34 | postfix  | OK        |          1 | UNKNOWN        |            | 2019-05-20 13:03:03 |              |      6 | activeq |     0 |          3 |
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+---------+-------+------------+
1 row in set (0.00 sec)

ERROR: No query specified

MariaDB [librenms]> SELECT * FROM applications,application_metrics WHERE applications.app_type = "postfix" AND application_metrics.metric = "incomingq";;
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+-----------+-------+------------+
| app_id | device_id | app_type | app_state | discovered | app_state_prev | app_status | timestamp           | app_instance | app_id | metric    | value | value_prev |
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+-----------+-------+------------+
|      6 |        34 | postfix  | OK        |          1 | UNKNOWN        |            | 2019-05-20 13:03:03 |              |      6 | incomingq |     0 |          1 |
+--------+-----------+----------+-----------+------------+----------------+------------+---------------------+--------------+--------+-----------+-------+------------+
1 row in set (0.00 sec)

ERROR: No query specified

so I want to alert when a certain amount to mails are coming in to my queue

image

as this server is smtp so it should only be sending mail

I edited my last post, check it

ah okay I’m with you.

I’ll be adding