0

Alert before certificate expires

christophe dufour hace 6 años actualizado hace 6 años 5

on version 9.2.1 the certificate have only one alert called "Alarms on expired certificates" which is good as it indicates you have not replaced the certificate in time.


We would need, like the old certificate plugin, an alert that begin to alert a group the certificate will expires in X days and based on certificate status information

Hello,

In order to achieve that, you can use an alert on a saved search. Just search for certificates about to expire in the list, create a saved search, and add an alert on it.

Hi,


thanks for your reply but unfortunatly I do not find how to do it.


I would like to know which certificate referenced in GLPI will expire in the next two month to either ask for a replacement or replace it myself.

All I can do through the search is searching in the past date not in the future date regarding the field "Expiration Date"


Ex of search wanted : 

"Status" is not "Deprecated" (status I created to indicate it is not used anymore)

AND "Expiration Date" is after "Today"

AND "Expiration Date" is before "+ 2 month"


Any idea on how it can be done without changing the source code to authorize future date in the date search ?


I was able to do this with the plugin certificate and that worked for years without any issue, very practical to anticipate the replacement of client and our own certificate.

I should have added I do not know who will receive the result of the saved search , it is a bit unclear on this point as I would need a group to receive it.

Saved searches alerts systems uses standard GLPI notification system. See from alert configuration for the used notification, and just configure it as needed.

hi,


I still do not received email but in the glpi log called php-errors.log I have this issue when I launch the automatic action called savedsearchesalerts (I suppose this is the action that is sending the alerts based on saved search information) : 

From SavedSearch_Alert::cronSavedSearchesAlerts() in /usr/share/glpi/inc/savedsearch_alert.class.php line 381
  RuntimeException Object
  (
      [message:protected] => Unknonw operator '5'
      [string:Exception:private] =>
      [code:protected] => 0
      [file:protected] => /usr/share/glpi/inc/savedsearch_alert.class.php
      [line:protected] => 360
      [trace:Exception:private] => Array
          (
              [0] => Array
                  (
                      [file] => /usr/share/glpi/inc/crontask.class.php
                      [line] => 832
                      [function] => cronSavedSearchesAlerts
                      [class] => SavedSearch_Alert
                      [type] => ::
                      [args] => Array
                          (
                              [0] => CronTask Object
                                  (
                                      [dohistory] => 1
                                      [timer:CronTask:private] => 1523895780.8133
                                      [startlog:CronTask:private] => 10413161
                                      [volume:CronTask:private] => 0
                                      [fields] => Array
                                          (
                                              [id] => 44
                                              [itemtype] => SavedSearch_Alert
                                              [name] => savedsearchesalerts
                                              [frequency] => 86400
                                              [param] =>
                                              [state] => 1
                                              [mode] => 2
                                              [allowmode] => 3
                                              [hourmin] => 0
                                              [hourmax] => 24
                                              [logs_lifetime] => 10
                                              [lastrun] => 2018-04-16 18:22:00
                                              [lastcode] =>
                                              [comment] =>
                                              [date_mod] => 2018-04-16 18:12:18
                                              [date_creation] =>
                                              [ISPLUGIN] => 0
                                          )

                                      [history_blacklist] => Array
                                          (
                                          )

                                      [auto_message_on_action] => 1
                                      [no_form_page] =>
                                      [additional_fields_for_dictionnary] => Array
                                          (
                                          )

                                      [fkfield:protected] =>
                                      [searchopt:protected] =>
                                      [taborientation] => vertical
                                      [get_item_to_display_tab] => 1
                                      [usenotepad:protected] =>
                                      [notificationqueueonaction] =>
                                      [type:protected] => -1
                                      [displaylist:protected] => 1
                                      [showdebug] =>
                                  )

                          )

                  )

              [1] => Array
                  (
                      [file] => /usr/share/glpi/front/crontask.form.php
                      [line] => 49
                      [function] => launch
                      [class] => CronTask
                      [type] => ::
                      [args] => Array
                          (
                              [0] => -1
                              [1] => 1
                              [2] => savedsearchesalerts
                          )

                  )

          )

      [previous:Exception:private] =>
  )


Do you know what means this error ?


I verify all the record in the following tables that should be used for my saved search : 

- Tools>Saved searches : the record has the following properties :

Do Count : Auto

Visibility : Public

Entity : Root Entity

Child entities : Yes

it has a notification used

it has a saved search alert

- for the saved search alert linked to the saved seach, it has the following properties :

Operator : >

Value : 0

Active : Yes

the saved seach information in blue indicate 179 (I suppose this is the number of results

- for the notification used linked to the saved search, it has the following properties :

Active : Yes

Type : Saved search alert

Event : the specific event with the name of my saved search

Child entities : Yes

Recipient : a Group containing 3 users

Templates : one notification template 

I tested the template with and without a new translation, but I got the same error indicated above


Finally, regarding my initial issue, the search engine do not permit to search date in the future (like indicated in the wanted search)

The date can only search for date in the past (like -2 month) but not in the future (like +2 month)