Nagios log

Arno Lehmann al at its-lehmann.de
Wed Mar 9 16:03:00 CET 2005


Hello,

Sandoval, Julio wrote:

> Hello list,
> Well, I need to know how to obtain the date and hour format as follows:
> yyyymmdd hh:mm:ss

You would need to change the perl script below. With the function 
strftime from the perl module POSIX you can achieve this.

user man perlfunc and perldoc POSIX and look up the functions you need...

Arno

> With the script of down I obtained the following thing:
> Tue Aug 10 20:53:54 2004
> 
> 
> Could you help me?
> Thank!
> Julio Sandoval
> 
> -----Mensaje original-----
> De: Sandoval, Julio 
> Enviado el: Martes, 08 de Marzo de 2005 10:34
> Para: 'Montse Seisdedos'; nagios-users at lists.sourceforge.net
> Asunto: RE: [Nagios-users] Nagios log
> 
> 
> Thank you very much!!!!
> I can see date and hours...!! you are Master of Nagios
> 
> Congratulation, 
> Sincerily
> Julio Sandoval Schwartzmann
> 
> -----Mensaje original-----
> De: Montse Seisdedos [mailto:mseisdedos at mediafusion.es]
> Enviado el: Martes, 08 de Marzo de 2005 7:53
> Para: Sandoval, Julio; nagios-users at lists.sourceforge.net
> Asunto: Re: [Nagios-users] Nagios log
> 
> 
> You can edit a script with these lines:
> if [ $# == 0 ]
> then
>         printf "Error. Uso: verlog logfile\n"
>         exit 1
> 
> fi
> 
> perl -ane '$F[0] =~ /(\d+)/ && print
> localtime($1) . " @F[1..$#F]\n" ' $1
> 
> 
> And then execute:
> 
> 
>>./name_of_the_script nagios.log
> 
> 
> 
> 
> 
> 
> ----- Original Message ----- 
> From: "Sandoval, Julio" <jsandoval at achs.cl>
> To: <nagios-users at lists.sourceforge.net>
> Sent: Monday, March 07, 2005 10:28 PM
> Subject: RE: [Nagios-users] Nagios log
> 
> 
> 
>>Help Nagios List,
>>
>>I need to have log file of nagios (/etc/nagios/nagios.log) with date and
> 
> hour...
> 
>>actualy, i can see the following:
>>For example:
>>[1096384167] SERVICE ALERT: mailsweeper;PING;OK;SOFT;2;PING OK - Packet
> 
> loss = 0%, RTA = 1.73 ms
> 
>>[1096384167] SERVICE ALERT: fw1;PING;OK;SOFT;2;PING OK - Packet loss = 0%,
> 
> RTA = 1.54 ms
> 
>>[1096385027] SERVICE ALERT: achs-tam01;PING;WARNING;SOFT;1;PING WARNING -
> 
> Packet loss = 0%, RTA = 368.90 ms
> 
>>....etc
>>
>>Logically i can see the date/hour.. in the nagios page, for example:
>>[07-03-2005 16:57:50] SERVICE ALERT:
> 
> Sitios_Web_Internet;PING;OK;SOFT;2;PING OK - Packet loss = 0%, RTA = 3.53 ms
> 
>>[07-03-2005 16:56:50] SERVICE ALERT:
> 
> Sitios_Web_Internet;PING;WARNING;SOFT;1;PING WARNING - Packet loss = 0%, RTA
> = 120.87 ms
> 
>>[07-03-2005 16:53:50] SERVICE ALERT:
> 
> Antivirus_Webshield;PING;OK;SOFT;2;PING OK - Packet
> 
>>..etc
>>
>>But I need to send this data to database for analysis, for that I need the
> 
> archive.
> 
>>Could you help me, please?
>>
>>Thak you list,
>>Julio Sandoval Sch.
>>
>>
>>
>>
>>
>>
>>
>>
>>"Este mensaje y cualquier archivo adjunto es confidencial y está destinado
> 
> a la persona o entidad a quién ha sido dirigido. Si usted no es el receptor
> individualizado en el mismo, le solicitamos notificar de ello al remitente
> de manera inmediata, estando prohibido y sancionado por la ley cualquier
> almacenamiento, divulgación, distribución o copia de su contenido."
> 
>>                     隊X'u޼NL v -y蝚v'z q݉ 'wky (|Ϯnrۮyn 8r
> 
> brkۜk˺\ -r 왚� x'   ,v��oi  ږZ
'  )rO                  ֠ f)+-5֨"  X  y +
> zmض b q  +-떳b ~j稳z  y
嫊w%׍j*' n)z"쎋� t䰅 z+)j|ࢲ˞ 1 ,j+a¢l뺚hا)ߣ 
h ׯ{
> 
> 
> 
> "Este mensaje y cualquier archivo adjunto es confidencial y está destinado a la persona o entidad a quién ha sido dirigido. Si usted no es el receptor individualizado en el mismo, le solicitamos notificar de ello al remitente de manera inmediata, estando prohibido y sancionado por la ley cualquier almacenamiento, divulgación, distribución o copia de su contenido."
> HW�j)b��h��+y��N�L��v�-�y�v'z�\jwbv����,�xn���v�!3�ۜ���j�j[�z���(���'!��
��l����X�z�m��^�*^J֫���v)�!���l��gr��i؝��e�ȝ^�)�rCZ�*,�ǫ�f��)�+-5�"�ˬz�%��l���q���z�m��?�X���(��
~��zw��X�����b��?��"�ˬz���z)ܖ�^5�"��ޮȨ��n�)�z�"�{ڝӒ����h�ا����.xǬ��
�������i��b��~�"�Z�Fފx,z{m��^��ll==

-- 
IT-Service Lehmann                    al at its-lehmann.de
Arno Lehmann                  http://www.its-lehmann.de


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list