9 Graph (classic)

Apraksts

Šie parametri un iespējamās attiecīgo paneļa logrīka lauku objektu īpašību vērtības ļauj konfigurēt Graph (classic) logrīku dashboard.create un dashboard.update metodēs.

Logrīka fields īpašības netiek validētas paneļa izveides vai atjaunināšanas laikā. Tas ļauj lietotājiem modificēt iebūvētos logrīkus un izveidot pielāgotus logrīkus, taču vienlaikus rada arī risku izveidot vai atjaunināt logrīkus nepareizi. Lai nodrošinātu veiksmīgu Graph (classic) logrīka izveidi vai atjaunināšanu, lūdzu, skatiet tālāk esošajās tabulās aprakstīto parametru darbību.

Parametri

Tālāk norādītie parametri ir atbalstīti Graph (classic) sīkrīkam.

Parameter type name value
Refresh interval 0 rf_rate 0 - Nav atsvaidzināšanas;
10 - 10 sekundes;
30 - 30 sekundes;
60 - (noklusējums) 1 minūte;
120 - 2 minūtes;
600 - 10 minūtes;
900 - 15 minūtes.
Source 0 source_type 0 - (noklusējums) Graph;
1 - Vienkāršs grafiks.
Graph 6 graphid.0 Graph ID.

Parameter behavior:
- required if Source is set to "Graph"
Graph (Widget) 1 graphid._reference Instead of Graph ID:
ABCDE._graphid - set a compatible widget (with its Reference parameter set to "ABCDE") as the data source for graphs.

Parameter behavior:
- required if Source is set to "Simple graph" and Graph is not set
Item 4 itemid.0 Item ID.

Parameter behavior:
- required if Source is set to "Simple graph" and Item (Widget) is not set
Item (Widget) 1 itemid._reference Instead of Item ID:
ABCDE._itemid - set a compatible widget (with its Reference parameter set to "ABCDE") as the data source for items.

Parameter behavior:
- required if Source is set to "Simple graph" and Item is not set
Time period 1 time_period._reference DASHBOARD._timeperiod - set the Time period selector as the data source;
ABCDE._timeperiod - set a compatible widget (with its Reference parameter set to "ABCDE") as the data source.

Default: DASHBOARD._timeperiod

Alternatively, you can set the time period only in the From and To parameters.
From 1 time_period.from Valid time string in absolute (YYYY-MM-DD hh:mm:ss) or relative time syntax (now, now/d, now/w-1w, etc.).

Parameter behavior:
- supported if Time period is not set
- required if time_period.to is set
To 1 time_period.to Valid time string in absolute (YYYY-MM-DD hh:mm:ss) or relative time syntax (now, now/d, now/w-1w, etc.).

Parameter behavior:
- supported if Time period is not set
- required if time_period.from is set
Show legend 0 show_legend 0 - Atspējots;
1 - (noklusējums) Iespējots.
Override host 1 override_hostid._reference ABCDE._hostid - set a compatible widget (with its Reference parameter set to "ABCDE") as the data source for hosts;
DASHBOARD._hostid - set the dashboard Host selector as the data source for hosts.

This parameter is not supported if configuring the widget on a template dashboard.
Reference 1 reference Any string value consisting of 5 characters (e.g., ABCDE or JBPNL). This value must be unique within the dashboard to which the widget belongs.

Parameter behavior:
- required

Piemēri

Tālāk sniegto piemēru mērķis ir tikai aprakstīt paneļa logrīka lauku objektu konfigurāciju logrīkam Graph (classic). Plašāku informāciju par paneļa konfigurēšanu skatiet dashboard.create.

Graph (classic) logrīka konfigurēšana

Konfigurējiet Graph (classic) logrīku, kas attēlo vienkāršu grafiku vienumam "42269".

Pieprasījums:

{
    "jsonrpc": "2.0",
    "method": "dashboard.create",
    "params": {
        "name": "My dashboard",
        "display_period": 30,
        "auto_start": 1,
        "pages": [
            {
                "widgets": [
                    {
                        "type": "graph",
                        "name": "Graph (classic)",
                        "x": 0,
                        "y": 0,
                        "width": 36,
                        "height": 5,
                        "view_mode": 0,
                        "fields": [
                            {
                                "type": 0,
                                "name": "source_type",
                                "value": 1
                            },
                            {
                                "type": 4,
                                "name": "itemid.0",
                                "value": 42269
                            },
                            {
                                "type": 1,
                                "name": "reference",
                                "value": "RSTUV"
                            }
                        ]
                    }
                ]
            }
        ],
        "userGroups": [
            {
                "usrgrpid": 7,
                "permission": 2
            }
        ],
        "users": [
            {
                "userid": 1,
                "permission": 3
            }
        ]
    },
    "id": 1
}

Atbilde:

{
    "jsonrpc": "2.0",
    "result": {
        "dashboardids": [
            "3"
        ]
    },
    "id": 1
}

Skatiet arī