Wiki » Historique » Version 9
Patrice Nadeau, 2014-09-14 11:16
| 1 | 1 | Patrice Nadeau | %{font-size:18pt}check_domain_expiration% |
|---|---|---|---|
| 2 | |||
| 3 | 3 | Patrice Nadeau | Vérifie la date d'expiration d'un domaine internet. |
| 4 | |||
| 5 | 1 | Patrice Nadeau | --- |
| 6 | |||
| 7 | {{toc}} |
||
| 8 | |||
| 9 | h1. Explications |
||
| 10 | 3 | Patrice Nadeau | |
| 11 | Ce script _Bash_ vérifie la date d'expiration d'un domaine internet. |
||
| 12 | Les TLD(Top Level Domain) suivants sont reconnus : |
||
| 13 | * biz |
||
| 14 | * ca |
||
| 15 | * co |
||
| 16 | * com |
||
| 17 | * edu |
||
| 18 | * info |
||
| 19 | * me |
||
| 20 | * mobi |
||
| 21 | * net |
||
| 22 | * org |
||
| 23 | * tv |
||
| 24 | * us |
||
| 25 | * xxx |
||
| 26 | 1 | Patrice Nadeau | |
| 27 | 5 | Patrice Nadeau | h1. Installation |
| 28 | 4 | Patrice Nadeau | |
| 29 | Je prends pour acquis une installation sous openSUSE. |
||
| 30 | |||
| 31 | Installer le programme _whois_ (si il n'est pas deja installer) |
||
| 32 | <pre><code class="bash"> |
||
| 33 | # Verify if installed |
||
| 34 | rpm -qa | grep whois |
||
| 35 | # Install |
||
| 36 | zypper install whois |
||
| 37 | </code></pre> |
||
| 38 | |||
| 39 | Copier le fichier dans _/usr/lib/nagios/plugins_ |
||
| 40 | |||
| 41 | Rendre le fichier exécutable |
||
| 42 | <pre><code class="bash"> |
||
| 43 | chmod +x /usr/lib/nagios/plugins/check_domain_expiration.sh |
||
| 44 | 1 | Patrice Nadeau | </code></pre> |
| 45 | 5 | Patrice Nadeau | |
| 46 | h1. Utilisation |
||
| 47 | |||
| 48 | h2. Fichier de commandes |
||
| 49 | |||
| 50 | Ajouter au fichier _/etc/nagios/objects/commands.cfg_ : |
||
| 51 | <pre><code class="bash"> |
||
| 52 | 6 | Patrice Nadeau | # Check an internet domain expiration date |
| 53 | define command{ |
||
| 54 | command_name check_domain_expiration |
||
| 55 | command_line $USER1$/check_domain_expiration.sh $HOSTADDRESS$ $ARG1$ $ARG2$ |
||
| 56 | } |
||
| 57 | 5 | Patrice Nadeau | </code></pre> |
| 58 | |||
| 59 | h2. Fichier de domaines |
||
| 60 | |||
| 61 | Créer le fichier _/etc/nagios/objects/domains.cfg_ : |
||
| 62 | <pre><code class="bash"> |
||
| 63 | 7 | Patrice Nadeau | ############################################################################### |
| 64 | # Domains.cfg |
||
| 65 | # |
||
| 66 | 8 | Patrice Nadeau | # Last Modified: 2014-09-08 |
| 67 | 7 | Patrice Nadeau | # |
| 68 | ############################################################################### |
||
| 69 | 5 | Patrice Nadeau | |
| 70 | 7 | Patrice Nadeau | define host{ |
| 71 | use linux-server |
||
| 72 | host_name slpn |
||
| 73 | alias SLPN |
||
| 74 | address slpn.net |
||
| 75 | 8 | Patrice Nadeau | notification_period 24x7 |
| 76 | icon_image internet.gif |
||
| 77 | 7 | Patrice Nadeau | } |
| 78 | |||
| 79 | |||
| 80 | define hostgroup{ |
||
| 81 | 8 | Patrice Nadeau | hostgroup_name internet-domains |
| 82 | alias Internet domains |
||
| 83 | members slpn |
||
| 84 | 7 | Patrice Nadeau | } |
| 85 | |||
| 86 | |||
| 87 | # Define a service to check the load on the local machine. |
||
| 88 | |||
| 89 | define service{ |
||
| 90 | use local-service |
||
| 91 | 8 | Patrice Nadeau | hostgroup_name internet-domains |
| 92 | 7 | Patrice Nadeau | service_description Expiration |
| 93 | 8 | Patrice Nadeau | check_command check_domain_expiration!30!15 |
| 94 | 7 | Patrice Nadeau | } |
| 95 | 1 | Patrice Nadeau | </code></pre> |
| 96 | 5 | Patrice Nadeau | |
| 97 | 9 | Patrice Nadeau | h2. Configuration globale |
| 98 | |||
| 99 | Ajouter au fichier _/etc/nagios/nagios.cfg_ : |
||
| 100 | <pre><code class="bash"> |
||
| 101 | |||
| 102 | </code></pre> |