Librement-Vôtre - SystèmeCe blog est un mémo, une plateforme de dialogue, de débats autour de l'informatique, du libre (ou pas !). Partager, échanger. Soyez librement vous même.
Soyez les bienvenues sur Librement-Vôtre.2023-09-08T20:32:37+02:00Mickaelurn:md5:30c4556f4141a32660a5236eb5ad4accDotclearModification du script perl de Zabbix pour les traps SNMPurn:md5:eff2210a314327ccb772cd2ff4c296222013-08-02T13:45:00+02:002013-08-19T17:31:18+02:00MickaëlSystème J'ai eu besoin de traduire certaines partie hexadécimales de traps avant qu'elles soient envoyés à Zabbix. Du coup j'ai rajouté quelques lignes qui traduisent les "Hex-STRING" en utf8.<br /><br />Le fichier est joint au billet, voici le code (lignes modifiés de 99 à 105).<br /><br />#!/usr/bin/perl<br /><br />#<br /># Zabbix<br /># Copyright (C) 2001-2013 Zabbix SIA<br />#<br /># This program is free software; you can redistribute it and/or modify<br /># it under the terms of the GNU General Public License as published by<br /># the Free Software Foundation; either version 2 of the License, or<br /># (at your option) any later version.<br />#<br /># This program is distributed in the hope that it will be useful,<br /># but WITHOUT ANY WARRANTY; without even the implied warranty of<br /># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br /># GNU General Public License for more details.<br />#<br /># You should have received a copy of the GNU General Public License<br /># along with this program; if not, write to the Free Software<br /># Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.<br />#<br /><br />#########################################<br />#### ABOUT ZABBIX SNMP TRAP RECEIVER ####<br />#########################################<br /><br /># This is an embedded perl SNMP trapper receiver designed for sending data to the server.<br /># The receiver will pass the received SNMP traps to Zabbix server or proxy running on the<br /># same machine. Please configure the server/proxy accordingly.<br />#<br /># Read more about using embedded perl with Net-SNMP:<br /># http://net-snmp.sourceforge.net/wiki/index.php/Tut:Extending_snmpd_using_perl<br /><br />#################################################<br />#### ZABBIX SNMP TRAP RECEIVER CONFIGURATION ####<br />#################################################<br /><br />### Option: SNMPTrapperFile<br /># Temporary file used for passing data to the server (or proxy). Must be the same<br /># as in the server (or proxy) configuration file.<br />#<br /># Mandatory: yes<br /># Default:<br />$SNMPTrapperFile = '/var/log/zabbix/zabbix.snmp.trap.log';<br /><br />### Option: DateTimeFormat<br /># The date time format in strftime() format. Please make sure to have a corresponding<br /># log time format for the SNMP trap items.<br />#<br /># Mandatory: yes<br /># Default:<br />$DateTimeFormat = '%H:%M:%S %Y/%m/%d';<br /><br />###################################<br />#### ZABBIX SNMP TRAP RECEIVER ####<br />###################################<br /><br />use Fcntl qw(O_WRONLY O_APPEND O_CREAT);<br />use POSIX qw(strftime);<br /><br />sub zabbix_receiver<br />{<br /> my (%pdu_info) = %{$_[0]};<br /> my (@varbinds) = @{$_[1]};<br /><br /> # open the output file<br /> unless (sysopen(OUTPUT_FILE, $SNMPTrapperFile, O_WRONLY|O_APPEND|O_CREAT, 0666))<br /> {<br /> print STDERR "Cannot open [$SNMPTrapperFile]: $!\n";<br /> return NETSNMPTRAPD_HANDLER_FAIL;<br /> }<br /><br /> # get the host name<br /> my $hostname = $pdu_info{'receivedfrom'} || 'unknown';<br /> if ($hostname ne 'unknown') {<br /> $hostname =~ /\[(.*?)\].*/; # format: "UDP: [127.0.0.1]:41070->[127.0.0.1]"<br /> $hostname = $1 || 'unknown';<br /> }<br /><br /> # print trap header<br /> # timestamp must be placed at the beggining of the first line (can be omitted)<br /> # the first line must include the header "ZBXTRAP [IP/DNS address] "<br /> # * IP/DNS address is the used to find the corresponding SNMP trap items<br /> # * this header will be cut during processing (will not appear in the item value)<br /> printf OUTPUT_FILE "%s ZBXTRAP %s\n", strftime($DateTimeFormat, localtime), $hostname;<br /><br /> # print the PDU info<br /> print OUTPUT_FILE "PDU INFO:\n";<br /> foreach my $key(keys(%pdu_info))<br /> {<br /> printf OUTPUT_FILE " %-30s %s\n", $key, $pdu_info{$key};<br /> }<br /><br /><br /> binmode OUTPUT_FILE, ':encoding(UTF-8)';<br /> # print the variable bindings:<br /> print OUTPUT_FILE "VARBINDS:\n";<br /> foreach my $x (@varbinds)<br /> {<br /> if ( $x->[1] =~ /Hex-STRING/ ) { #detect Hex-STRING<br /> $x->[1] =~ s/\R//g; #delete carriage return<br /> $x->[1] =~ s/Hex-STRING://g; #delete word<br /> $x->[1] =~ tr/ //d; #delete spaces<br /> $x->[1] = pack "H*",$x->[1] ; #convert to asciii<br /> $x->[1]= "Hex-STRING: ".$x->[1];<br /> }<br /> printf OUTPUT_FILE " %-30s type=%-2d value=%s\n", $x->[0], $x->[2], $x->[1];<br /> }<br /><br /> close (OUTPUT_FILE);<br /><br /> return NETSNMPTRAPD_HANDLER_OK;<br />}<br /><br />NetSNMP::TrapReceiver::register("all", \&zabbix_receiver) or<br /> die "failed to register Zabbix SNMP trap receiver\n";<br /><br />print STDOUT "Loaded Zabbix SNMP trap receiver\n";<br /><br />Test de Windows 8urn:md5:514cb1f279b60e07ed3b88dd960346822012-11-14T12:22:00+01:002013-08-02T12:38:18+02:00MickaëlSystème <p>Test basique et rapide.</p>
<p>Pour info, j'ai effectué le test sur une VM de VMware.<br />
Caractéristiques techniques :</p>
<ul>
<li>2Go de Ram</li>
<li>32Mo de Carte graphique (Pour Seven 8Mo suffisent)</li>
<li>VMware Tools installés</li>
</ul>
<h2>Installation</h2>
<p>Pas de grande nouveautés sur l'installation. Tout est assez identique à Windows 7.<br /></p>
<p><a href="https://www.librement-votre.fr/dotclear/public/tests/windows8-certains-points.PNG" title="windows8-certains-points.PNG"><img src="https://www.librement-votre.fr/dotclear/public/tests/.windows8-certains-points_m.jpg" alt="windows8-certains-points.PNG" title="windows8-certains-points.PNG, nov. 2012" /></a></p>
<h2>Premières impressions</h2>
<p>Criard et lent. Pour la partie criard, je pense à priori que le design doit pouvoir se changer assez simplement. Mais pour la lenteur (plus lent que Vista, c'est dire !)...affaire à suivre.<br />
Après un redémarrage, je le vois limite se figer. Le gestionnaire des tâches indique un processus installant des Modules Microsoft. Pourquoi pas ? Mais un petit avertissement serait agréable "Votre ordinateur s'optimise" ou quelque chose de proche.</p>
<h2>Accueil</h2>
<p>Je me retrouve avec les fameuses tuiles. Ben mince alors ! J'ai un écran full HD et je me retrouve avec les plaques énormes où seules quelques applications apparaissent.<br /></p>
<p><a href="https://www.librement-votre.fr/dotclear/public/tests/accueil.PNG" title="accueil.PNG"><img src="https://www.librement-votre.fr/dotclear/public/tests/.accueil_m.jpg" alt="accueil.PNG" title="accueil.PNG, nov. 2012" /></a></p>
<p>Bon alors, pas de bol. Météo je m'en foue, CAC40 de même. Photos de même... Bref beaucoup de choses à personnaliser. <br />
Je reste assez partager : pour les professionnels, les jeux, la musique, la caméra et les photos ne servent pas. Pour un particulier, CAC40, contacts, calendrier.... Je ne vois pas trop l'utilité.
L'honneur est sauf : le bureau !</p>
<h2>Bureau</h2>
<p>Et mince ! Là où j'attendais un véritable changement... Le coin à droite est actif (Petit clin d’œil à l'interface Unity d'Ubuntu ?). Coin actif, loin d'être réactif... Mais non, non : il faut descendre la souris sur le milieu de l'écran pour arriver aux premières icônes...</p>
<p>Le gestionnaire de tâches est vraiment, mais vraiment mieux foutu : Il y a bien plus de détails.</p>
<p><a href="https://www.librement-votre.fr/dotclear/public/tests/gestionnaire_de_taches.PNG" title="gestionnaire_de_taches.PNG"><img src="https://www.librement-votre.fr/dotclear/public/tests/.gestionnaire_de_taches_m.jpg" alt="gestionnaire_de_taches.PNG" title="gestionnaire_de_taches.PNG, nov. 2012" /></a></p>
<h2>Bref</h2>
<p>C'est neuf, c'est pas bien beau, loin d'être rapide. A la fin de l'installation, j'ai déjà 550Mo de Mises à jour à installer. La prise en main pour un pc semble laborieuse (je ne parle pas des tablettes). Les nouveautés dans l'interface ne simplifient pas trop l'usage (grand parcours de souris, rajout de clic). On bouleverse l'utilisateur sans vraiment lui apporter quelque chose de pratique. Déçu.</p>