mcpField
P
performance-analytics

performance-analytics

github.com/serac-labsデータ・データベース7759 回インストール9 週間前に更新
リポジトリ

performance-analytics について

ServiceNow Performance Analytics の指標、内訳、しきい値、ウィジェット、ダッシュボードを設定するスキルです。分析オブジェクトの作成、指標の検索、スコア取得、データ収集に使う MCP ツールも説明します。

主な機能

  1. 01KPI指標と集計の設定
  2. 02内訳としきい値の定義
  3. 03ウィジェットとダッシュボードの作成
  4. 04指標スコアの収集と取得

活用シーン

  1. 01インシデント件数と解決時間の追跡
  2. 02優先度やチーム別の指標分析
  3. 03推移とKPIしきい値の表示

MCP 対応

指標、内訳、しきい値、ウィジェットの作成、指標の検索とスコア取得、データ収集の開始に使う MCP ツールを説明します。

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/serac-labs/serac --skill performance-analytics

インストール後、Claude Code で/performance-analyticsを入力して読み込まれたか確認します。

詳細

ServiceNow のパフォーマンス分析

パフォーマンス分析(PA)は、ビジネスプロセスの測定と改善に役立つ高度なレポート機能と KPI 追跡機能を提供します。

PA のアーキテクチャ

コンポーネント階層
PA Dashboard
├── Widgets
│   ├── Scorecard Widget
│   ├── Time Series Chart
│   ├── Breakdown Pie Chart
│   └── Single Score
├── Indicators
│   ├── Number of Open Incidents
│   ├── Average Resolution Time
│   └── SLA Compliance Rate
├── Breakdowns
│   ├── By Priority
│   ├── By Assignment Group
│   └── By Category
└── Thresholds
    ├── Critical: > 100
    └── Warning: > 50
主要なテーブル
テーブル用途
pa_indicatorsKPI の定義
pa_indicator_breakdowns指標と内訳のリンク
pa_breakdowns内訳の定義
pa_thresholdsしきい値ルール
pa_widgetsダッシュボードウィジェット
pa_dashboardsダッシュボードコンテナー

指標

指標の種類
種類集計例
CountCOUNT(*)インシデント数
SumSUM(field)合計コスト
AverageAVG(field)平均解決時間
Percentage(A/B)*100SLA 遵守率(%)
Duration時間計算平均解決時間
カウント指標の作成(ES5)
// Create "Open Incidents" indicator
var indicator = new GlideRecord("pa_indicators")
indicator.initialize()
indicator.setValue("name", "Open Incidents")
indicator.setValue("description", "Number of currently open incidents")

// Source configuration
indicator.setValue("cube", "pa_cubes_incident") // or table-based
indicator.setValue("facts_table", "incident")
indicator.setValue("conditions", "active=true")

// Aggregation
indicator.setValue("aggregate", "COUNT") // COUNT, SUM, AVG

// Display settings
indicator.setValue("direction", 2) // 1=Up is good, 2=Down is good
indicator.setValue("unit", "Incidents")
indicator.setValue("precision", 0) // Decimal places

// Scoring
indicator.setValue("frequency", "daily")

indicator.insert()
平均指標の作成(ES5)
// Create "Average Resolution Time" indicator
var indicator = new GlideRecord("pa_indicators")
indicator.initialize()
indicator.setValue("name", "Avg Resolution Time")
indicator.setValue("description", "Average time to resolve incidents")

indicator.setValue("facts_table", "incident")
indicator.setValue("conditions", "state=6") // Resolved

// Aggregation on duration
indicator.setValue("aggregate", "AVG")
indicator.setValue("field", "calendar_duration") // Duration field

// Time unit
indicator.setValue("unit", "Hours")
indicator.setValue("unit_conversion", 3600) // Seconds to hours

indicator.setValue("direction", 2) // Lower is better
indicator.setValue("frequency", "daily")

indicator.insert()
パーセンテージ指標の作成(ES5)
// Create "SLA Compliance" percentage indicator
var indicator = new GlideRecord("pa_indicators")
indicator.initialize()
indicator.setValue("name", "SLA Compliance Rate")
indicator.setValue("description", "Percentage of incidents meeting SLA")

indicator.setValue("facts_table", "task_sla")
indicator.setValue("conditions", "task.sys_class_name=incident")

// Formula-based percentage
indicator.setValue("aggregate", "FORMULA")
indicator.setValue("formula", "(COUNT(has_breached=false) / COUNT(*)) * 100")

indicator.setValue("unit", "%")
indicator.setValue("direction", 1) // Higher is better
indicator.setValue("precision", 1)

indicator.insert()

内訳

一般的な内訳
内訳フィールド使用例
優先度priorityP1/P2/P3 別のインシデント
カテゴリーcategory種類別のインシデント
グループassignment_groupチームのパフォーマンス
場所location地理的分析
時間opened_at傾向分析
内訳の作成(ES5)
// Create "Priority" breakdown
var breakdown = new GlideRecord("pa_breakdowns")
breakdown.initialize()
breakdown.setValue("name", "Priority")
breakdown.setValue("description", "Breakdown by incident priority")

breakdown.setValue("facts_table", "incident")
breakdown.setValue("dimension_field", "priority")

// Sorting
breakdown.setValue("sort_field", "priority")
breakdown.setValue("sort_order", "ASC")

// Element mapping (optional)
breakdown.setValue("use_element_mapping", true)

breakdown.insert()
内訳と指標のリンク(ES5)
// Link breakdown to indicator
var link = new GlideRecord("pa_indicator_breakdowns")
link.initialize()
link.setValue("indicator", indicatorSysId)
link.setValue("breakdown", breakdownSysId)
link.setValue("active", true)
link.insert()

しきい値

