Hello,
I was wondering if there is a way that I can set the dashboard view for all users to default to the last hour instead of the last day of logs?
We collect a lot and I think it would benefit overall system performance if we could limit the amount of data being loaded whenever someone launches the dashboard.
Thank you.
Set default dashboard view globally
Re: Set default dashboard view globally
I will file a feature request for this, but in the meantime it could be done via the command line.
First, make a dashboard and then save it as a global dashboard. When you load the dashboard you'll see that the URL in the address bar of the browser changes to something like:
Take note of the last part of the URL - the AW_srrCFUTbg9WYHPURN in my case.
Then run this on the command line:
This will return a result like:
I got the above from a test machine with only one user to make it easier to read, but your system will likely return multiple users. You'll want to note the _id and copy the _source contents for each user that you want to push the dashboard to. Also see that each user has a default_dashboard field. This is what we'll be changing.
To update the user we'll copy the entire _source field and change the default_dashboard. In my example I would run:
Be cautious with this method and make a system backup before making any changes. You can easily break NLS when you start modifying the database directly and having a back will make it easy to revert if needed. See https://assets.nagios.com/downloads/nag ... Server.pdf for steps to create a system backup and restore it before making any changes.
First, make a dashboard and then save it as a global dashboard. When you load the dashboard you'll see that the URL in the address bar of the browser changes to something like:
Code: Select all
https://nls///nagioslogserver/dashboard#/dashboard/elasticsearch/AW_srrCFUTbg9WYHPURNThen run this on the command line:
Code: Select all
curl -XGET 'http://localhost:9200/nagioslogserver/user/_search?pretty'Code: Select all
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "nagioslogserver",
"_type" : "user",
"_id" : "1",
"_score" : 1.0,
"_source":{"username":"nagiosadmin","username_lower":"nagiosadmin","name":"Nagios Administrator","password":"280d44ab1e9f79b5cce2dd4f58f5fe91f0fbacdac9f7447dffc318ceb79f2d02","auth_type":"admin","email":"root@localhost","language":"default","apiaccess":"1","apikey":"59ae99cc398e62680cb82fd631ffaf1f412f6dbf","created":"2020-01-28 09:04:19","created_by":0,"default_dashboard":"/dashboard/elasticsearch/AW_srrKeUTbg9WYHPURS"}
} ]
}
}To update the user we'll copy the entire _source field and change the default_dashboard. In my example I would run:
Code: Select all
curl -XPUT 'http://localhost:9200/nagioslogserver/user/1' -d '{"username":"nagiosadmin","username_lower":"nagiosadmin","name":"Nagios Administrator","password":"280d44ab1e9f79b5cce2dd4f58f5fe91f0fbacdac9f7447dffc318ceb79f2d02","auth_type":"admin","email":"root@localhost","language":"default","apiaccess":"1","apikey":"59ae99cc398e62680cb82fd631ffaf1f412f6dbf","created":"2020-01-28 09:04:19","created_by":0,"default_dashboard":"/dashboard/elasticsearch/AW_srrCFUTbg9WYHPURN"}'As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Set default dashboard view globally
I appreciate the instructions, but I think I'll wait for the feature. This is more of a want than a need.
I don't want to modify the DB directly.
I don't want to modify the DB directly.
Re: Set default dashboard view globally
Fair enough 
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.