Absent Member.. Absent Member..
Absent Member..
360 views

Building a new filesystem policy for linux+unix servers using Measurement Threshold policy type

Hi all,

I need some help on this. I am trying to develop a new filesystem policy that does the following:

 - exclude filesystems of type iso9660;

 - apply different thresholds to /, /var, /home, /usr, /boot and /tmp filesystems (one major and one critical threshold);

 - all other filesystems can be measured by another threshold and possibly have different messages associated with it;

So this is what I did:

1) created a new Measurement policy

2) added multiple CODA-FILESYSTEM sources (FS_MAX_SIZE, FS_SPACE_UTIL, FS_DIRNAME, FS_TYPE) and gave them the following names: FilesystemMaxSize, FilesystemSpaceUsed,FilesystemName and FilesystemType.

3) in the Rules tab I created several instance filters:

a. Exclude CDROM

my $FSType = $Policy->Source("FilesystemType");
if ($FSType->Value eq "iso9660") {
   $Rule->Status(TRUE);
}

Action: Do Nothing

b. OS Filesystems

$FSName = $Policy->Source("FilesystemName");
$FS_root = "/";
$FS_var = "/var";
$FS_tmp = "/tmp";
$FS_home = "/home";
$FS_usr = "/usr";
if ($FSName->Value eq $FS_root) {
   $Rule->Status(TRUE);
}
if ($FSName->Value eq $FS_var) {
   $Rule->Status(TRUE);
}
if ($FSName->Value eq $FS_tmp) {
   $Rule->Status(TRUE);
}
if ($FSName->Value eq $FS_home) {
   $Rule->Status(TRUE);
}
if ($FSName->Value eq $FS_usr) {
   $Rule->Status(TRUE);
}

Action: Evaluate Threshold ( another filter )

$FSName = $Policy->Source("FilesystemName");
$FSUsed = $Policy->Source("FilesystemSpaceUsed");
$FSMaxSize = $Policy->Source("FilesystemMaxSize");
$FSThreshold = 10; # equals to 10% occupied (this low value is just for testing purposes)

if ($FSUsed->Value >= $FSThreshold) {
   $Session->Value(Sess_FSThreshold,$FSThreshold);
   $Session->Value(Sess_FSUsed,$FSUsed);
   $Session->Value(Sess_FSName,$FS_Name);
   $Rule->Status(TRUE);
}

The problem with this new policy is that I cant get the session variables to pass the correct values to the message. I am getting "Source=SCALAR(0x870...)  errors in the place of the variables values.

Any ideia? Anyone?

Thanks in advance,

Nelson Ribeiro.

0 Likes
3 Replies
Absent Member.. Absent Member..
Absent Member..

By the way, I am using the following Message Text:

Critical Event - Filesystem <$SESSION(Sess_FSName)> is using <$SESSION(Sess_FSUsed)>, exceeding configured threshold: <$SESSION(Sess_FSThreshold)>

Regards,

nr

0 Likes
Fleet Admiral Fleet Admiral
Fleet Admiral

Hello There,

first of all you no need to write your own code for the requirement you have. all these can be achieved using the default SI-DiskCapacityMonitor.

to exclude CD-rom from monitoring, you can modify parm file on managed node which you can find under /var/opt/perf/

for all other requirement you can use threshold override policy and can set different thresholds, messagegroups etc.

but if you wish to use your own script and policy then please share the policy and i may look into it to figure out what causing the error.

also for such policy it is very useful when you use debug option in it as the error message coming from such policy are not very informative.

ThanK You.

-KAKA-

 

0 Likes
Commodore
Commodore

Hello NelsonRibeiro.

What was your solution to gettign the $session variables to work in your filesystem policy?

Any info appreciated.

Thanks,

RAMFAN54

Thank you! RAMFAN54
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.