Configureer geavanceerde notificatie-integraties voor Nagios of Zabbix
description
Met deze prompt kan de gebruiker efficiënte en geautomatiseerde notificatiekanalen opzetten die verder gaan dan standaard e-mail of SMS. Dit verbetert de reactietijd bij netwerkproblemen en centraliseert meldingen in moderne communicatieplatforms, wat zorgt voor betere samenwerking en snelle incidentafhandeling. Het is een unieke benadering die niet overlapt met bestaande prompts over escalatie of meldingsbeleid, maar juist focust op integratie en automatisering.
prompt
Help me bij het configureren van geavanceerde notificatie-integraties voor mijn netwerkmonitoring met <Kies je monitoring tool>. Mijn huidige notificatiekanalen zijn: <voer de huidige notificatiekanalen in zoals e-mail, SMS, Slack>. Ik wil in ...
try_prompt
generate_helper
disclaimerOnPageApi
tags
ai_answers
provider: openai
model: gpt-4.1-nano
Natuurlijk! Hier is een overzicht van hoe je geavanceerde notificatie-integraties met Microsoft Teams en PagerDuty kunt opzetten en automatiseren in Nagios:
1. Integratie met Microsoft Teams:
a. Maak een inkomende webhook in Microsoft Teams:
- Ga naar het kanaal waar je meldingen wilt ontvangen.
- Klik op de drie puntjes (…) naast de kanaalnaam en kies "Connector".
- Selecteer "Inkomende Webhook" en configureer de naam en icon.
- Kopieer de gegenereerde webhook-URL.
b. Maak een Nagios-script of gebruik een bestaande tool om meldingen via deze webhook te sturen:
- Bijvoorbeeld een Python- of Bash-script dat de statusgegevens ontvangt en een POST-verzoek naar de Teams-webhook stuurt.
- Plaats dit script in de Nagios notifiy-configuratie voor de gewenste meldingen.
c. Automatiseer het proces:
- Pas de Nagios notificatie commands aan zodat ze het script aanroepen bij bepaalde events.
- Test de integratie door een testmelding te sturen.
2. Integratie met PagerDuty:
a. Maak een PagerDuty service aan:
- Log in op PagerDuty en creëer een nieuwe service.
- Voeg een API-integratie toe en verkrijg de API-key.
b. Configureer Nagios voor PagerDuty:
- Gebruik de PagerDuty API om incidenten te triggeren.
- Er bestaan reeds scripts en plugins (bijvoorbeeld `pagerduty-contact`) die je kunt gebruiken.
- Plaats het script en configureer je Nagios-notificaties om dit script aan te roepen bij kritieke meldingen.
c. Automatisering en optimalisatie:
- Stel escalaties en escalatietijdlijnen in binnen PagerDuty.
- Gebruik filters en condities in Nagios om alleen relevante meldingen door te sturen.
- Test de volledige flow door een testincident te triggeren en te controleren of PagerDuty correct wordt bijgewerkt.
3. Verbeteringen voor reactietijd en centralisatie:
- Bouw dashboards in Microsoft Teams met meldingen en statusupdates via tabbladen of bots.
- Gebruik PagerDuty's mobiele app en integraties om snel te reageren.
- Automatiseer herhaalde notificaties en escalaties.
- Documenteer procedures en maak gebruik van automatische escalaties om incidenten snel af te handelen.
Door deze integraties goed te configureren en te automatiseren, centraliseer je je netwerkmeldingen, versnel je de reactietijd en verbeter je het beheer van incidenten.
provider: deepseek
model: deepseek-chat
Je comprends que vous souhaitez améliorer votre configuration Nagios existante pour optimiser vos notifications. Bien que vos canaux actuels et souhaités soient identiques (email et SMS), je vais vous détailler comment configurer et automatiser ces intégrations pour une gestion plus efficace.
### Configuration Avancée des Notifications Nagios
#### 1. **Configuration des Commandes de Notification**
**Email :**
```bash
# Fichier : /usr/local/nagios/etc/objects/commands.cfg
define command {
command_name notify-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
```
**SMS (via API ou Gateway SMS) :**
```bash
define command {
command_name notify-by-sms
command_line /usr/local/nagios/libexec/sendsms $CONTACTPAGER$ "$HOSTNAME$: $HOSTSTATE$ - $SHORTDATETIME$"
}
```
#### 2. **Script d'Envoi SMS Personnalisé**
Créez un script `/usr/local/nagios/libexec/sendsms` :
```bash
#!/bin/bash
NUMERO=$1
MESSAGE=$2
# Exemple avec l'API Twilio
curl -X POST "https://api.twilio.com/2010-04-01/Accounts/$ACCOUNT_SID/Messages.json" \
--data-urlencode "Body=$MESSAGE" \
--data-urlencode "From=$VOTRE_NUMERO" \
--data-urlencode "To=$NUMERO" \
-u "$ACCOUNT_SID:$AUTH_TOKEN"
```
#### 3. **Configuration des Contacts et Escalades**
```bash
# Fichier : /usr/local/nagios/etc/objects/contacts.cfg
define contact {
contact_name admin
alias Administrateur Réseau
email admin@votre-entreprise.com
pager +33123456789 # Pour SMS
service_notification_commands notify-by-email,notify-by-sms
host_notification_commands notify-by-email,notify-by-sms
}
define contactgroup {
contactgroup_name admins-reseau
alias Administrateurs Réseau
members admin
}
```
#### 4. **Escalades d'Alerte Automatisées**
```bash
define serviceescalation {
host_name serveur-important
service_description PING
first_notification 3
last_notification 0
notification_interval 10
contact_groups admins-reseau
}
```
### Automatisation et Centralisation
#### 1. **Hiérarchisation des Alertes**
- **Niveau 1** (Critique) : SMS immédiat + email
- **Niveau 2** (Avertissement) : Email uniquement
- **Configurable via les templates de services**
#### 2. **Gestion des Périodes de Notification**
```bash
define timeperiod {
timeperiod_name 24x7
alias 24 Heures / 7 Jours
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}
```
#### 3. **Intégration avec Outils de Centralisation**
- **Considérer Nagios XI** pour une interface web centralisée
- **Intégrer avec Slack/Teams** pour compléter email/SMS
- **Utiliser Nagios Fusion** pour multi-sites
### Bonnes Pratiques pour Améliorer le Temps de Réponse
1. **Notifications Différenciées** :
- SMS pour les alertes critiques (HOST DOWN)
- Email pour les avertissements et récupérations
2. **Configurer les Escalades** :
```bash
define hostescalation {
host_name routeur-principal
first_notification 1
last_notification 0
notification_interval 5
contact_groups admins-reseau
}
```
3. **Automatisation des Actions Correctives** :
- Commandes événementielles pour redémarrage automatique
- Scripts de correction intégrés aux notifications
### Validation de la Configuration
Après modifications :
```bash
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
sudo systemctl restart nagios
```
### Surveillance des Notifications
- Vérifiez les logs : `/usr/local/nagios/var/nagios.log`
- Testez avec : `./submit_check_result hostname "Service Name" 2 "Message test"`
Cette configuration vous permettra d'optimiser votre temps de réponse tout en centralisant la gestion des alertes selon vos besoins actuels.
error: Generation failed [deepseek] prompt_id=4759 locale=nl err=DeepSeek connection/timeout | Generation failed [deepseek] prompt_id=4759 locale=en err=DeepSeek connection/timeout | Generation failed [deepseek] prompt_id=4759 locale=de err=DeepSeek connection/timeout | Generation failed [deepseek] prompt_id=4759 locale=zh err=DeepSeek connection/timeout