Sysdig Platform CLI - Dashboard Panels
This section explains concepts and notations in the set of the Monitor Dashboard Panel commands provided.
Usage
The Dashboard Panel has the following subcommands:
$ sdc-cli dashboard panel
Usage: sdc-cli dashboard panel [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
add Add panel
add_query Add query to a panel
del Delete a panel from a dashboard
del_query Add query to a panel
get Get the info from a panel
list List all the panels in a dashboard
List panels from dashboard
You can list the panels from a dashboard by executing:
$ sdc-cli dashboard panel list 201993
id name type queryCount
1 Rows Stats basicTimechart 4
2 Connections basicTimechart 2
3 Commits / Rollbacks basicTimechart 2
4 Database size basicToplist 1
5 Buffer Hits basicTimechart 1
6 CPU Usage basicTimechart 1
You can also retrieve more information from a panel:
$ sdc-cli dashboard panel get 201993 1
id: 1
name: Rows Stats
type: basicTimechart
queryCount: 4
queries:
id query
0 postgresql.rows_fetched
1 postgresql.rows_deleted
2 postgresql.rows_inserted
3 postgresql.rows_returned
Create panel
You can add more panels to the dashboard using the following subcommand:
sdc-cli dashboard panel add --help
Usage: sdc-cli dashboard panel add [OPTIONS] DASHBOARD NAME TYPE QUERY
Adds a panel to a dashboard.
DASHBOARD The ID of the dashboard to add a panel to.
NAME Name of the new panel.
TYPE Kind of panel, must be one of: [timechart, number].
QUERY PromQL query to add to the new panel.
Options:
--help Show this message and exit.
The query must be in PromQL format. For more information check: Using PromQL
For example, if you want to add a new panel named “New Panel” to the previous dashboard with a TimeChart that shows the cpu usage, you can execute:
$ sdc-cli dashboard panel add 201993 "New Panel" timechart 'avg(avg_over_time(sysdig_host_cpu_used_percent[$__interval]))'
id: 7
name: New Panel
type: advancedTimechart
queryCount: 1
queries:
id query
0 avg(avg_over_time(sysdig_host_cpu_used_percent[$__interval]))
Working with queries
You can add more queries to the panel:
$ sdc-cli dashboard panel add_query 201993 7 'avg(avg_over_time(sysdig_host_cpu_used_percent[$__interval]))'
id: 7
name: New Panel
type: advancedTimechart
queryCount: 2
queries:
id query
0 avg(avg_over_time(sysdig_host_cpu_used_percent[$__interval]))
1 avg(avg_over_time(sysdig_host_cpu_used_percent[$__interval]))
And remove them by ID:
$ sdc-cli dashboard panel del_query 201993 7 1
id: 7
name: New Panel
type: advancedTimechart
queryCount: 1
queries:
id query
0 avg(avg_over_time(sysdig_host_cpu_used_percent[$__interval]))
Remove panel
You can remove panels from dashboards by specifying the ID of the dashboard and the ID of the panel within the dashboard:
$ sdc-cli dashboard panel del 201993 7
Success