cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Highlighted
Level 9

monitor linux swap space

Hi,

Has anyone successfully managed to monitor linux swap space using agent?

When I tried to list the resources, I can't seem to find the swap space.

Can someone please assist?

regards,
Alex

0 Kudos
8 Replies
Highlighted
Level 16

Re: monitor linux swap space

Hi Alex,

When u monitor using agent, swap and other space is consolidated into 1 component so u dont find it under List Resources...

Highlighted
Level 9

Re: monitor linux swap space

Hi Pratikmehta0003,

I assume that there is no way for me to view the swap space nor a email alert?

Thanks

regards,
Alex

0 Kudos
Highlighted
Level 16

Re: monitor linux swap space

in agent based, i dont think u can view it..

if u want to specifically alert on swap space, you may have to do a custom poller or make use of the component in SAM which can hep in identifying the swap space...

Highlighted
Level 9

Re: monitor linux swap space

pratikmehta003​ , that is one of the requirements.

How can I go about creating a custom poller to monitor swap space?

Appreciate your assistance on this.

0 Kudos
Highlighted
Level 16

Re: monitor linux swap space

Hi Alex,

I will check if i can get something on that... else u need to know the OIDs for the swap space and then follow the doc available for customer poller creation

0 Kudos
Highlighted
Level 16

Re: monitor linux swap space

Sorry i couldnt respond back.. Are u still at same issue or already resvoled?

0 Kudos
Highlighted
Level 11

Re: monitor linux swap space

You could make an application template and add a component monitor that runs a script through SSH to grab your swap usage. 

0 Kudos
Highlighted
Level 8

Re: monitor linux swap space

Hi Alex,

I have not been able to fint a build-in method to monitor SWAP space, so what we did was utilizing a Linux/Unix script monitor through APM to do the job for us, and from my experience it works just fine!

In our environment we have set the thresholds to Warning 80% and Critical 90%, but that is something you can adjust to whatever you require.

Under this line is the full script, the Command Line field should contain only: ${SCRIPT}

#!/bin/sh

if [ $(free -k | grep 'Swap' | awk '{print $2}') -eq "0" ]; then

    echo "Message: Server has not configured any swap space"

    echo "Statistic: 0"

    exit 0

fi

stat="$(free -k | grep 'Swap' | awk '{print $3/$2 * 100.0}' | awk '{print int($1+0.5)}')"

exit=`echo $?`

if [ $exit -eq 0 ]

then

        echo "Message: Used amount of swap space in %: $stat"

        echo "Statistic: $stat"

        exit 0

fi

echo "Message: ERROR: Can't find swap field (Swap) in (free -k) command. \n"

echo "Statistic:1000"

exit 1;