- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2022 07:45 AM
Hi Team,
I have created a reference variable ,reference is cmdb_ci table. in filter condition i would like to fetch the windows server and unix server with sub status is not decommissioning. however i am unable to dot walk and find windows server or unix server. i can however find linux and other server classes. please help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 10:42 AM
Hi All,
We have an option to dot walk to hardware -> substatus. The Hardware include all the server class CI's. This helped me to resolve my issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2022 09:25 PM
Hi Atheher,
You would not be able to dot walk to find the substatus for windows server or unix server because they are not reference fields on the cmdb table.
Where as Windows Cluster/Node/Service etc are reference fields on the config item table, and therefore can be used to dot walk.
You could do the following query which is:
Class is Windows Server
However because substatus does not exist on the cmdb_ci table as a field (only on its child table) you cannot choose that as an option either.
There are two options:
1. Create the filter at the right table - I believe the Server table would allow you to do the filters you require
2. Create a script include that provides you with the required results as you can script this query
You can do name is one Of (javascript: new getActiveServers.getWindowsandUnix())
or
sysId is one of (javascript: new getActiveServers.getWindowsandUnix())
And then return back a list of sys ids with the script checking the following
var getActiveServers = Class.create();
getActiveServers.prototype = {
initialize: function() {},
getWindowsandUnix: function() {
var serverRecs = new GlideRecord('cmdb_ci_server');
serverRecs.addEncodedQuery('sys_class_name=cmdb_ci_unix_server^hardware_substatus!=sold^ORhardware_substatus=^NQsys_class_name=cmdb_ci_win_server^hardware_substatus!=sold^ORhardware_substatus!=');
serverRecs.query();
var serverList = [];
while (serverRecs.next()) {
serverList.push(serverRecs.getUniqueValue());
}
return 'sys_idIN' + serverList;
},
type: 'getActiveServers'
};
Might need some tweaking with the filters just because I made up some of the choices as I did not have a decomissioned option. (Make sure the script include is client callable)
Then you could the filter like so:
Hope that helps.
Please mark my answer correct and helpful if this resolves your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 06:39 AM
Hi Sean,
I tweaked the filters and tried as suggested,however the logs show
com.glide.script.RhinoEcmaError: undefined is not a function. <refname> : Line(1) column(0) ==> 1: new getActiveServers.getWindowsandUnix() |
below is the code I used
var getActiveServers = Class.create();
getActiveServers.prototype = {
initialize: function() {},
getWindowsandUnix: function() {
var serverRecs = new GlideRecord('cmdb_ci_server'); serverRecs.addEncodedQuery('sys_class_name=cmdb_ci_unix_server^hardware_substatus!=decommissioning^ORhardware_substatus=^NQsys_class_name=cmdb_ci_win_server^hardware_substatus!=decommissioning^ORhardware_substatus!=');
serverRecs.query();
gs.log("server", serverRecs);
var serverList = [];
while (serverRecs.next()) {
serverList.push(serverRecs.getUniqueValue());
}
return 'sys_idIN' + serverList;
},
type: 'getActiveServers'
};
below is the filters that i tried
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 10:42 AM