- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2020 08:12 AM
Hello,
I have a problem in creating a relationship between two middleware components identified on a Linux server
Basically it is a discovery on a Linux server with an LXC layer and on which a Jboss server application is running.
A custom "LXC" pattern has been created to support the LXC part.
A specific "LXC" Class has been created via the class Manager, derived from the Application_server class.
(table u_cmdb_ci_app_server_lxc derived from table cmdb_ci_app_server)
The Linux server discovery is running correctly, both Jboss and LXC patterns are used and give correct results.
At the level of "Related Items", the corresponding CIs are created in the :
Jbosss: cmdb_ci_app_server_jboss
Lxc: u_cmdb_ci_app_server_lxc
The items appear well on the Linux server form with the "Runs on ::Runs" relations
( See the screen copies in the attached document. it should be more clear.)
Now we want to create a relationship between the LXC and Jboss CIs indicating that the LXC container hosts the JBoss server application.
(Several LXC containers, each hosting a Jboss server application).
The relationship type would logically be "Contains ::Contained by" ... but we don't know for sure yet.
Between the two tables there is an attribute to link the LXC record and the JBoss record.
So we have added a « create relation » step in the LXC Pattern which use this attribute.
Setting :
Parent Table: $u_cmdb_ci_app_server_lxc
Child Table: $cmdb_ci_app_server_jboss
Result Table: $p_cmdb_rel_ci
Relationship type: Contains ::Contained by (to be defined, not sure of the relation type..)
Creation Criteria: Field Matching
Parent Table field : u_cible_installdir
Child Table field: install_directory
Unmatched Values: remove
Obviously this is not working... 🙂
In the context of the LXC pattern (which contains the "create relation" step), we need to access the contents of the cmdb_ci_app_server_jboss table ...
But the table $cmdb_ci_app_server_jboss is fed (and accessible) at the JBoss pattern level.
So in the "runtime" context of the LXC Pattern I can't access it. It's at least ma conclusion.
(In debug mode, on the right part (CI attribute), the JBoss tab is empty .. 😞 )
I also tried with a "Creation Criteria" of type Condition :
$u_cmdb_ci_app_server_lxc[].u_target_installdir " contains " $cmdb_ci_app_server_jboss[].install_directory.
It still doesn't work.
Questions :
- How do I make the contents of the cmdb_ci_app_server_jboss table accessible?
I think this is already the first point to solve ...
- Is there in parallel a Dependant relation to be created also via the Class manager at the level of the Class LXC and/or Jboss ? type "containment" or "host" ... ?
Any help is welcome.
Solved! Go to Solution.
- Labels:
-
Discovery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2020 12:26 AM
Hi
In patterns context, you can only access any CIs that are populated within the same pattern and can make relations with them. Pattern's will not get you the CI data from CMDB.
In your case as Lxc and Jboss being 2 different pattern execution, there is no capability to access persisted JBoss CIs from CMDB in Lxc pattern.
Here in context of patterns, we do have some pre and post sensor scripts feature, you can make use of a post sensor script in your case to make relations with the persisted Jboss CIs.
So for every execution of your lxc pattern the post sensor script that you created will run and will make the relations to the Jboss CI as per your criteria. I see the condition which is common field is some installation directory that you are matching, hope the 2 attributes are part of the CI because you can't access temporary variables in post sensor script.
Only caveat here is the Jboss pattern should run before your lxc pattern so that you will be able to make the relations, but from your discovery log it seems to be fine. Just ensure this lxc always runs after jboss.
Reg the rules, there is no need to have a containment rule in class manager, without that even you can make this contains relation b/w the 2 CIs in post sensor script.
You can see many other scripts already available OOB under Pattern Designer -> Pre Post Processing, which can help you in writing a new script.
Please mark Correct if it resolves your issue and also mark Helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2020 08:07 AM
Hi,
my problem doesn't have much success...
Perhaps it's badly formulated...
I don't really master the mechanism of relationship building, maybe I'm going in the wrong direction ...
How would you create a "Contains::contained by" relationship between components that are found in different patterns?
Is it necessary to have a "create relation" step in the pattern AND a Containment (or host) rule defined on the LXC class ?
I really need some clarifications .. please help ..
regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2020 12:26 AM
Hi
In patterns context, you can only access any CIs that are populated within the same pattern and can make relations with them. Pattern's will not get you the CI data from CMDB.
In your case as Lxc and Jboss being 2 different pattern execution, there is no capability to access persisted JBoss CIs from CMDB in Lxc pattern.
Here in context of patterns, we do have some pre and post sensor scripts feature, you can make use of a post sensor script in your case to make relations with the persisted Jboss CIs.
So for every execution of your lxc pattern the post sensor script that you created will run and will make the relations to the Jboss CI as per your criteria. I see the condition which is common field is some installation directory that you are matching, hope the 2 attributes are part of the CI because you can't access temporary variables in post sensor script.
Only caveat here is the Jboss pattern should run before your lxc pattern so that you will be able to make the relations, but from your discovery log it seems to be fine. Just ensure this lxc always runs after jboss.
Reg the rules, there is no need to have a containment rule in class manager, without that even you can make this contains relation b/w the 2 CIs in post sensor script.
You can see many other scripts already available OOB under Pattern Designer -> Pre Post Processing, which can help you in writing a new script.
Please mark Correct if it resolves your issue and also mark Helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 04:29 AM
thank's for your response sid
I understand that there's a context separation in the execution of the two patterns.
So there's two aspects that need to be resolved:
1- Synchronize the run-times of the two application patterns (user-written pattern LXC and OOTB JBoss pattern). The JBoss pattern must be executed before the LXC pattern.
I notice that for the moment there is no synchronization, the explorations on the different jboss/lxc processes are intertwined ...
I tested the "Run order" option at Pattern level (Basic Tab), by setting at LXC pattern level : run order /after / Jboss (also tested with afetre/all )
But this does not give the expected result. The documentation indicates a priori that this option can only be used in "application mapping" context.
In this case, how to ensure the synchronization of the two patterns and make sure that the LXC pattern is triggered after the JBoss pattern?
If we run the discovery a second time can this solve the problem ? in the first run both tables are enriched, in the second run the data is available.
2- Execute a "post-processing" script initiated by the LXC pattern...
I looked at the existing OOTB scripts in the table sa_pattern_prepost_script . It's quite complicated ... I'm not very familiar with programming the ServiceNow Javascript API ...:(
Are there concrete and more explicit examples available somewhere ?
regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2020 02:57 AM
Hi
1. I guess some time back, even I faced similar behavior where "Run Order" seems to be not working for synchronizing the pattern executions, even not sure though why it behaves this way.
I would suggest another approach in order to control the execution order.
OOB we have a classifier for Jboss CI and it will have some priority associated with it. I believe you had also created a classifier for Lxc, so set lesser priority for your Lxc classifier compared to Jboss so that first Jboss pattern gets executed and then yours.
Note: Lesser the value higher is the priority for classifiers. (Ex: Priority 100 is higher than Priority 200)
2. I actually even searched for any SNOW doc on this but couldn't find any. You can try refer "LB Create Relation Between VIPs and Apps" OOB post sensor script for your understanding.
Please mark Correct if it resolves your issue and also mark Helpful if it helps.