EC2 ,AWS,cloud service account ci relationship
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 11:54 AM
Hi All,
We are importing Account ID, SerialNo, Region information from JDBC integraion. want to create relationship as below in cmdb_rel_ci table.
We can find the EC2 CI with Serial Number, AWS Datacenter CI with Region, and find the Cloud Service Account CI with Account ID.
- EC2 Virtual Machine Instance (cmdb_ci_ec2_instance) Hosted on::Hosts AWS Datacenter (cmdb_ci_aws_datacenter)
- AWS Datacenter (cmdb_ci_aws_datacenter) "Hosted on::Hosts" Cloud Service Account CI (cmdb_ci_cloud_service_account).
if any row is missing serial number ,region or Account ID from import then that row should be ignored.There should not be duplicates with same relationship.
Please help me here.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 11:42 PM - edited 08-02-2024 11:45 PM
要点と解決策の要約
前回の回答で説明した重要なポイントと潜在的な解決策の要約は次のとおりです。
- 欠損データの処理:
- 条件付きレコード作成: すべての必須フィールドに値がある場合にのみレコードを作成します。
- デフォルト値: 適切な場合は、不足しているフィールドにデフォルト値を割り当てます。
- ステータス管理: 不足しているデータに対して「保留中」ステータスのレコードを作成し、後で手動で確認します。
- 重複レコードの防止:
- 一意のインデックス: 関係を定義するフィールドの組み合わせに一意のインデックスを作成します。
- 挿入/更新前のビジネス ルール: 挿入または更新する前に、同じ関係を持つ既存のレコードを確認します。
- 関連リスト クエリ: 関連リスト クエリを使用して重複を検索します。
ソリューションの拡張と潜在的な問題への対処
これらのソリューションをさらに詳しく調べ、追加の要素を考慮してみましょう。
- データ品質:
- データ クレンジング: インポート前にデータの一貫性と正確性を確保するために、データ クレンジング スクリプトを実装します。
- 検証ルール: データの整合性を強化し、無効なデータの入力を防ぐための検証ルールを作成します。
- パフォーマンスの最適化:
- バッチ処理: 大規模なデータセットの場合は、パフォーマンスを向上させるためにバッチ処理を検討してください。
- インデックス作成: 頻繁にクエリされるフィールドの適切なインデックス作成を確実に行います。
- クエリの最適化: 効率性を高めるためにクエリを確認して最適化します。
- エラー処理とログ記録:
- エラー メッセージ: トラブルシューティングに役立つ、明確でわかりやすいエラー メッセージを提供します。
- ログ記録: 分析と監査のためにエラーと例外を記録します。
- カスタマイズ:
- カスタム スクリプト: 特定のビジネス ロジックと要件を処理するためのカスタム スクリプトを作成します。
- ワークフロー: ワークフローを利用してタスクを自動化し、ビジネス プロセスを実施します。
コード例(ビジネスルール挿入前、JavaScript)※未テスト
// 同じ関係を持つ既存のレコードをクエリします
var gr = new GlideRecord ( 'cmdb_rel_ci' );
gr. addQuery ( 'source' , current. source );
gr. addQuery ( 'target' , current. target );
gr. addQuery ( 'relationship' , current. relationship ); gr. query ();
if (gr. next ())
{
gs. addErrorMessage ( '重複レコードが見つかりました。データを確認してください。' );
current. setAbortAction ( true );
}
})(current, previous);
- データ ガバナンス: データの品質と一貫性を確保するためのデータ ガバナンス ポリシーを確立します。
- 変更管理: CMDB への変更を制御するための変更管理プロセスを実装します。
- テスト: 意図しない結果を避けるために、CMDB への変更を徹底的にテストします。
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 03:08 AM - edited 08-05-2024 10:20 AM
Hi Hiroshi,
Thanks for your response.
Could you please help me with transform map script to insert required relationships in cmdb_rel_ci table.As mentioned we will be receiving Account ID, SerialNo, Region data from data source in import set.
We can find the EC2 CI with Serial Number from EC2CI table, AWS Datacenter CI with Region from AWS data center table, and find the Cloud Service Account CI with Account ID from cloud service account table .we need to insert relationships record with relationships as below.
- EC2 Virtual Machine Instance (cmdb_ci_ec2_instance) Hosted on::Hosts AWS Datacenter (cmdb_ci_aws_datacenter)
- AWS Datacenter (cmdb_ci_aws_datacenter) "Hosted on::Hosts" Cloud Service Account CI (cmdb_ci_cloud_service_account).
i.e.one inserted row from data source in import set will insert 2 records in cmdb_rel_ci table.
if any of required data is not received/empty from the import i.e. if serial number/account Id or region is empty then whole row should be ignored and no relationship should be inserted for that row.There should be no duplicate relationship inserted .
Thanks & regards
Abhishek