log updates

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

log updates

Post 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
You do not have the required permissions to view the files attached to this post.
dwasswa

Re: log updates

Post 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.
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: log updates

Post by DOkuwa »

please can you give an example
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: log updates

Post 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 -
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: log updates

Post 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 nagios@192.168.3.4 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: log updates

Post 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
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: log updates

Post 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 nagios@10.241.11.203 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: log updates

Post 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'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: log updates

Post 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
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: log updates

Post 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.
Locked