Page 1 of 1
log updates
Posted: Thu Oct 19, 2017 10:09 am
by DOkuwa
I am just using Nagios XI to check if a file is being updated every 30 mins
also I have tried to use the config wizard file age but it does not seems to be working
please see attachment
Re: log updates
Posted: Thu Oct 19, 2017 2:32 pm
by dwasswa
Hi
@DOkuwa,
Please look at the command usage below your is not defined well.
Code: Select all
Usage: ./folder_watch.pl [-v] [-t <timeout>] -D <directory> -F <files to check> -w <warn level(s)> -c <crit level(s)> [-a [<warn age>,<crit age>]] [-s [<warn size>,<crit size>]] [-S [<warnsize><critsize>]] [-f] [-r] [-l] [-T files|dir] [-L label] [-V] [-H <hostaddress> | -I | -C <cmd that does 'ls -l>']
Please parse arguments in the correct order.
Re: log updates
Posted: Fri Oct 20, 2017 4:30 am
by DOkuwa
please can you give an example
Re: log updates
Posted: Fri Oct 20, 2017 11:00 am
by DOkuwa
-C 'ssh nagios@$HOSTADDRESS$ ls -lA /opt/InCharge/DEV-OI/smarts/local/logs/' -F 'Heartbeat.log' -r
usr/local/nagios/libexec/folder_watch.pl -C 'ssh nagios@$HOSTADDRESS$ ls -lA /opt/InCharge/DEV-OI/smarts/local/logs/' -F 'Heartbeat.log' -r -a 60,120 -f
UNKNOWN ERROR - execution of ssh nagios@$HOSTADDRESS$ ls -lA /opt/InCharge/DEV-OI/smarts/local/logs/ -R resulted in an error 65280 -
Re: log updates
Posted: Fri Oct 20, 2017 11:29 am
by cdienger
When running this on the command line the
$HOSTADDRESS$ should be replaced with the IP address of the remote server. For example:
Code: Select all
/usr/local/nagios/libexec/folder_watch.pl -C 'ssh [email protected] ls -lA /opt/InCharge/DEV-OI/smarts/local/logs/' -F 'Heartbeat.log' -r -a 60,120 -f
If you haven't already, follow
https://assets.nagios.com/downloads/nag ... ng_SSH.pdf to create keys for the nagios user and transfer them to the remote system. There must be a nagios user on the remote system as well in order for the connection to be made.
Re: log updates
Posted: Fri Oct 20, 2017 12:01 pm
by DOkuwa
thanks a lot it worked but
I want to check my file Heartbeat.log to see if it is updating
what argument do I use and the please send the full command
Re: log updates
Posted: Fri Oct 20, 2017 12:05 pm
by DOkuwa
yes Nagios user is already on both server and check_ssh module has been on the client
/usr/local/nagios/libexec/folder_watch.pl -C 'ssh
[email protected] ls -lA /opt/InCharge/DEV-OI/smarts/local/logs/' -F 'Heartbeat.log' -r -s 100,130 -f
CRITICAL - Heartbeat.log is 20203 (more than 130) bytes - 1 Heartbeat.log files found | 'Heartbeat.log'=1 size_largest=20203B;100;130;;; size_smallest=20203B;;;;;
but I still need the command to indicate that the Heartbeat,log has been updated
if it has not been updated send a warning or critical message if it has been update it is ok
Re: log updates
Posted: Fri Oct 20, 2017 12:48 pm
by cdienger
This will check and alert if the file size is 20203:
Code: Select all
/usr/local/nagios/libexec/folder_watch.pl -C 'ls -l' -F 'out.txt' -s '=20203'
Re: log updates
Posted: Mon Oct 23, 2017 5:42 am
by DOkuwa
Thanks
it works
but I maybe a bit specific here
every morning there is rolllogs here and all logs are 0k in the morning ( I mean file size is 0)
I want to know if I can use a find command to see if there updates very 30 minutes in a file in a directory and report critical If there is nothing and ok if there is
e.g find /xxxx/xxx -type -f -name xxxx.log -mmin +30
Re: log updates
Posted: Mon Oct 23, 2017 1:34 pm
by dwhitfield
There are over 4250 plugins on exchange.nagios.org, and plenty on github that never make it to our exchange. None of the techs have exhaustive knowledge of what is out there. The best thing to do is just look on exchange.nagios.org and in your favorite search engine and see if you can find a plugin that does what you want. If you can't find something, then you will need to write it. If you set out to write your own plugin, please take a look at
https://nagios-plugins.org/doc/guidelines.html
Alternatively, we offer custom development and consulting for a fee.
That said, if you log the size at each check, and set a check to run every 30 minutes, it would seem like it wouldn't be that hard to get what you want.