# please recommend beat monitors for FreeBSD...



## sugar (Jul 26, 2009)

Hello to all.

I have a FreeBSD 7.0 server but running two very important tasks and I would like to know how to keep them monitorized.

*Task A: storage processing:*
I have a custom made script which rotates files from a remote server with rsync, then archive them to a smbfs mount, then delete files older than 30 days in the remote server.

How can I make sure that the smbfs mount is mounted before delete files at the remote server?

*Task B: FTP server:*
- the FreeBSD server must receive 24/7 files from a media storage server (ftp client), so I would like to have a monitor that tells me if for some reason my server stop receiving those FTP files.

Any help  will be appreciated =)

Thanks !

Aldo.


----------



## dennylin93 (Jul 26, 2009)

Never used Samba before, so I have absolutely no idea about the first one.

As for FTP, net-mgmt/nagios might be able to help you monitor the status of the services you're running. There's a screenshot here: http://nagios.sourceforge.net/images/screens/new/service-detail.png.


----------



## sugar (Jul 26, 2009)

Oh, thanks, I am still trying to invent or find some monitor for the smbfs mount...


----------



## aragon (Jul 26, 2009)

What about a simple shell script that calls mount?


----------



## sugar (Jul 26, 2009)

I am also thinking in something like 


```
mount -p | grep buffalo
//CDR@BACKUP/CDR	/mnt/buffalo		smbfs	rw		0 0
```

But how could integrate this command/output in to my script logic? I mean how can I tell my script to check this output, and if it actually see the buffalo output it can proceed with file rotation and deletion...

thanks in advance.


----------



## dennylin93 (Jul 26, 2009)

Use `$ echo $?` right after `$ mount -p | grep buffalo`. If you successfully grep something, the output will be 0. If nothing is grepped, it is something other than 0. Just use an "if" in your shell script.


----------



## aragon (Jul 26, 2009)

Yup, this will work:


```
#!/bin/sh
if mount -p |grep buffalo >/dev/null; then
  echo "doing rotation..."
fi
```


----------



## sugar (Jul 26, 2009)

Thanks guys!!!  =)


----------



## SirDice (Jul 27, 2009)

If you run some services and you want to make sure they keep running have a look at sysutils/daemontools. Daemontools will automatically restart any service should it crash.


----------



## sugar (Jul 27, 2009)

SirDice said:
			
		

> If you run some services and you want to make sure they keep running have a look at sysutils/daemontools. Daemontools will automatically restart any service should it crash.



is that a port that I must install?


----------



## aragon (Jul 27, 2009)

Yes, it's a port.


----------

