Highlighted
Regular Contributor.
Regular Contributor.
207 views

Supress automactic actions with BSM downtime?

Hi,

I am using the infrastrucure SPI police, SI-LinuxAtdProcessMonitor, to monitor the atd process.

I have an automatic action in the policy, service atd start .

The policy reports a warning if the atd service is stopped, it then executes the automatic action to start the atd process.  I conituing action reports the failure of the automactic action if it fails.

The modified policy has been tested and works.

However when we put a server in downtime in BSM 9.23, the initial alert is auotmatically acknowledged but the automatic action is executed. In this case the atd service is restared when the server is in BSM downtime.

How  can I suppress the automatic action when the server is in downtime?

Here is the raw policy:

[root@ustlvcmsp0194 monitor]# cat  deb8b664-b579-71e5-02f5-0a0100100000_data
SYNTAX_VERSION 6

 

ADVMONITOR "testdowntime-process"
DESCRIPTION "test process monitors daemon process "
INTERVAL "1m17s"
SCRIPTTYPE "Perl"
INSTANCEMODE  SAME
MAXTHRESHOLD
SEVERITY Unknown
PROGRAM "SRC"
DESCRIPTION "test"
MONPROG "<$NOPROGRAM>"
SUPPRESSCONDITIONS
DESCRIPTION "Processes - Fill Instance  list"
CONDITION_ID "0ee83130-ba06-71e5-02f5-0a0100100000"
CONDITION
OBJECT
SCRIPT "
$NbrProcesses = 1;

BEGIN_PROCESSES_LIST
ProcName=/usr/sbin/atd
Params=<*>
MonMode===
ProcNum=1
END_PROCESSES_LIST
@ProcNames=
(
\"/usr/sbin/atd\"
);
@ProcParams=
(
\"<*>\"
);
@MonitorModes=
(
\"==\"
);
@ProcNumbers=
(
1
);

