Monitoring File count in a Folder using Script Monitor ( Linux and Solaris)

Monitoring File count in a Folder using Script Monitor ( Linux and Solaris)

OpManager supports different scripts (Powershell , Shell,Perl & VBScript) for adding custom script  monitors.

Here is a sample shell script for monitoring number of files on a Linux and Solaris servers.

For Linux server :

Script Body:

#!/bin/bash

files=$(ls /opt/ManageEngine | wc -l)

set -e

echo "Message: Files"

printf "Data:\n  files $files"



For Solaris:

Script Body :

#!/bin/bash

files=`ls /opt/SUNWmlib/lib | wc -l`

set -e

echo "Message: File Count"

echo "Data:\nfiles\t$files "

 
(command ls /opt/SUNWmlib/lib | wc -l is specified using back tick(``) on both sides)

Find the attached files available as .XML script files.

                  New to ADSelfService Plus?