This script requires:
1) GNU "free" command on the target machine.
2) Change NAGCACTIUSER to match the username you use for Nagios/Cacti data collection.
3) ssh key set up from the Nagios/Cacti server to the desired user on the remote machine
4) If the user that connects to the remote machine is different from the
one that Nagios/Cacti run under, then you need something like this in sudoers:
cacti  ALL=NOPASSWD: /bin/su - *
In Nagios command.cfg:
**define command{
       command_name   check_lnx_mem_cacti_nagios
       command_line   $USER1$/check_lnx_mem_cacti_nagios.sh $HOSTADDRESS$ $ARG1$ $ARG2$ nagios
       }**
In Nagios services.cfg
**define service{
       use                            service_5_min     Â
       host_name                      remotehost1,remotehost2
       service_description            memory
       check_command                  check_lnx_mem_cacti_nagios!1600!1690
       max_check_attempts             7
       contact_groups                 admins
       }**
For Cacti, you will likely need to change the path in the Data Input Method to match what is used on your system.
Info on importing into Cacti:http://www.cacti.net/downloads/docs/html/template\_import.html
Â