Alerte mail sur l’arrêt de l’agent SQL Server

L’arrêt de l’agent SQL Server est extrêmement critique. Sans agent, les jobs n’exécutent pas les plans de maintenance et surtout les sauvegardes planifiées. Windows Server propose d’associer une tâche à un événement consigné dans le journal d’événements.

Afin de créer une alerte mail à chaque arrêt de l’agent SQL Server, je vais me servir de la commande  mailsend, que j’utilise depuis de nombreuses années maintenant.

Mise en place de mailsend

Après avoir décompressé le programme mailsend, je renomme l’exécutable en mailsend.exe et je le copie dans c:\windows\system32.

Syntaxe de mailsend

L’aide de la commande mailsend peut être obtenue, en tapant à partir de l’interpréteur de commandes Windows, mailsend -h :

 Version: @(#) mailsend v1.19

 Copyright: BSD. It is illegal to use this software for Spamming

 (Compiled with OpenSSL version: OpenSSL 1.0.2h  3 May 2016)
 usage: mailsend [options]
 Where the options are:
  -copyright            - show copyright information
  -4                    - Force to use IPv4 address of SMTP server
  -6                    - Force to use IPv6 address of SMTP server
  -smtp hostname/IP*    - Hostname/IP address of the SMTP server
  -port SMTP port       - SMTP port
  -domain    domain     - domain name for SMTP HELO/EHLO
  -t    to,to..*        - email address/es of the recipient/s
  -cc   cc,cc..         - carbon copy address/es
  +cc                   - do not ask for Carbon Copy
  -ct   seconds         - Connect timeout. Default is 5 seconds
  -read-timeout seconds - Read timeout. Default is 5 seconds
  -bc   bcc,bcc..       - blind carbon copy address/es
  +bc                   - do not ask for Blind carbon copy
  +D                    - do not add Date header
  -f    address*        - email address of the sender
  -sub  subject         - subject
  -list_address file    - a file containing a list of email addresses
  -log file             - write log messages to this file
  -cs   character set   - for text/plain attachments (default is us-ascii)
  -separator character  - separator used with -attach. Default is comma (,)
                          If used must be specified before -attach
  -enc-type type        - encoding type. base64, 8bit, 7bit etc.
                          Default is base64. Special type is "none"
  -aname name           - name of the attachment. Default is filename
  -content-id id        - content-id in the attachment
  -mime-type type       - MIME type
  -dispostion val       - "attachment" or "inline". Default is "attachment"
  -attach file,mime_type,[i/a] (i=inline,a=attachment)
                        - attach this file as attachment or inline
  -show-attach          - show attachment in verbose mode, default is no
  -show-mime-types      - show the compiled in MIME types
  -M    "one line msg"  - attach this one line text message
  -content-type type    - Content type. Default: multipart/mixed
  -msg-body path        - Path of the file to include as body of mail
  -embed-image image    - Path of image to embed in HTML
  -H    "header"        - Add custom Header
  -name "Full Name"     - add name in the From header
  -v                    - verbose mode
  -V                    - show version info
  -w                    - wait for a CR after sending the mail
  -rt  email_address    - add Reply-To header
  -rrr email_address    - request read receipts to this address
  -rp                   - return-path address
  -ssl                  - SMTP over SSL
  -starttls             - use STARTTLS if the server supports it
  -auth                 - try CRAM-MD5,LOGIN,PLAIN in that order
  -auth-cram-md5        - use AUTH CRAM-MD5 authentication
  -auth-plain           - use AUTH PLAIN authentication
  -auth-login           - use AUTH LOGIN authentication
  -user username        - username for ESMTP authentication
  -pass password        - password for ESMTP authentication
  -example              - show examples
  -ehlo                 - force EHLO
  -info                 - show SMTP server information
  -help                 - shows this help
  -q                    - quiet

 The options with * must be specified
 Environment variables:
  SMTP_USER_PASS for plain text password (-pass)
Exemple d’utilisation de mailsend

L’utilisation de mailsend se fait comme suit :

mailsend -smtp mail.gmail.com -t dszalkowski@gmail.com -f dszalkowski@gmail.com  -auth -starttls -user "dszalkowski" -pass "mon_mot_de_passe" -sub "Objet / Test" -M "Message / Test"

Création d’une alerte événementielle

A partir du journal d’application, faites un clic droit sur l’événement relatif à l’arrêt de l’agent SQL Server.

Observateur d'événements > Joindre une tâche à cet événement

Donnez un nom à la tâche.

Assistant Créer une tâche de base > Créer une tâche de base

L’assistant rappelle l’événement qui sera enregistré.

Assistant Créer une tâche de base >A l'enregistrement de l'événement

Vous devez choisir de démarrer un programme. Les autres méthodes sont obsolètes.

Assistant Créer une tâche de base >Action > Démarrer un programme

Indiquez le chemin vers le programme mailsend.exe, en ajoutant tous les arguments de la commande dans Ajouter des arguments (facultatif).

Assistant Créer une tâche de base >Démarrer un programme > Programme/script

Pour modifier la tâche nouvellement créée, vous devez exécuter le planificateur de tâches de Windows, taskschd.msc.

  Planificateur de tâches > Tâches de l'Observateur d'événements > Propriétés

Dans les propriétés de la tâche, choisissez et cochez :

Propriéts > Exécuter même si l'utilisateur n'est pas connecté / Exécuter avec les autorisations maximales

Base de données /

deneme bonusu veren siteler casino siteleri betdenemebonusu.com bahis siteleri Ev eşyası depolama Depolama Şehirlerarası evden eve nakliyat Evden eve nakliyat Eşya depolama yurtdışına ev taşıma Türkiye'den Almanya'ya ev taşıma zati eşya tasimaciligi uluslararasi zati eşya tasimaciligi eşya depolama şehirler arası nakliyat asansörlü nakliyat greatplay.net güvenilir online bahis siteler 2022 jetbahis Rexbet hovarda mobilbahis güncel adres sartsız Deneme Bonus sekabet maltcasino güncel adres> pinbahis100.com betduman.com olabahis.top سایت شرط بندی shartkade.com 1xbet-mobil.com beykoz evden eve nakliyat ataşehir evden eve nakliyat şişli evden eve nakliyat istanbul evden eve nakliyat
teens porn videos free sex xxx sexy videos