Sponsored Content
Top Forums Shell Programming and Scripting Shell script - Asterisk logs report Post 302969106 by bigbrobg on Friday 18th of March 2016 05:44:33 AM
Old 03-18-2016
For RINGNOANSWER:
current output (first column is zabbix alert time - not needed) :
Code:
1458182148      1458182148|1458182143.44543|1111|NAME NAME|RINGNOANSWER|4000

it should look like:
Code:
 Date time start|date time end|1111|NAME NAME|RINGNOANSWER| only > 14000

For EXITEMPTY current output is (fist column is zabbix time - not needed):
Code:
1457841440     1457841440|1457841419.11419|1111|NONE|EXITEMPTY|1|1|20
1457841440     1457841440|1457841419.11419|1111|NONE|EXITEMPTY|1|1|20

it should look like:
Code:
date time start| date time end|1111-name1|exitempty|1|1|20
date time start| date time end|1112-name2|exitempty|1|1|20

for EXITWITHTIMEOUT current output is (first column - zabbix time, not needed):

Code:
1457844081    1457844081|1457844020.11685|1111|NONE|EXITWITHTIMEOUT|1|1|60
1457844081    1457844081|1457844020.11685|1112|NONE|EXITWITHTIMEOUT|1|1|60

it should look like:
Code:
date time start| date time end|1111-name|exitwithtimeout|1|1|60
date time start| date time end|1112-name|exitwithtimeout|1|1|60

-----
what i did so far for exitwithtimeout:

- pull data from zabbix mysql using user "select" (have only select rights, no password):

Code:
mysql -u select -D zabbix -e "select clock,value from history_log;" | 
     grep -v -e endpoint -e ADDMEMBER -e REMOVEMEMBER -e '|02' |  grep EXITWITHTIMEOUT > "/tmp/exitwithtimeout.txt"

- rename queues:
sed -i -- 's/|1111|/|1111-Name_1|/g; s/|1112|/|1112-Name_2|/g' /tmp/exitwithtimeout.txt

- removed |NONE|:
Code:
sed -i -- 's/|NONE|/|/g' /tmp/exitwithtimeout.txt

- removed first column:
Code:
cat /tmp/exitwithtimeout.txt | awk '{print $2,$3,$4,$5;}' > /tmp/exitwithtimeout_strp.txt

- added date (do not know how to convert second column ..):
Code:
cat /tmp/exitwithtimeout_strp.txt | while read f1 f2; do echo $(date -d @$f1) $f2; done

-----

Thank you so much for your time helping me!

Last edited by jim mcnamara; 03-18-2016 at 09:30 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to view logs of a server

Please share a shell script to collect logs of a server (like cpu utilization, memory etc) for a perticular time interval by giving date, time and server name as input. (1 Reply)
Discussion started by: abhishek27
1 Replies

2. Shell Programming and Scripting

Use asterisk in shell script bash

Hello, I am trying to save in a file a single "*" but its not working... look what i am doing... FILE="/home/teste/a.txt" ...BEGIN... ASTERISK="*" echo "STRING $ASTERISK STRING" >> $FILE ...END... when i do it, the result is a list of all files of the current... (4 Replies)
Discussion started by: diogooute
4 Replies

3. Shell Programming and Scripting

help with a shell script that greps an error from the logs

Hello everyone. I wrote the following script but the second part is not excecuting. It is not sending the notification by email if the error occurs. the send mail is working so i think the errorr should be in the if statement LOGDIR=/logs/out LOG=`date "+%Y%m%d"`.LOG-FILE.out #the log file ... (11 Replies)
Discussion started by: adak2010
11 Replies

4. Shell Programming and Scripting

Need to develop a script to create a report reading multiple server logs

I am currently trying to develop a script to connect to mulltiple servers, reading specifc data from log files on the servers and append the data from each file into a single tab delimited row. So, at the end I am planning to have a report with all the extracted data with each row per server. I am... (5 Replies)
Discussion started by: scriptingnewbie
5 Replies

5. Shell Programming and Scripting

Shell Script for GC Logs

Hi, I have a strange situation here, I want to archive gc.logs file, generated by a java application, the strange thing about gc.log file is is doesn't have any time/date stamp appended to it unlike other logs (catalina/access/error) and one more strange thing is when ever the application is... (6 Replies)
Discussion started by: Neeryan
6 Replies

6. Shell Programming and Scripting

Help with extract application logs through shell script in performance testing

Hi Experts, I am new to shell.How to extract logs (Web,APP,Database) using shell in performance testing? Need for webserver logs,app server logs and d/b logs code. Thanks in advance Sree (3 Replies)
Discussion started by: sree vasu
3 Replies

7. Shell Programming and Scripting

Managing logs in shell script

Hi, I need write a shell script which should be executed from the crontab every day. This shell script is running several other shell scripts , and each one of them is writing to its log file. Few of the the shell script are also connecting using ssh to some other users on remote machine , do... (1 Reply)
Discussion started by: Yoav
1 Replies

8. Shell Programming and Scripting

Help with Shell Script to View Logs

Hi I'm very new to unix shell scripting. Im also new here in this forum. I'm a SQL Server DBA but I'm slowly learning Oracle and Sybase DB. Our Oracle and Sybase are on Unix platforms. Im slowly learning Linux Admin and Shell Scripting to automate tasks. I'm writing a script to view DB error... (4 Replies)
Discussion started by: Ricky777
4 Replies

9. Shell Programming and Scripting

Shell script for capturing FTP logs

I have a script #!/bin/bash HOST=ftp.example.com USER=ftpuser PASSWORD=P@ssw0rd ftp -inv $HOST <<EOF user $USER $PASSWORD cd /path/to/file mput *.html bye EOF the script executes sucessfully I need to capture the FTP logs to a logfile should contain FTP Login successful ... (1 Reply)
Discussion started by: rajeshas83
1 Replies

10. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies
All times are GMT -4. The time now is 10:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy