Hi usemodperl,
First of all I want to say thanks so much for this tutorial type solution!
After changing the following line from
# PUT my BEFORE ALL VARIABLES TO PREVENT TYPOS LATER ON:
my @data = <DATA>;
to:
my @data = <FILE>;
here are my results after parsing the actual file:
results:
UNKNOWN:
UNKNOWN:
UNKNOWN:
UNKNOWN:
UNKNOWN:
UNKNOWN: ServerName
UNKNOWN: 10.10.10.11
UNKNOWN: bfRootServer (0)
OS: Linux Red Hat Enterprise Server 6.9 (2
+.6.32-696.23.1.el6.x86_64)
UNKNOWN: Fri, 22 Jun 2018 10:26:53 -050
+0
UNKNOWN: 9.2.1.48
UNKNOWN: SUpportGroup1
UNKNOWN:
UNKNOWN:
UNKNOWN:
UNKNOWN: 34.402ms
UNKNOWN: Plural
UNKNOWN:
UNKNOWN:
UNKNOWN:
contents of the source text/xml file excluding the actual infrastrucure names:
<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNa
+mespaceSchemaLocation="BESAPI.xsd">
<Query Resource="(names of it, ip addresses of it, root server
+ of it, operating systems of it, last report time of it, agent versio
+ns of it, values of results from (BES Property "_SupportGroup&qu
+ot;) of it) of bes computers whose ( name of it as lowercase starts w
+ith "ServerName")">
<Result>
<Tuple>
<Answer type="string">ServerName</Answ
+er>
<Answer type="string">10.10.10.1`</Ans
+wer>
<Answer type="string">bfRootServer (0)
+</Answer>
<Answer type="string">Linux Red Hat En
+terprise Server 6.9 (2.6.32-696.23.1.el6.x86_64)</Answer>
<Answer type="time">Fri, 22 Jun 2018 1
+0:26:53 -0500</Answer>
<Answer type="string">9.2.1.48</Answer
+>
<Answer type="string">SupportGroup1</A
+nswer>
</Tuple>
</Result>
<Evaluation>
<Time>34.402ms</Time>
<Plurality>Plural</Plurality>
</Evaluation>
</Query>
</BESAPI>
So to summarize what my desired output after parsing the file is:
Computer: ServerName
IP Address: 10.10.10.11
Root Server: bfRootServer
OS: Windows Server 2012
Last Report Time: Fri, 22 Jun 2018 10:26:53 -0500
BES Agent Version: 9.2.1.48
Support Group: SupportGroup1
Thanks again!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.