Installed Applications - RPM

(imported comment written by MattBoyd)

Can you show me what web reports relevance you’re trying that is returning that result?

Also, what is the name of the property in the analysis that you are trying to retrieve results from?

(imported comment written by cstoneba)

I am just running your report and searching for “firefox”.

the analysis is called “Installed Apps - Win, AIX, Sun” , property within that analysis is called “Installed Apps”. This analysis is within the Master Action Site.

(imported comment written by MattBoyd)

What if you used something like this:

relevance = ‘(multiplicity of it, it) of unique values of values whose (it as string as lowercase ’ + $("#operator").attr(“value”) + ’ "’ + $("#application").attr(“value”).toLowerCase() + '" as lowercase AND it as string as lowercase does not contain “security update for windows” AND it as string as lowercase != regex ".

kb\d{6}.

" and it as string as lowercase does not contain “hotfix” and it as string as lowercase does not contain “service pack”) of results (bes computers, bes property “Installed Apps”)’;

(imported comment written by cstoneba)

that worked great Boyd. thank you very much.

(imported comment written by SystemAdmin)

Very nice looking report Matthew :slight_smile:

(imported comment written by SystemAdmin)

Terrific looking report Boyd, however when I try to drill down to a group of computers by clicking on the App name, the java window opens, but it shows “0 to 0 of 0 entries” and “No Data available in Table” as well as no machine information listed. Any ideas?

(imported comment written by MattBoyd)

hmm… what version of Web Reports are you using? Do you get results for other applications?

Do you have the “Remove Invalid Characters” checkbox marked? I think I have a bug that prevents some installed computer results from showing. I didn’t fix it because that checkbox is going away… the bug was fixed in 8.1.551.0.

(imported comment written by SystemAdmin)

We’re on 8.0.627.0. No results for any application I’ve searched for. It shows how many it’s installed on, but when I click on the app name to see specific computers, no results display in the new java window. I’ve tried it with both the invalid characters checked and unchecked. I even deleted the report, and files from the custom folder, downloaded a fresh version and imported again to the same result.

(imported comment written by MattBoyd)

If you know how to access the Javascript console, or use the developer tools in Chrome, you could look for JavaScript errors there that may indicate the problem. I have a new version that I’ll try to finish this weekend. It has better error handling, which could make this a lot easier to debug. I wonder if you have computers in Web Reports that don’t have a name defined…

(imported comment written by MattBoyd)

Alright, I spent some time on this last night and I’m ready to release a 'beta" of the new version. It still needs some aesthetic TLC, but should be functional. This version adds support for Mac and Linux applications/packages. I also added better exception handling so that, when an error is encountered, you should receive an error message and the relevance that was generated. This should make it a lot easier to troubleshoot. Rather than making a new zip archive that includes JQuery and Datatables, I’m just going to include the web report code in this post for now.

<!-- Report Name: Application Search Search BigFix inventory 

for a list of applications that are installed on computers. Determine what computers have a specific application installed.   Author: Matthew Boyd (iboyd.net) Version 2.0b Date:     5/10/2011   --> <html> <head> <style type=
"text/css" title=
"currentStyle"> @

import 
"/JavaScript/CUSTOM/DataTables-1.7.5/css/demo_page.css"; @

import 
"/JavaScript/CUSTOM/DataTables-1.7.5/css/demo_table_jui.css"; @

import 
"/JavaScript/CUSTOM/jquery-ui-1.8.9/css/redmond/jquery-ui-1.8.9.custom.css"; @

import 
"/JavaScript/CUSTOM/DataTables-1.7.5/plugins/TableTools-2.0.0/css/TableTools_JUI.css"; body 
{ font-family: 
"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; 
} .ui-dialog 
{ font-size:small; 
} </style> <script src=
"/JavaScript/CUSTOM/jquery-1.4.4/jquery-1.4.4.min.js" type=
"text/javascript"></script> <script type=
"text/javascript" language=
"javascript" src=
"/JavaScript/CUSTOM/DataTables-1.7.5/js/jquery.dataTables.min.js"></script> <script type=
"text/javascript" src=
"/JavaScript/CUSTOM/jquery-ui-1.8.9/jquery-ui-1.8.9.custom.min.js"></script> <script type=
"text/javascript" language=
"javascript" src=
"/JavaScript/CUSTOM/DataTables-1.7.5/plugins/TableTools-2.0.0/js/TableTools.js"></script> <script type=
"text/javascript" language=
"javascript" src=
"/JavaScript/CUSTOM/DataTables-1.7.5/plugins/TableTools-2.0.0/js/ZeroClipboard.js"></script> <!-- <link type=
"text/css" href=
"/JavaScript/CUSTOM/DataTables-1.7.5/css/demo_table.css" rel=
"stylesheet" /> <link type=
"text/css" href=
"/JavaScript/CUSTOM/DataTables-1.7.5/css/demo_page.css" rel=
"stylesheet" /> <link type=
"text/css" href=
"/JavaScript/CUSTOM/DataTables-1.7.5/css/demo_page_jui.css" rel=
"stylesheet" /> <link type=
"text/css" href=
"/JavaScript/CUSTOM/DataTables-1.7.5/plugins/TableTools-2.0.0/css/TableTools.css" rel=
"stylesheet" /> <link type=
"text/css" href=
"/JavaScript/CUSTOM/jquery-ui-1.8.7/css/smoothness/jquery-ui-1.8.7.custom.css" rel=
"stylesheet" /> -->   <script type=
"text/javascript" charset=
"utf-8"> var appTable; var detailsTable; var SEARCH_MAC = 
'(multiplicity of it as string & "," & "Mac" & "|" &  (if (it contains ".app") then (concatenation of preceding texts of firsts ".app" of it as trimmed string) else (concatenation of preceding texts of lasts "-" of it as trimmed string)) & (if it != "N/A" then "|" & it else "") of concatenation of following texts of lasts "-" of it as trimmed string) of unique values of (values of it as trimmed string) whose (it as lowercase !operator! "!value!" as lowercase and it != ".app - N/A") of (results(item 0 of it, item 1 of it)) of (bes properties whose (name of it = "Installed Applications - Versions - Mac OS X"), bes computers whose (operating system of it starts with "Mac"))'; var SEARCH_LIN = 
'(multiplicity of it as string  & "," & "Linux" & "|" & it & "|" & concatenation of following texts of lasts "-" of preceding texts of lasts "-" of it) of unique values  of (values whose (it as string as lowercase !operator! "!value!" as lowercase and it != "N/A") of results(item 0 of it, item 1 of it)) of (bes properties whose (name of it starts with "RHEL" and name of it ends with "Package List"), bes computers whose (operating system of it as lowercase starts with  "linux"))'; var SEARCH_WIN = 
'(multiplicity of it as string & "," & "Windows" & "|" & it & (if it contains "|" then "" else "|")) of unique values of values whose (it as string as lowercase !operator! "!value!" as lowercase AND it as string as lowercase does not contain "security update for windows" AND it as string as lowercase != regex ".*kb\\d{6}.*" and it as string as lowercase does not contain "hotfix" and it as string as lowercase does not contain "service pack") of results of property 1 of bes fixlet whose (analysis flag of it AND (id of it = 34) AND (name of site of it = "BES Inventory and License"))'; var DETAILS_WIN = 
'unique values of (name of it | "<n/a>" & "|"  & concatenation "; " of (ip addresses of it as string) & "|" & operating system of it & "|" &  last report time of it as string) of (bes computers whose (exists ( (values of results(it, bes property "Installed Applications - Windows")) whose (!details!))))'; var DETAILS_LIN = 
'unique values of (name of it | "<n/a>" & "|"  & concatenation "; " of (ip addresses of it as string) & "|" & operating system of it & "|" &  last report time of it as string) of items 1 of ((values of results(item 0 of it, item 1 of it)) whose (it as string as lowercase = "!details!" as lowercase), items 1 of it) of (bes properties whose (name of it starts with "RHEL" and name of it ends with "Package List"), bes computers whose (operating system of it as lowercase starts with  "linux"))'; var DETAILS_MAC = 
'unique values of (name of it | "<n/a>" & "|"  & concatenation "; " of (ip addresses of it as string) & "|" & operating system of it & "|" &  last report time of it as string) of items 1 of ((values of results(item 0 of it, item 1 of it)) whose (it as lowercase = "!details!" as lowercase and it != ".app - N/A"), items 1 of it) of (bes properties whose (name of it = "Installed Applications - Versions - Mac OS X"), bes computers whose (operating system of it starts with "Mac"))'; $(document).ready(function() 
{ $(
"#apptable tbody").click(function (event) 
{ $(appTable.fnSettings().aoData).each(function ()
{ $(this.nTr).removeClass(
'row_selected'); 
}); row = event.target.parentNode; $(event.target.parentNode).addClass(
'row_selected'); showAppDetails(row); 
} ); appTable = $(
'#apptable').dataTable(
{ 
"aoColumns": [ null, null, null, 

null ], 
"aaSorting": [[1, 
'asc']], 
"sPaginationType": 
"full_numbers", 
"bInfo": true, 
"bPaginate": true, 
"bJQueryUI": true, 
/*"sScrollY": true, */ 
"bStateSave": false, 
"bProcessing": true, 
"iDisplayLength": 20, 
"oLanguage": 
{ 
"sSearch": 
"Filter results:" 
}, 
"sDom": 
'<"H"Tfr>t<"F"ip>', 
"oTableTools": 
{ 
"sSwfPath": 
"/JavaScript/CUSTOM/DataTables-1.7.5/plugins/TableTools-2.0.0/swf/copy_cvs_xls_pdf.swf", 
"aButtons": [ 
"copy", 
{ 
"sExtends": 
"xls", 
"sFileName": 
"Installed Application Counts.csv" 
}, 
{ 
"sExtends": 
"pdf", 
"sFileName": 
"Installed Application Counts.pdf" 
} ] 
} 
} );   
} ); function fnGetSelected( oTableLocal ) 
{ var aReturn = 

new Array(); var aTrs = oTableLocal.fnGetNodes(); 

for ( var i=0 ; i<aTrs.length ; i++ ) 
{ 

if ( $(aTrs+).hasClass(
'row_selected') ) 
{ aReturn.push( aTrs+ ); 
} 
} 

return aReturn; 
} </script> </head> <body class=
"example_alt_pagination"> <h3>Application Search</h3> <div id=
"searchform"> <form> <strong>Application names that:  </strong> <select name=
"operator" id=
"operator"> <option value=
"contains">contain</option> <option value=
"starts with">start with</option> <option value=
"ends with">end with</option> <option value=
"=">equal</option> <option value=
"!=">

do not equal</option> </select> <strong>the string: </strong> <input type=
"text" name=
"application" id=
"application" /> <br/> <strong>Platform:</strong><br/> <input type=
"checkbox" name=
"platform-win" id=
"platform-win" checked=
"checked" /> Windows<br/> <input type=
"checkbox" name=
"platform-mac" id=
"platform-mac" />Mac <br/> <input type=
"checkbox" name=
"platform-lin" id=
"platform-lin" />Linux <br/> <input type=
"button" name=
"search" value=
"Search" onclick=
"SearchForApplications()" /> <br/> <br/><br/> <div id=
"searchingDiv" style=
"display:none"> <strong>Searching...</strong> </div> </div> <div id=
"resultsDiv"> <table id=
"apptable" class=
"display" width=
"100%"> <thead> <tr> <th width=
"50%">Application Name</th> <th width=
"20%">Version</th> <th width=
"10%">Platform</th> <th width=
"20%">Number of Computers</th> </tr> </thead> <tbody id=
"tablebody"> </tbody> </table> </div> <p style=
"font-size:small">Author: Matthew Boyd <br/>Version: 2.0b<br/>Released: 5/10/2011</p> <div id=
"showDetails"></div> <div id=
"showError"></div> <script language=
"javascript" type=
"text/javascript"> var results; function SearchForApplications()
{ searchingDiv.style.display = 
'block'; relevance = 
'elements of union of ('; 

try 
{ appTable.fnClearTable(); 

if ($(
"#platform-win").is(
":checked")) 
{ relevance = relevance + 
'set of (' + SEARCH_WIN + 
')'; 
} 

if ($(
"#platform-mac").is(
":checked")) 
{ 

if ($(
"#platform-win").is(
":checked")) 
{ relevance = relevance + 
";" 
} relevance = relevance + 
'set of (' + SEARCH_MAC + 
')'; 
} 

if ($(
"#platform-lin").is(
":checked")) 
{ 

if ($(
"#platform-mac").is(
":checked")) 
{ relevance = relevance + 
";" 
} relevance = relevance + 
'set of (' + SEARCH_LIN + 
')'; 
} relevance = relevance + 
')'; 

if ($(
"#removebadchars").is(
":checked")) 
{ relevance = 
'(multiplicity of it, it) of unique values of substrings separated by "||" of concatenation of matches (regex "\\p{Print}")  of characters of concatenation "||"  of (' + relevance + 
')'; 
} relevance = relevance.replace(/!operator!/g, $(
"#operator").attr(
"value")).replace(/!value!/g, $(
"#application").val()); results = EvaluateRelevance(relevance); appTable.fnClearTable(); 

for (var i = 0; i < results.length; i++) 
{ result = results+; count = result.substring(0, result.indexOf(
',')); result = result.substring(result.indexOf(
',')+1); platform = result.substring(0, result.indexOf(
'|')); result = result.substring(result.indexOf(
'|')+1); 

if (result.lastIndexOf(
'|') > 0 ) 
{ appTitle = result.substring(0, result.lastIndexOf(
'|')).replace(
'( ', 
''); version = result.substring(result.lastIndexOf(
'|')+1).replace(
' )', 
''); 
}

else 
{ appTitle = result.substring(result.indexOf(
',')) version = 
''; 
} appTable.fnAddData([appTitle, version, platform, count], 

true); 
} 
} 

catch (err)
{ $(
"#showError").html(
'<div class="ui-widget"><div class="state-preview corner-all ui-state-error"><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span><strong> Error: </strong>' + err.message + 
'</div></div><strong>Relevance: </strong><p style="height:200px; width:475px; overflow:auto;">' + relevance + 
'</p>'); showError = $(
"#showError").dialog(
{ autoOpen: true, resizable:false, maxHeight: 250, maxWidth: 500, minHeight: 200, minWidth: 500, modal: true, hide: 
'fade', show: 
'fade', position: 
'top', dialogClass: 
'ui-state-error', title: 
'', buttons: 
{ 
"Ok" : function () 
{ $(

this).dialog(
"close"); 
} 
}, close: function() 
{ $(

this).dialog(
"destroy"); $(
"#showError").html(
''); 
} 
}); 
}   searchingDiv.style.display = 
'none'; 
} function showAppDetails(row) 
{ data = appTable.fnGetData( row );   

try 
{ 

switch(data[2]) 
{ 

case 
"Windows": 

if (data[1] != 
'') 
{ relevance = DETAILS_WIN.replace (/!details!/g, 
'it = "' + data[0] + 
' | ' + data[1] + 
'"'); 
} 

else 
{ relevance = DETAILS_WIN.replace(/!details!/g, 
'it = "' + data[0] + 
'"'); 
} 

break; 

case 
"Mac": relevance = DETAILS_MAC.replace(/!details!/g, data[0] + 
'.app - ' + data[1]); 

break; 

case 
"Linux": relevance = DETAILS_LIN.replace(/!details!/g, data[0]); 

break; 

default: 

throw 

new Error(
'Unknown OS!'); 
}   
/* if (data[1] != '') { relevance = 'unique values of (hostname of it | "<n/a>" & "|"  & concatenation ";" of (ip addresses of it as string) & "|" & operating system of it & "|" &  last report time of it as string) of (bes computers whose (exists ( (values of results(it, bes property "Installed Applications - Windows")) whose (it as lowercase = "' + data[0] + ' | ' + data[1] + '" as lowercase))))' } else { relevance = 'unique values of (hostname of it | "<n/a>" & "|"  & concatenation "; " of (ip addresses of it as string) & "|" & operating system of it & "|" &  last report time of it as string) of (bes computers whose (exists ( (values of results(it, bes property "Installed Applications - Windows")) whose (it as lowercase = "' + data[0] + '" as lowercase))))' } */ results = EvaluateRelevance(relevance); 

if(results.length < 1) 
{ 

throw 

new Error(
'Expected at least one result, but none were returned. Check the relevance clause for clues.'); 
} var showDetails = $(
"#showDetails").dialog(
{ autoOpen: true, maxHeight: 700, maxWidth: 700, minHeight: 200, minWidth: 700, modal: true, hide: 
'fade', show: 
'fade', title: 
"Details: " + data[0], buttons: 
{ 
"Close": function() 
{ $(

this).dialog(
"close"); 

return; 
} 
}, close: function() 
{ $(

this).dialog(
"destroy"); $(
"#showDetails").html(
''); 
} 
}); html = 
'<table width="100%" id="detailsTable"><thead style="background-color:#979797"><tr><th>Name</th><th>IP Address</th> <th>OS</th> <th>Last Reported</th></tr></thead><tbody>'; 

for (var i = 0; i < results.length; i++) 
{ result = results+; resultSplit = result.split(
'|'); html = html + 
'<tr><td>' + resultSplit[0] + 
'</td>' + 
'<td>' + resultSplit[1].replace(/;/g, 
'<br />') + 
'</td>' + 
'<td>' + resultSplit[2] + 
'</td>' + 
'<td>' + resultSplit[3] + 
'</td></tr>'; 
} html = html + 
'</tbody></table>'; $(
'#showDetails').html(html); $(
'#detailsTable').dataTable(
{ 
"aoColumns": [ null, null, null, 

null], 
"aaSorting": [[1, 
'asc']], 
"sPaginationType": 
"full_numbers", 
"bInfo": true, 
"bPaginate": true, 
"bJQueryUI": true, 
/*"sScrollY": true, */ 
"bStateSave": false, 
"bProcessing": true, 
"iDisplayLength": 10, 
"oLanguage": 
{ 
"sSearch": 
"Filter results:" 
}, 
"sDom": 
'<"H"T<"clear">r>t<"F"ip>', 
"oTableTools": 
{ 
"sSwfPath": 
"/JavaScript/CUSTOM/DataTables-1.7.5/plugins/TableTools-2.0.0/swf/copy_cvs_xls_pdf.swf", 
"aButtons": [ 
"copy", 
{ 
"sExtends": 
"xls", 
"sFileName": 
"Computers - " + data[0] + 
" Installed.csv" 
}, 
{ 
"sExtends": 
"pdf", 
"sFileName": 
"Computers - " + data[0] + 
".pdf" 
} ] 
} 
} ); 
} 

catch (err)
{ $(
"#showError").html(
'<div class="ui-widget"><div class="state-preview corner-all ui-state-error"><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span><strong> Error: </strong>' + err.message + 
'</div></div><strong>Relevance: </strong><p style="height:200px; width:475px; overflow:auto;">' + relevance + 
'</p>'); showError = $(
"#showError").dialog(
{ autoOpen: true, resizable:false, maxHeight: 250, maxWidth: 700, minHeight: 200, minWidth: 600, hide: 
'fade', show: 
'fade', modal: true, dialogClass: 
'ui-state-error', title: 
"Error", buttons: 
{ 
"Ok" : function () 
{ $(

this).dialog(
"close"); 
} 
}, close: function() 
{ $(

this).dialog(
"destroy"); $(
"#showError").html(
''); 
} 
}); 
} 
}   </script>   </body> </html>

(imported comment written by SystemAdmin)

Thanks Boyd. I updated the report. Now when I try to select a specific application from the list, it returns this error -

Error: Expected at least one result, but none were returned. Check the relevance clause for clues.

Relevance:

unique values of (name of it | “” & “|” & concatenation "; " of (ip addresses of it as string) & “|” & operating system of it & “|” & last report time of it as string) of (bes computers whose (exists ( (values of results(it, bes property “Installed Applications - Windows”)) whose (it = “Trip Control Stand-alone 03.02.0002.000 | 03.02.0115.000”))))

(imported comment written by Miran_p91)

Having same error as AR81700. Boyd, have you tryied to resolve problem?

(imported comment written by SystemAdmin)

I found an issue only when there’s a parenthesis in the search “WinZip | 11.2 SR-1 (8261)”

otherwise it works fine, and im running Version: 8.1.551.0

the first line throws the error and the second line works fine

unique values of (name of it | “” & “|” & concatenation "; " of (ip addresses of it as string) & “|” & operating system of it & “|” & last report time of it as string) of (bes computers whose (exists ( (values of results(it, bes property “Installed Applications - Windows”)) whose (it = “WinZip | 11.2 SR-1 (8261)”))))

http://forum.bigfix.com/attachment.php?item=414&download=1

(imported comment written by MattBoyd)

Hey guys, sorry I haven’t had any updates recently. Busy busy busy! I think I’ve tracked down the bug that you’re seeing. It occurs when there is a series of spaces in the application name or version… the extra spaces get dropped when they are added to the data table and it turns into one space.

In Mark’s example, there are probably two spaces between ‘SR-1’ and ‘(8261)’ but that gets lost in translation. I’m working on a fix for this… hopefully I’ll get to it tonight.

(imported comment written by Miran_p91)

Have you manage to resolve bug?

A post was split to a new topic: Computer Name instead of Computer Number