I'm not really familiar with postgres and need to figure out how to add / delete / update users from the command line and further more a bash script. I took a look at the table xi_users already and can see some of the information i'll need to modify here. What I don't see is privilege information and not sure where that can be.
I'm also unsur what the colume "backend_ticket" is in xi_user and is it required?
I have about 100 users I need to add and the gui would just be plain torture.
Thanks in advance for the help.
User Management inside Postgres
User Management inside Postgres
----------------------
Nagios Jedi in training.
Nagios Jedi in training.
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: User Management inside Postgres
So, as far as privilege information, do you mean within the web interface? That is handled when new users are pulled into:
That is done as part of the user creation procedure in the web interface, it can be manually edited, which you would need to end up doing if you are going with a scripted route.
Code: Select all
/usr/local/nagios/etc/cgi.cfgRe: User Management inside Postgres
This is a unique id that can be used for limited passwordless logins for rapid response and external dashboards.technick wrote: I'm also unsur what the colume "backend_ticket" is in xi_user and is it required?
Apologies for the slow drawn and quartering, but you may run into some issues if you add with the cli - specifically, core contacts need to created, the xi user in the db needs to be created along with all the necessary fields, and the cgis need to be edited. So it may be scriptable, but it will not be easy.technick wrote: I have about 100 users I need to add and the gui would just be plain torture.
Do you have an intern to do this for you ?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: User Management inside Postgres
So just from my testing, this is what I have found so far.
I created a "testuser" from the gui and that user has never been logged into. User is not made a monitoring contact as well, this is strictly for accessing nagios xi web interface, manage monitoring services and manage configurations.
Code: Select all
nagiosxi=> select * from xi_users where username = 'testuser' ;
user_id | username | password | name | email | backend_ticket | enabled
---------+----------+----------------------------------+-----------+---------------------------+------------------------------------------------------------------+---------
55 | testuser | 098f6bcd4621d373cade4e832627b4f6 | test user | [email protected] | h0bd3tjemh4mopneo4micljch9i0m2g63qi3l4gckhvdamovoeg203bfbtguuv2u | 1
(1 row)Code: Select all
nagiosxi=> select * from xi_usermeta where user_id = 55 ;
usermeta_id|user_id|keyname|keyvalue|autoload
647|55|advanced_user|0|1
645|55|authorized_for_all_object_commands|0|1
643|55|authorized_for_all_objects|0|1
646|55|authorized_for_monitoring_system|0|1
644|55|authorized_to_configure_objects|0|1
641|55|date_format|1|1
624|55|enable_notifications|1|0
639|55|language||1
638|55|name|test user|1
637|55|notification_times|a:7:{i:0;a:2:{s:5:"start";s:5:"00:00";s:3:"end";s:5:"24:00";}i:1;a:2:{s:5:"start";s:5:"00:00";s:3:"end";s:5:"24:00";}i:2;a:2:{s:5:"start";s:5:"00:00";s:3:"end";s:5:"24:00";}i:3;a:2:{s:5:"start";s:5:"00:00";s:3:"end";s:5:"24:00";}i:4;a:2:{s:5:"start";s:5:"00:00";s:3:"end";s:5:"24:00";}i:5;a:2:{s:5:"start";s:5:"00:00";s:3:"end";s:5:"24:00";}i:6;a:2:{s:5:"start";s:5:"00:00";s:3:"end";s:5:"24:00";}}|0
625|55|notify_by_email|1|0
626|55|notify_host_down|1|0
630|55|notify_host_downtime|1|0
629|55|notify_host_flapping|1|0
628|55|notify_host_recovery|1|0
627|55|notify_host_unreachable|1|0
633|55|notify_service_critical|1|0
636|55|notify_service_downtime|1|0
635|55|notify_service_flapping|1|0
634|55|notify_service_recovery|1|0
632|55|notify_service_unknown|1|0
631|55|notify_service_warning|1|0
642|55|number_format|2|1
648|55|readonly_user|0|1
640|55|theme||1
623|55|userlevel|255|1
(26 rows)Questions... The column for the backend_ticket is "character varying(128)". Can I just use a randomly generated string up to 128 characters or are there limitations to the string length?
I'm not very familiar with postgres, how do I generate the password hash?
Am I missing anything else that would need to be updated?
Thanks!
----------------------
Nagios Jedi in training.
Nagios Jedi in training.
Re: User Management inside Postgres
By banging your head on the keyboard. Get a kitten to helptechnick wrote:Questions... The column for the backend_ticket is "character varying(128)". Can I just use a randomly generated string up to 128 characters or are there limitations to the string length?
I'm not very familiar with postgres, how do I generate the password hash?
Seriously though, this number is just randomly generated. No hashing of the username/pass required.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.