1 of 1 people found this helpful
Based on your example command, it looks like you have already seen this post by Daniel Vallejo on BMC Communities. The mposter command you show in your example will only create one record in the DDBL_MATCH_TABLE that will black out all events for a device whose host name is 'mc_host'. It won't even do that until you create a dynamic policy that uses the table.
Unfortunately, you can't load a .CSV file directly into a table with mposter. We provide a utility called mcsvtodde that allows you to load .CSV files for dynamic enrichment policies. Unfortunately, it does not work for dynamic blackout policies. The post I refer to above describes a workaround that involves writing the output of mcsvtodde to a file and then replacing the references to DDEN_MATCH_TABLE with DDBL_MATCH_TABLE. You can then use the file as input to the mposter command and that will populate your dynamic blackout policy data table.
That only solves part of your problem, though. You still need to create a a dynamic blackout policy, a selector and a time frame. This can also be done with the mposter command, although I am not sure why you would want to do this. Normally the goal is to create one (or a few) dynamic blackout policies and then use the DDBL_MATCH_TABLE to control the details of which events or devices get blacked out. I can see why you might want to create time frames from the command line, but you should try to use the DDBL_MATCH_TABLE to control the other blackout parameters as much as possible. That said, I will show you how to create everything from the command line: the policy, the selector and the time frame(s).
The easiest way to do this is to create a dynamic blackout policy in the Administration Console first, export the data to files, modify the files to your needs and then mposter the new policy data back into the cell. You don't have to use BAROC files as the inputs to your mposter command. You can include the slot values in the command line if you prefer. My examples use files. I also provide one example of how to create a dynamic policy completely from the command line, without using an input file.
Here are the steps:
1. Create a dynamic blackout policy and an associated selector and time frame in the TSIM Administration Console. I am going to assume you already know how to do this.
2. Using the mquery command, export the policy, selector and time frame data to baroc files so you can see how the data is represented internally. Note that my example below uses a Suppression Policy, rather than a Dynamic Blackout policy. The principle is the same, regardless of policy type.
mquery -n <your TSIM cell name> -d -a IM_POLICY -w "name: equals 'My_Suppression_Policy'" -f BAROC -q > policy.baroc
mquery -n <your TSIM cell name> -d -a SELECTOR -w "name: equals 'My_Selector'" -f BAROC -q > selector.baroc
mquery -n <your TSIM cell name> -d -a TIME_FRAME -w "name: equals 'My_Timeframe'" -f BAROC -q > timeframe.baroc
I recommend you exclude the cell-managed slots in your query output. The commands above give you all slots for the data record. You want to exclude the slots in red below and export only the minimum slots required to create the policy. The cell will create the other slots automatically when you mposter the new data back in.
description='Suppress unwanted events';
Here are some example mquery commands with the exclusion argument:
mquery -n <your TSIM cell name> -d -a IM_POLICY -w "name: equals 'My_Suppression_Policy'" -x "data_handle, mc_udid, mc_creation_time, mc_modification_time, mc_modification_requestor, publish_env_id" -f BAROC -q > policy.baroc
mquery -n <your TSIM cell name> -d -a SELECTOR -w "name: equals 'My_Selector'" -x "data_handle, mc_udid, mc_creation_time, mc_modification_time, mc_modification_requestor, publish_env_id" -f BAROC -q > selector.baroc
mquery -n <your TSIM cell name> -d -a TIME_FRAME -w "name: equals 'My_Timeframe'" -x "data_handle, mc_udid, mc_creation_time, mc_modification_time, mc_modification_requestor, publish_env_id" -f BAROC -q > timeframe.baroc
3. Edit the policy, selector and time frame BAROC files to define your new dynamic blackout policy. You do not need to assign values to every slot. You may need to experiment to identify which slots are required and which are optional.
4. Upload the contents of the files to your TSIM cell with the mposter command:
mposter -n <your TSIM cell name> -d timeframe.baroc
mposter -n <your TSIM cell name> -d selector.baroc
mposter -n <your TSIM cell name> -d policy.baroc
NOTE: The order in which you upload the files is important. The policy records contain references to the time frames and selectors. You need to upload the time frames and selector first so they exist in the cell when you upload the policy, otherwise you will get errors.
5. (Optional) Once you are satisfied that you are able to create new policies, selectors and time frames using BAROC files as inputs to mposter, try including the policy details in the command line. Here is an example. (Note that I have not tested this particular command line example, but it should work.):
mposter -n <your TSIM cell name> -d -a IM_POLICY -b "name='My_Suppression_Policy';description='Suppress unwanted events';enabled=0;active_timeframes=[My_Timeframe];selector_name='My_Selector';selector_class=EVENT;selector_ecf='*Test_Events ($EV)';ordinal=0;during_schedule=YES"
Hi Brendan, thank you very much for your help! I can already create the policies, time frame and selector by command.
Now I need to be able to import the devices from the .csv
I explain what I need:
From REMEDY CHANGE 8.5, they enter a maintenance request for various devices where they define:
* Start time and end maintenance
* Designated user
* And .csv with the devices / nodes
Currently the designated users read that information and manually blackout the devices one by one.
I want to automate and when they enter REMEDY the change request sends the .csv file to the TSIM server and runs a .bat with the commands to create the policy, selector and time (according to the time and data that comes in the. csv).
Thank you very much
You didn't mention in your original post that you were using Remedy Change Management. Are you aware that there is already a standard integration between Remedy Change Management and BPPM/TSIM that is designed to do exactly what you are trying to do? Here is a link to the documentation that explains what the integration does. This link will take you to the list of product versions for which this integration is supported against TSIM 11. (Note that there is no mention of Remedy Change Management 8.5. I can find no record of an 8.5 version of the Remedy ITSM Suite or Remedy Change. Are you sure your version number is correct?) The change management integration is available in previous versions of BPPM/TSIM back to BPPM 9.5.
If I were you, I would first investigate whether the standard, supported integration between Remedy Change Management and BPPM/TSIM will work for your requirement. I am pretty sure it will not be able to use your .CSV file. I believe you will have to link the change request and the related maintenance window to all the CIs (devices) for which you want to black out events. I am not a Remedy expert, so you will need to consult your Remedy support team to determine if this is possible.
If you are not able to use the standard, fully-supported integration and you want to proceed with your original approach, I would offer you the following guidance:
1. As I mention in my initial response to your post, you should not need to constantly create new dynamic policies and selectors. We call them 'dynamic' for a reason. Their behavior changes based on the contents of an associated data table. The specifics of which devices get blacked out during which time frames should be managed in the data (.CSV), not in the policy. You should be able to create a single, permanent dynamic blackout policy whose selector is very general. The details of the blackouts are controlled by updating the data file and, if necessary, the time frames. You should not need to change the policy, or constantly create new policies.
2. Yes, you can run a .BAT file or a .CMD file (on Windows) to automatically load the .CSV data into the Dynamic Blackout data table. However, you will need to use the workaround I mentioned in my initial response. It is described in this Communities post. It uses the mcsvtodde utility that comes with BPPM/TSIM to convert the .CSV data into a format that can be understood by mposter and write it to a file. You will then need to run the Windows command file provided by Bhuvaneswaran Ekanathan, or some other similar tool to modify the output of mcsvtodde to replace all references to DDEN_MATCH_TABLE with DDBL_MATCH_TABLE. This step is required because mcsvtodde is designed to update Dynamic Enrichment Policies, not Dynamic Blackout Policies. Unfortunately, the table name is hard-coded in mcsvtodde.
Review the documentation for mcsvtodde to see examples of the syntax. In particular, take note of the -r argument. It allows you to replace the existing contents of the data table rather than adding the new data.
Once you have replaced the table name in the mcsvtodde data, you can run mposter to load the data into the cell:
mposter -n <your TSIM cell name> -d mcsvtodde_output_file.baroc.
Again, my advice is to try to use the standard, supported integration before spending the time and effort to build (and support) your custom solution.