Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Zabbix item for last line of a log file Post 303031970 by rbatte1 on Friday 8th of March 2019 08:11:46 AM
Old 03-08-2019
Got it at last!! It's quite convoluted, so why not share and see if someone else might benefit or suggest how to improve it:-
  1. Create the Zabbix item in a template for the file as type log and key logrt[/path/to/log] with a history of 1 day and a refresh of 3 seconds (don't want old logs and need it reasonably up to date without hammering the servers) The logrt key allows it to cope with logs that are rotated.
  2. Assign the template to the required hosts, although in my case the template was already on several servers so it appears in various places straight away.
  3. Wait a few minutes for the data to be picked up, ensuring that some new data is actually written to the log.
  4. Determine the Zabbix item number for the log file on the particular host I'm interested in
  5. Use a web-request to get the log file from the Zabbix server
  6. Get the first record (stored so newest is at the top)
  7. Drop the log reference number (first item, tab separated)
  8. Hey presto, I have the message that I can display.
Quite a palaver. I'm also not sure if we have bespoke tools that do things like working out the item number or if having a webserver that can share the log files is default.

I hope that this helps someone. Does anyone think I need to add more detail on each step?



Robin
These 3 Users Gave Thanks to rbatte1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Infrastructure Monitoring

A Review of Zabbix - Zabbix Rules! (Part 1)

Tim Bass 03-20-2009 07:02 AM Source... (0 Replies)
Discussion started by: Linux Bot
0 Replies

2. Infrastructure Monitoring

A Review of Zabbix - Zabbix Rules! (Part 2)

Tim Bass 03-23-2009 03:45 PM Source... (0 Replies)
Discussion started by: Linux Bot
0 Replies

3. Shell Programming and Scripting

shell script to read a line in gps receiver log file and append that line to new file

Hi, I have gps receiver log..its giving readings .like below Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GPSD,R=1 $GPGSV,3,1,11,08,16,328,40,11,36,127,00,28,33,283,39,20,11,165,00*71... (3 Replies)
Discussion started by: gudivada213
3 Replies

4. Shell Programming and Scripting

Searching for file and stopping at first item found

Hello, I try to write a shell script that would list all files on a directory and stop when it finds the first item specified on a find or ls command. How can I tell to the find or ls command to stop when it finds the first ".doc" file for example ? Thank you (7 Replies)
Discussion started by: davchris
7 Replies

5. Shell Programming and Scripting

Reading each item from a formatted file

Hi, I have a file generated like this - 1. Fire SQL and store the formatted output in a temp file echo "select path, empid, age from emp_tbl" | /usr/sql emp_db 2 > count_file | grep vol > tempFile 2. The tempFile looks like this after the above statement /vol/emp1 0732 ... (9 Replies)
Discussion started by: angshuman_ag
9 Replies

6. Shell Programming and Scripting

Print new item in file with symbol

Dear all, I have encountered some problem here. I prompt the user for input and store it into a data file, eg. key in name and marks so the data file will look like this andrew 80 ben 75 and the next input is carine 90. So the problem here is i want to print... (2 Replies)
Discussion started by: branred
2 Replies

7. Shell Programming and Scripting

HELP: Shell Script to read a Log file line by line and extract Info based on KEYWORDS matching

I have a LOG file which looks like this Import started at: Mon Jul 23 02:13:01 EDT 2012 Initialization completed in 2.146 seconds. -------------------------------------------------------------------------------- -- Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies

8. Shell Programming and Scripting

Reading line by line from live log file using while loop and considering only those lines start from

Hi, I want to read a live log file line by line and considering those line which start from time stamp; Below code I am using, which read line but throws an exception when comparing line that does not contain error code tail -F /logs/COMMON-ERROR.log | while read myline; do... (2 Replies)
Discussion started by: ketanraut
2 Replies

9. Shell Programming and Scripting

Read a lis, find items in a file from the list, change each item

Hello, I have some tab delimited text data, file: final_temp1 aname val NAME;r'(1,) 3.28584 r'(2,)<tab> NAME;r'(3,) 6.13003 NAME;r'(4,) 4.18037 r'(5,)<tab> You can see that the data is incomplete in some cases. There is a trailing tab after the first column for each incomplete row. I... (2 Replies)
Discussion started by: LMHmedchem
2 Replies

10. Shell Programming and Scripting

Script to process a list of items and uncomment lines with that item in a second file

Hello, I have a src code file where I need to uncomment many lines. The lines I need to uncomment look like, C CALL l_r(DESNAME,DESOUT, 'Gmax', ESH(10), NO_APP, JJ) The comment is the "C" in the first column. This needs to be deleted so that there are 6 spaces preceding "CALL".... (7 Replies)
Discussion started by: LMHmedchem
7 Replies
SVN_LOG(3)								 1								SVN_LOG(3)

svn_log - Returns the commit log messages of a repository URL

SYNOPSIS
array svn_log (string $repos_url, [int $start_revision], [int $end_revision], [int $limit], [int $flags = SVN_DISCOVER_CHANGED_PATHS | SVN_STOP_ON_COPY]) DESCRIPTION
svn_log(3) returns the complete history of the item at the repository URL $repos_url, or the history of a specific revision if $start_revi- sion is set. This function is equivalent to svn log --verbose -r $start_revision $repos_url. PARAMETERS
o $repos_url - Repository URL of the item to retrieve log history from. o $start_revision - Revision number of the first log to retrieve. Use SVN_REVISION_HEAD to retrieve the log from the most recent revision. o $end_revision - Revision number of the last log to retrieve. Defaults to $start_revision if specified or to SVN_REVISION_INITIAL otherwise. o $limit - Number of logs to retrieve. o $flags - Any combination of SVN_OMIT_MESSAGES, SVN_DISCOVER_CHANGED_PATHS and SVN_STOP_ON_COPY. RETURN VALUES
On success, this function returns an array file listing in the format of: [0] => Array, ordered most recent (highest) revision first ( [rev] => integer revision number [author] => string author name [msg] => string log message [date] => string date formatted per ISO 8601, i.e. date('c') [paths] => Array, describing changed files ( [0] => Array ( [action] => string letter signifying change [path] => absolute repository path of changed file ) [1] => ... ) ) [1] => ... Note The output will always be a numerically indexed array of arrays, even when there are none or only one log message(s). The value of $action is a subset of the status output in the first column, where possible values are: Actions +-------+-------------------------+ |Letter | | | | | | | Description | | | | +-------+-------------------------+ | M | | | | | | | Item/props was modified | | | | | A | | | | | | | Item was added | | | | | D | | | | | | | Item was deleted | | | | | R | | | | | | | Item was replaced | | | | +-------+-------------------------+ If no changes were made to the item, an empty array is returned. NOTES
Warning This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. EXAMPLES
Example #1 svn_log(3) example <?php print_r( svn_log('http://www.example.com/', 23) ); ?> The above example will output something similar to: Array ( [0] => Array ( [rev] => 23 [author] => 'joe' [msg] => 'Add cheese and salami to our sandwich.' [date] => '2007-04-06T16:00:27-04:00' [paths] => Array ( [0] => Array ( [action] => 'M' [path] => '/sandwich.txt' ) ) ) ) SEE ALSO
SVN documentation on svn log . PHP Documentation Group SVN_LOG(3)
All times are GMT -4. The time now is 05:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy