#
# Free page memory using "swap -s"
test solswap_virtualmemory extends storage {
    static set name "memory";
    static set features unix local sysv solaris;
    pernode set report_item "cpu";
    static set storageid "memory.swap";
    static set description "Monitor virtual memory usage using swap -s";

	pernode precheck {
		set test_available domain_available( "solswap" );
    }

    overrides pernode discover {
	    get solswap.total[0];
		debug 4 solswap total size: ${solswap.total[0]};
		set allocunits 1024;
		set storage.size ${solswap.total[0]};
		set storage.device "N/A";
    }

    # select the entities this instance will monitor
    overrides discover {
		set monitored remove( ${monitored}, ${thismonitor} );
		set storage.description "Swap Space";
		select thismonitor storage.description true;
		set monitored ${monitored} ${thismonitor};
    };

    overrides monitor {
        get solswap.used[0];
		set storage.free.size ${storage.size[0]} - ${solswap.used[0]};
		set storage.free.percent percentage( ${storage.free.size[0]}, ${storage.size[0]} );
		set storage.used.size ${solswap.used[0]} ;
		set storage.used.percent percentage( ${storage.used.size[0]}, ${storage.size[0]} );
    }
}


