manuales:nagios:capacitacion:mk_livestatus
Diferencias
Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previaÚltima revisiónAmbos lados, revisión siguiente | ||
manuales:nagios:capacitacion:mk_livestatus [2015/10/16 17:53] – cayu | manuales:nagios:capacitacion:mk_livestatus [2016/03/21 18:48] – [Compilación] cayu | ||
---|---|---|---|
Línea 39: | Línea 39: | ||
root@linux# cd mk-livestatus-1.1.2 | root@linux# cd mk-livestatus-1.1.2 | ||
root@linux# | root@linux# | ||
- | root@linux# ./configure | + | root@linux# ./ |
checking for a BSD-compatible install... / | checking for a BSD-compatible install... / | ||
checking whether build environment is sane... yes | checking whether build environment is sane... yes | ||
Línea 157: | Línea 157: | ||
</ | </ | ||
===== Ejemplos ===== | ===== Ejemplos ===== | ||
+ | ==== Python ==== | ||
+ | === livestatus === | ||
<code python> | <code python> | ||
# | # | ||
- | # -*- encoding: utf-8; py-indent-offset: | ||
- | # +------------------------------------------------------------------+ | ||
- | # | ____ _ | ||
- | # | / ___| |__ | ||
- | # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | | ||
- | # | | |___| | | | __/ (__| < | ||
- | # | \____|_| |_|\___|\___|_|\_\___|_| | ||
- | # | | | ||
- | # | Copyright Mathias Kettner 2013 | ||
- | # +------------------------------------------------------------------+ | ||
- | # | ||
- | # This file is part of Check_MK. | ||
- | # The official homepage is at http:// | ||
- | # | ||
- | # check_mk is free software; | ||
- | # under the terms of the GNU General Public License | ||
- | # the Free Software Foundation in version 2. check_mk is distributed | ||
- | # in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
- | # out even the implied warranty of MERCHANTABILITY | ||
- | # PARTICULAR PURPOSE. See the GNU General Public License for more de- | ||
- | # ails. You should have received | ||
- | # License along with GNU Make; see the file COPYING. | ||
- | # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
- | # Boston, MA 02110-1301 USA. | ||
- | |||
import os | import os | ||
import livestatus | import livestatus | ||
try: | try: | ||
- | # omd_root = os.getenv(" | ||
socket_path = " | socket_path = " | ||
except: | except: | ||
- | sys.stderr.write(" | ||
- | sys.stderr.write(" | ||
- | sys.stderr.write(" | ||
sys.exit(1) | sys.exit(1) | ||
Línea 228: | Línea 201: | ||
except Exception, e: # livestatus.MKLivestatusException, | except Exception, e: # livestatus.MKLivestatusException, | ||
print " | print " | ||
+ | </ | ||
+ | === Monitoring:: | ||
+ | API de Perl para acceder a datos Nagios e Icinga por medio de check_mk livestatus | ||
+ | <code perl> | ||
+ | use Monitoring:: | ||
+ | my $ml = Monitoring:: | ||
+ | socket => '/ | ||
+ | ); | ||
+ | my $hosts = $ml-> | ||
+ | </ | ||
+ | == new ([ARGS]) == | ||
+ | Creates an Monitoring:: | ||
+ | Crea el objeto Monitoring:: | ||
+ | ^Argumentos^^ | ||
+ | ^socket|Ruta al socket UNIX de check_mk livestatus| | ||
+ | ^server|Usar este servidor para una conexión TCP| | ||
+ | ^peer|Camino alternativo al socket o servidor, si se usa el valor ':' | ||
+ | ^name|Nombre para la conexión, default dirección socket/ | ||
+ | ^verbose|Modo verbose| | ||
+ | ^line_seperator|Código ascii separador de líneas default 10, (newline)| | ||
+ | ^column_seperator|Código ascii separador de columnas, defaults 0 (null byte)| | ||
+ | ^list_seperator|Código ascii separador de listas, default 44 (comma)| | ||
+ | ^host_service_seperator|Código ascii separador host/ | ||
+ | ^keepalive|keepalive. Default off| | ||
+ | ^errors_are_fatal|Errores con mensaje de caída. Default: on| | ||
+ | ^warnings|muestran advertencias en las consultas sin Columnas| | ||
+ | ^timeout|Tiempo de espera general. Usado para conexión y consultas| | ||
+ | ^query_timeout|set a query timeout. Used for retrieving querys, Default 60sec| | ||
+ | ^connect_timeout|Tiempo de espera de conexión inicial. Por defecto 5 s| | ||
+ | == Limit == | ||
+ | <code perl> | ||
+ | my $array_ref = $ml-> | ||
+ | " | ||
+ | { Limit => " | ||
+ | ); | ||
+ | </ | ||
+ | ==== Perl ==== | ||
+ | === Monitoring:: | ||
+ | <code perl> | ||
+ | # | ||
+ | use Monitoring:: | ||
+ | |||
+ | $filtergrp = ' | ||
+ | |||
+ | $ml = Monitoring:: | ||
+ | socket => '/ | ||
+ | ); | ||
+ | |||
+ | my $up = $ml-> | ||
+ | my $down = $ml-> | ||
+ | my $unknown = $ml-> | ||
+ | my $total = $up + $down + $unknown; | ||
+ | |||
+ | print " | ||
</ | </ |
manuales/nagios/capacitacion/mk_livestatus.txt · Última modificación: 2016/03/21 18:49 por cayu