I created a perl script that runs mquery to extract events from the mcell db. The script is run every hour and populates a database that we keep separate in order to do event reporting. I didn't like the limited functionality of the BMC Event Management Reporting piece, so I built my own. As part of this offering, is the associated time/date converter that was mentioned in my previous posting.
I was thinking about becoming a BMC Partner and offering these kinds of products and services at some point in addition to a few others. After I have compiled and tested it on several different OS's, you may see an announcement from me on an alternative reporting tool for event reporting. This requirement is highly needed in companies that use Impact Explorer by their operations teams to be the first responders. More detailed reporting is required in order for this to be a success.
I also wrote a similar script some long time ago - it's called mqt.pl and looks like this:
use POSIX 'strftime';
[sprintf "%s='%s';", $1, strftime('%Y-%m-%d %H:%M:%S', localtime $2)]ie;
You simply pipe this script to the output of mquery:
mquery -n <cell> -f baroc | mqt.pl
In all lines containing slots with 'time' or 'date' in their names and a 10-digit-epoch as value, the epoch is replaced with its text representation. Note that I've tried to preserve MRL syntax by placing the date and time string under single quotes and adding the trailing semicolon.
I too am trying to get the time converted to a readable format.
I tried to use it in the way you mentioned but the times were in the same hex format unless I am missin something.
trying to run the following query
mquery -a EVENT -n <cellname> -w "severity: == CRITICAL AND status: == CLOSED AND date: between[20121217, 20121218]" -s "date,severity,msg,status,mc_operations,mc_notes,mc_date_modification" -v -f BAROC > xyz1309.csv | mqt.pl
I want to capture the correct time format for mc_operations and mc_notes field. Please advise how do I achieve this using your script.
Thanks in advance
Thanks for the information Ferry, but where will I get the report saved? Is the query that I run correct? I redirect the output to a file xyz1309.baroc and then use pipe and the script.
mquery -a EVENT -n -w "severity: == CRITICAL AND status: == CLOSED AND date: between[20121217, 20121218]" -s "date,severity,msg,status,mc_operations,mc_notes,mc_date_modification" -v -f BAROC > xyz1309.baroc | mqt.pl
It still gives the hex date. Can you please explain the step by step process I need to follow and where will I get the data?
Thanks and Regards
Which OS are you working under? What is the output of mquery without any piping or redirection? Have you verified that there are events matching your selection criterias?
And just one note on command syntax - the -n option specifies the target cell you want to access, so it requires an argument, e.g.:
(wheren "mycell" is the cell name which must be registered in mcell.dir).
In your command, the cell name is missing.Where did you get this command from?
OS is windows and I have used mquery lot of times to get the event data and reports for the criteria I have mentioned. I had not mentioned the cell name in the post due to security reasons here but I know how to use it.
The mquery that you mentioned, when I use it just opens the perl script and when I close the file it returns to the command prompt.
I have placed the perl script in the perl directory. I am trying to understand why the script does not return the expected events with the time format converted.
It's never a good idea to post an incomplete command! How should I know that you've omitted somewhat "for security reasons"? If you actually want to omit some part, replace it with a small text, eg:
BTW: I can't see any risk to post a cell name here, but it's up to you... Did you have omitted further parts of the command for security reasons? If so, please post them as suggested.
And my initial question was to run the mquery command WITHOUT redirection and WITHOUT the perl script. Just the mquery command, and post its output here.
Please see the output without any redirection or perl script
C:\Program Files\BMC Software\ProactiveNet>mquery -a EVENT -n pncell_BPPM01 -w " severity: == CRITICAL AND status: == CLOSED AND date: between[20121217, 20121218]" -s "date" -v -f BAROC
BMC Impact Query 8.6.02 (Build 221073454 - 24-Jun-2011)
Copyright 1998-2011 BMC Software, Inc. as an unpublished work. All rights reser