しきい値の作成(ES5)
// Create threshold for Open Incidents
var threshold = new GlideRecord("pa_thresholds")
threshold.initialize()
threshold.setValue("indicator", indicatorSysId)
threshold.setValue("name", "Critical Level")

// Threshold conditions
threshold.setValue("operator", ">=") // >=, <=, =, >, <
threshold.setValue("value", 100)

// Visual styling
threshold.setValue("color", "red")
threshold.setValue("icon", "exclamation-circle")

// Notification
threshold.setValue("notification_user", adminSysId)
threshold.setValue("notification_script", thresholdScript)

threshold.insert()

// Add warning threshold
var warning = new GlideRecord("pa_thresholds")
warning.initialize()
warning.setValue("indicator", indicatorSysId)
warning.setValue("name", "Warning Level")
warning.setValue("operator", ">=")
warning.setValue("value", 50)
warning.setValue("color", "orange")
warning.insert()

ウィジェット

ウィジェットの種類
種類使用例表示内容
Single Score現在値「未解決のインシデント 127 件」
Scorecard値と傾向現在値とスパークライン
Time Series時間経過に伴う傾向折れ線/棒グラフ
Breakdownディメンション別円/棒グラフ
Comparison複数の指標横並び
ウィジェットの作成(ES5)
// Create scorecard widget
var widget = new GlideRecord("pa_widgets")
widget.initialize()
widget.setValue("name", "Open Incidents Scorecard")
widget.setValue("type", "scorecard")

// Indicator
widget.setValue("indicator", indicatorSysId)

// Time range
widget.setValue("time_range", "last_30_days")
widget.setValue("show_trend", true)
widget.setValue("compare_to", "previous_period")

// Display
widget.setValue("show_breakdown", true)
widget.setValue("breakdown", priorityBreakdownSysId)
widget.setValue("chart_type", "bar")

widget.insert()

ダッシュボード

ダッシュボードの作成(ES5)
// Create PA Dashboard
var dashboard = new GlideRecord("pa_dashboards")
dashboard.initialize()
dashboard.setValue("name", "Incident Management Dashboard")
dashboard.setValue("description", "Key metrics for incident management")

// Layout
dashboard.setValue("layout", "2-column")

// Access control
dashboard.setValue("public", true)
dashboard.setValue("owner", gs.getUserID())

var dashboardSysId = dashboard.insert()

// Add widgets to dashboard
function addWidgetToDashboard(dashboardId, widgetId, row, column) {
  var placement = new GlideRecord("pa_dashboard_widgets")
  placement.initialize()
  placement.setValue("dashboard", dashboardId)
  placement.setValue("widget", widgetId)
  placement.setValue("row", row)
  placement.setValue("column", column)
  placement.insert()
}

addWidgetToDashboard(dashboardSysId, openIncWidget, 0, 0)
addWidgetToDashboard(dashboardSysId, avgTimeWidget, 0, 1)
addWidgetToDashboard(dashboardSysId, slaWidget, 1, 0)

データ収集

手動でのスコア収集(ES5)
// Collect scores for an indicator
var job = new PAScoreCollector()
job.collectIndicatorScores(indicatorSysId)
スケジュール収集
// PA uses scheduled jobs for data collection
// Default: Daily at midnight
// Configure via: Performance Analytics > Data Collection > Jobs

MCP ツールとの連携

利用可能な PA ツール
ツール用途
snow_pa_create (action='indicator')指標を作成
snow_pa_create (action='breakdown')内訳を作成
snow_pa_create (action='threshold')しきい値を作成
snow_pa_create (action='widget')ウィジェットを作成
snow_pa_operate (action='get_scores')スコアを取得
snow_pa_operate (action='collect_data')収集を開始
snow_pa_discover (action='indicators')指標を検索
ワークフローの例
// 1. Create indicator
var indicatorResult = await snow_pa_create({
  action: "indicator",
  name: "Open P1 Incidents",
  table: "incident",
  conditions: "active=true^priority=1",
  aggregate: "COUNT",
})
var indicatorId = indicatorResult.sys_id

// 2. Create breakdown
var breakdownResult = await snow_pa_create({
  action: "breakdown",
  name: "By Assignment Group",
  table: "incident",
  field: "assignment_group",
})
var breakdownId = breakdownResult.sys_id

// 3. Attach the breakdown to the indicator
//    (add_breakdown creates the breakdown + the indicator link in one step)
await snow_pa_indicator_manage({
  action: "add_breakdown",
  sys_id: indicatorId,
  breakdown_name: "By Assignment Group",
  breakdown_table: "incident",
  breakdown_field: "assignment_group",
})

// 4. Create threshold
await snow_pa_create({
  action: "threshold",
  indicator: indicatorId,
  type: "critical",
  operator: ">=",
  value: 10,
})

// 5. Create widget
await snow_pa_create({
  action: "widget",
  name: "P1 Incidents Scorecard",
  type: "scorecard",
  indicator: indicatorId,
  breakdown: breakdownId,
})

// 6. Get current scores
var scores = await snow_pa_operate({
  action: "get_scores",
  indicator_sys_id: indicatorId,
  time_range: "last_30_days",
})

ベストプラクティス

  1. 方向が重要です - 正しく設定します(上昇/下降のどちらが良いか)。
  2. 意味のあるしきい値 - ビジネス要件に基づいて設定します。
  3. 一貫した頻度 - データの変動性に合わせます。
  4. 内訳を使用する - 詳細分析を可能にします。
  5. ダッシュボードの目的 - ダッシュボードごとに焦点を 1 つに絞ります。
  6. 傾向分析 - 常に比較を表示します。
  7. パフォーマンス - 有効な指標の数を制限します。
  8. ドキュメント - 指標を明確に説明します。

コメント