-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkibana-theme-switch.sh
More file actions
executable file
·30 lines (27 loc) · 949 Bytes
/
Copy pathkibana-theme-switch.sh
File metadata and controls
executable file
·30 lines (27 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
ELASTIC_URL='https://127.0.0.1:9200'
KIBANA_URL='http://127.0.0.1:5601/api/saved_objects/config'
USERPASS="mylogin:mypassword"
KIBANA_VERSION=$(curl -s -u "$USERPASS" "$ELASTIC_URL" | grep -A1 '"version"' | grep number | awk -F '"' '{print $4}')
if [ -z "$KIBANA_VERSION" ] ; then
echo "cannot get elasticsearch version at $ELASTIC_URL"
exit 1
fi
if [ "$1" == "sunrise" ] ; then
curl -s -u "$USERPASS" -XPUT -H "Application/json" -H "Content-type: application/json" -H "kbn-xsrf: kibana" $KIBANA_URL/$KIBANA_VERSION -d'
{
"attributes": {
"theme:darkMode": false
}
}' > /dev/null
elif [ "$1" == "sunset" ] ; then
curl -s -u "$USERPASS" -XPUT -H "Application/json" -H "Content-type: application/json" -H "kbn-xsrf: kibana" $KIBANA_URL/$KIBANA_VERSION -d'
{
"attributes": {
"theme:darkMode": true
}
}' > /dev/null
else
echo "Usage: $0 [sunset|sunrise]"
exit 1
fi