my $src=$Policy->Source(\"SRC\");

if ( $Src->Count() == 0 )
{
for ($i = 0; $i < $NbrProcesses; $i++)
{
$Process = $ProcNames[$i] . \" \" . $ProcParams[$i];
$Src->Add( $Process, $i );
}
$Rule->Status(TRUE);

if ( ! $Session->IsPresent(\"NbrProcesses\") )
{
for ($i = 0; $i < $NbrProcesses; $i++)
{
$Str = \"PROCNAME_\" . $i;
$Session->Value($Str, $ProcNames[$i]);
$Str = \"PROCPARAMS_\" . $i;
$Session->Value($Str, $ProcParams[$i]);
$Str = \"MONMODE_\" . $i;
$Session->Value($Str, $MonitorModes[$i]);
$Str = \"PROCNBR_\" . $i;
$Session->Value($Str, $ProcNumbers[$i]);

}
$Session->Value(\"NbrProcesses\", $NbrProcesses);
}
}


"
MSGCONDITIONS
INSTANCERULE "Monitoring for all servcies with default actions"
ID "61dd4390-741b-4de7-873e-18fa596b7e94"
DESCRIPTION "Monitoring for all servcies with default actions"
CONDITION_ID "c3fb390f-a000-49a4-a6cd-bb8aa03baaa2"
CONDITION
OBJECT
SCRIPT "
my $src=$Policy->Source(\"SRC\");

$ProcName = $Src->Name();
if ( $ProcName ne \"\" )
{
$Rule->Status(TRUE);
};


"
THRESHOLD
SCRIPT "
my $src=$Policy->Source(\"SRC\");

$i = $Src->Value();

$Str = \"PROCNAME_\" . $i;
$ProcName = $Session->Value($Str);
$Str = \"PROCPARAMS_\" . $i;
$ProcParam = $Session->Value($Str);
$Str = \"MONMODE_\" . $i;
$MonitorMode = $Session->Value($Str);
$Str = \"PROCNBR_\" . $i;
$ProcNumber = $Session->Value($Str);

$Session->Value(\"PROCESSNBREXPECTED\", $ProcNumber);
$Session->Value(\"PROCESSNAME\", $ProcName);
$Session->Value(\"PROCESSPARAMETERS\", $ProcParam);
$Session->Value(\"PROCESSMODE\", $MonitorMode . \" \" );

$NbrProcesses = $OVOSystem->NumberOfProcesses($ProcName, $ProcParam);

$Session->Value(\"PROCESSNBRAVAILABLE\", $NbrProcesses);

if ( $MonitorMode eq \">=\" )
{
if ( $NbrProcesses < $ProcNumber )
{
$Rule->Status(TRUE);
}
}
elsif ( $MonitorMode eq \"<=\" )
{
if ( $NbrProcesses > $ProcNumber )
{
$Rule->Status(TRUE);
}
}
else
{
if ( $NbrProcesses != $ProcNumber )
{
$Session->Value(\"PROCESSMODE\", \"\" );
$Rule->Status(TRUE);
}
};


"
SETSTART
SEVERITY Major
APPLICATION "Hays"
MSGGRP "OS"
OBJECT "<$SESSION(PROCESSNAME)>"
SERVICE_NAME "SI:systemservicecollection@@<$MSG_NODE_ID>"
MSGKEY "<$NAME>:<$MSG_NODE_NAME>:<$MSG_OBJECT>:HaysService:Unavailable"
MSGKEYRELATION ACK  "<$NAME>:<$MSG_NODE_NAME>:<$MSG_OBJECT>:<*>" ICASE
CUSTOM  "SPIName"  "SISPI"
CUSTOM  "SPIFamily"  "InfraSPI"
CUSTOM  "SearchTag"  "<$SESSION(PROCESSNBREXPECTED)>;<$SESSION(PROCESSNAME)>;<$SESSION(PROCESSPARAMETERS)>;<$SESSION(PROCESSNBRAVAILABLE)>;<$SESSION(PROCESSMODE)>;"
CUSTOM  "EventTypeIndicator"  "HaysService:Unavailable"
CUSTOM  "CiInfo"  "host_node@@<$MSG_NODE_NAME>"
CUSTOM  "AssignmentGroup"  "CMS_DC_VDCTOOLS"
TEXT "atd daemon process is not running.  Restarting..."
AUTOACTION "/sbin/service atd restart" ACTIONNODE IP 0.0.0.0  "<$MSG_NODE_NAME>" ANNOTATE
SIGNATURE "oCuojwelQcYY14icCvhpmtgzXIgGiz514Ne6FBBXP6po58ZGB+jHtXtpLuJpUXcscqmhA477
VA8+fAiuYZ/eDp2dqq30ET5mPlaLVQqaIYTN8qRRVI5mvrJ7D2q1+XiAIn42wWjjhv5ASjUV
NwFNvspGDRqbzfnlMOegFK10Kug0qZ/8WuM/Bc7xYd6QQHPFz/Wd7rG0l7lqVHRfXOko7mgZ
BUWI9HLuEE5GxbR0qvLlp86PaLOsnU+r4Jb5UCLMU387hlMbcH7deHScTOcG/frFsX2C1AYC
xCwpvFgw59BZyjAIJsUG1u32Hmz2+Bpho4lWnjxnD/ynrPWygIPAIg=="
SETCONT
SEVERITY Critical
APPLICATION "Hays"
MSGGRP "OS"
OBJECT "<$SESSION(PROCESSNAME)>"
SERVICE_NAME "SI:systemservicecollection@@<$MSG_NODE_ID>"
MSGKEY "<$NAME>:<$MSG_NODE_NAME>:<$MSG_OBJECT>:HaysService:Unavailable"
MSGKEYRELATION ACK  "<$NAME>:<$MSG_NODE_NAME>:<$MSG_OBJECT>:<*>"
CUSTOM  "AssignmentGroup"  "CMS_DC_VDCTOOLS"
TEXT "atd processes not running, after attempted restart."
SETEND
SERVERLOGONLY
SEVERITY Normal
APPLICATION "Hays"
MSGGRP "OS"
OBJECT "<$SESSION(PROCESSNAME)>"
SERVICE_NAME "SI:systemservicecollection@@<$MSG_NODE_ID>"
MSGKEY "<$NAME>:<$MSG_NODE_NAME>:<$MSG_OBJECT>:HaysService:Available"
MSGKEYRELATION ACK  "<$NAME>:<$MSG_NODE_NAME>:<$MSG_OBJECT>:<*>" ICASE
CUSTOM  "SPIName"  "SISPI"
CUSTOM  "SPIFamily"  "InfraSPI"
CUSTOM  "SearchTag"  "<$SESSION(PROCESSNBREXPECTED)>;<$SESSION(PROCESSNAME)>;<$SESSION(PROCESSPARAMETERS)>;<$SESSION(PROCESSNBRAVAILABLE)>;<$SESSION(PROCESSMODE)>;"
CUSTOM  "EventTypeIndicator"  "HaysService:Available"
CUSTOM  "CiInfo"  "host_node@@<$MSG_NODE_NAME>"
TEXT "atd daemon process is running."
SUPPRESSCONDITIONS
DESCRIPTION "Suppress rule for specific instance filter X (Automatically generated rule to stop evaluating other rules)"
CONDITION_ID "0ee834b4-ba06-71e5-02f5-0a0100100000"
CONDITION
OBJECT
SCRIPT "
my $src=$Policy->Source(\"SRC\");

$ProcName = $Src->Name();
if ( $ProcName ne \"\" )
{
$Rule->Status(TRUE);
};


"
[root@ustlvcmsp0194 monitor]#

Thank you for your help!

Johnson

Labels (1)
0 Likes
3 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Hello Johnson,

you could try to create an EPi script

- Check if the event is received in downtime
event.isReceivedOnCiDowntime()

- If yes remove the action

PS: I have not tested it but you could give it a try...

Kind regards,
Harald

 

 

 

0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Hi,

Thank you for the suggestion.  The automatic action is started by the HPOM agent policy.  So I do not think that the epi script would affect the OM agent policy.

However is anyone aware of a command line that would return the sattus of a server?  If a server was in downtime, how could I query from the command line the server was in BSM downtime?

 

IE

query server in BSM to detect downtime status.

If in downtime exit

else service start atd

Thank you all for your help!

Johnson 

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Hello,

in case a CI is marked as "in downtime" it gets a special attribute which marks it as "in downtime".

You could create a RTSM query (see -> UCMDB/RTSM APIs for usage) and get all CIs which are in downtime.

PS: Unfortunately I do no have a sample so please see the helps/guides on usage.

Kind regards,
Harald

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.