0

-edit- I had no luck installing opsview and i tried nagios. I'm using nagios instead and it appears to be good.

I installed iwatch and have sendmail working (cron jobs are emailed to me). I enabled deamon mode for iwatch and restarted iwatch. I see the deamon running with ps aux.

When I change one of the files in /var/www/mysite I get no email and I dont see anything happening. I checked using the mail cmd in case it went there. I did add the directory (its recursive but the file i modified wasn't in a subdir) and restarted the daemon after modification.

How do I get iwatch to watch and email me?


iwatch.xml. ** around the line I added

<config>
  <guard email="root@localhost" name="IWatch"/>
  <watchlist>
    <title>Operating System</title>
    <contactpoint email="root@localhost" name="Administrator"/>
    <path type="single" syslog="on">/bin</path>
    <path type="single" syslog="on">/sbin</path>
    <path type="single">/etc</path>
    <path type="recursive">/lib</path>
    <path type="exception">/lib/modules</path>

    **<path type="recursive">/var/www/fmyapp</path>**
  </watchlist>
</config>

/etc/default/iwatch

## iwatch configuration file

# START_DAEMON:
#   should iwatch start the iwatch daemon during boot?
START_DAEMON=**true** (from false)

# CONFIG_FILE:
#   configuration file for iwatch daemon
#
CONFIG_FILE=/etc/iwatch/iwatch.xml

I havent changed anything from the default or add a cronjob or anything

user9517
  • 115,471
  • 20
  • 215
  • 297
  • You probably need to show some details regarding your crontab entry and your iwatch entry. – Dennis Williamson Sep 29 '10 at 00:32
  • @Dennis Williamson: Supposedly iwatch does it automatically (via sendmail) and cron i left everything to the default and added ONE line to execute my backup.sh script. I didnt realize it would send me mail after i configured ssmtp. –  Sep 29 '10 at 03:19
  • But you have to configure iwatch to tell it what to watch. You say you added the directory. I'm saying it might be helpful to show your config file, cron entry and possibly the contents of your script. Otherwise, it's only guesswork. – Dennis Williamson Sep 29 '10 at 04:20
  • @Dennis Williamson: Oh! now i understand what your saying. I havent added a cron job for iwatch. I see the deamon running and iwatch site says it watches the directory for changes (through inotify i believe) and automatically informs you the moment it changes. Outside of adding a line for the backup script months ago i havent done anything with cron. Really i am just working with default configs. –  Sep 29 '10 at 05:34
  • 1
    Once -- but only once -- I've seen a situation where a previously working incron suddenly stopped working after a longish uptime. In that case only a reboot solved the problem. You might first try to add 'syslog="on"' to your path declaration to see if it's a problem with sendmail or iwatch. If no log entries happen and this is a server you can freely reboot, try rebooting. Sorry if this sounds a bit like Windows administration. :-) – Janne Pikkarainen Sep 29 '10 at 07:06

2 Answers2

1

In Ubuntu 12.04 there is an error in /etc/default/iwatch, the variable iwatch is actually looking for is CONFIGFILE and not CONFIG_FILE so point it to your custome config with

CONFIGFILE=/etc/iwatch/iwatch.xml
tkoopa
  • 11
  • 1
0

Firstly if you don't want it to email your local system then change:

<contactpoint email="root@localhost" name="Administrator"/>

to

<contactpoint email="someemail@gmail.com" name="Administrator"/>

If you are ok with that then the next step is check to see if it is running

ps aux | grep iwatch

Then start it with the service command, ie

service iwatch start

Check if it is running again

ps aux | grep iwatch

Now test it out by running

touch /etc/test

And you should get an email, good luck!

Here is a good example of a configuration file

https://github.com/kiwiroy/iwatch/blob/master/iwatch.xml.example

earlonrails
  • 121
  • 4