You are here

Could not do any settins operation in admin GUI account

18 posts / 0 new
Last post
Lufan
lchen's picture
Could not do any settins operation in admin GUI account

Hello Experts,

I am new to opsview and I am running version 3 of opsview(dpkg -l shows: opsview-core   3.20131016.0.14175-1precise1).  I used to be able to clone a host configuration but now I could not, nor reload the system or any operations related to Settings.  Apparently someone changed admin account's permission.  When I tried to clone a host, I got:

Host > Clone A10-EAST-THUNDER     New Host cloned from A10-EAST-THUNDER

 

And there is nothing for the bottom half page as opposed to what I used to see(please see screen dump as attached)    Does anyone know how to recover admin account to FULL admin previlleges without using GUI but using command/editing opsview files?

 

Thank you in advance for your help!

 

Lufan Chen

Duncan Ferguson
dferguson's picture
Do you have access to the

Do you have access to the roles settings as your adminuser, or do you have a second 'full' admin account you can use to reset the settings?

If not, is this a recent change?  You could restore the opsview database, or you may need to go into the opsview database and look at the users and roles tables to identify what roles need to be put back.  Unfortunately, since core is so old now I don't have access to a system to check on the exact steps for you.

  Duncs

Lufan
lchen's picture
Thank you Duncs for your

Thank you Duncs for your quick response.  Yes I can login to opsview server(on ubuntu OS) as root.  Could you tell me how to get to roles settings?  From event log I did see an account called SYSTEM doing some kind of backup....  How can I find whether I have a second full admin account?

thanks,

 

Lufan

Duncan Ferguson
dferguson's picture
I can only compare your core

I can only compare your core system with the oldest system I have access to, so you may need to take these instructions with a pinch of salt.

Identify what role you have set on your account in the UI via your user profile (click on your username in the main UI to go to your profile page and look what the role name is set to)

Connect to your MySQL install as root

If no password is set:

mysql -u root

or if you know the password:

mysql -u root -p

Check your role ID from the database

select * from roles where name like '%<your role>%';

Get the ADMINACCESS role id (might be '9')

select * from access where name='ADMINACCESS';

then ensure your role has the right permissions

INSERT INTO roles_access values(<your role id>, <ADMINACCESS id>);

exit the database

exit;

now kick off a reload

/usr/local/nagios/bin/rc.opsview gen_config

  Duncs

Lufan
lchen's picture
Thank you Duncan, here is

Thank you Duncan, here is what I got:

select * from roles;



| id | name                   | description                            



|  1 | Public                 | Access available for public users         

|  2 | Authenticated user     | All authenticated users inherit this role    

| 10 | Administrator          | Administrator access                  

| 11 | View all, change some  | Operator                                  

| 12 | View some, change some | Restricted operator            

| 13 | View all, change none  | Read only user                           

| 14 | View some, change none | Restricted read only user            

| 15 | SU                     | Administrator access                      |      

 

So what is the role id I need to use to be granted Admin full access?  In opsview GUI, I login as account 'admin'.

select * from access where name='ADMINACCESS';  will give me id=9

  Thanks,   Lufan
Lufan
lchen's picture
More info:

More info:

mysql>  select * from contacts;

+----+---------------+-----------+-------+---------------------------------------+----------+----------------------+------+-------------------+-------------+

| id | fullname      | name      | realm | encrypted_password                    | language | description          | role | show_welcome_page | uncommitted |

+----+---------------+-----------+-------+---------------------------------------+----------+----------------------+------+-------------------+-------------+

|  1 | Administrator | admin     | local | $apr1$ebE2iyK5$t8xruE965yWXfYlaMO47o1 |          | System Administrator |   10 |                 0 |           0 |

 

Lufan
lchen's picture
Looks like role id 10 already

Looks like role id 10 already have access id 9

mysql>  select * from roles_access;

+--------+----------+

| roleid | accessid |

+--------+----------+

|      1 |       10 |

|      2 |       11 |

|     10 |        1 |

|     10 |        2 |

|     10 |        3 |

|     10 |        4 |

|     10 |        6 |

|     10 |        7 |

|     10 |        8 |

|     10 |        9 |

|     10 |       10 |

 

Do I still need to run INSERT INTO roles_access values(<your role id>, <ADMINACCESS id>);

?

 

thanks,



lufan

 

Lufan
lchen's picture
Account admin has role id =

Account admin has role id = 10 and it already has access id =9(ADMINACCESS) assigned as shown in roles_access table.  I ran /usr/local/nagios/bin/rc.opsview gen_config but still do not see any change on GUI after login to opsview GUI admin account.

Duncan Ferguson
dferguson's picture
In which can you need to look

In which can you need to look at some of the database import processes to make sure everything is running as expected, such as 

- are there any NDO logs backlogged

- does running '/usr/local/nagios/bin/ndoutils_configdumpend' as the nagios user complete without problems

- there are no log entries in /var/log/ospview/ospviewd.log showing problems with either of the above

- you have no tables within MySQL that have hit their maximum ID number - check by running '/usr/local/nagios/utils/check_ai_count'

  Duncs

Lufan
lchen's picture
thank you Duncan.  Here are

thank you Duncan.  Here are what I got from your questions above:

1)There is no ndo logs for the past year

2)running /usr/local/nagios/bin/ndoutils_configdumpend  finished without any error on the screen

3)here is what I see from /var/log/ospview/ospviewd.log:

 

[2017/09/02 22:58:16] [import_ndologsd] [INFO] Restarting after running for more then 86400 seconds

[2017/09/02 22:58:17] [import_ndologsd] [INFO] Starting

[2017/09/02 22:58:17] [import_ndologsd] [INFO] Daemonised

[2017/09/03 22:58:18] [import_ndologsd] [INFO] Restarting after running for more then 86400 seconds

[2017/09/03 22:58:19] [import_ndologsd] [INFO] Starting

[2017/09/03 22:58:19] [import_ndologsd] [INFO] Daemonised

[2017/09/04 22:58:20] [import_ndologsd] [INFO] Restarting after running for more then 86400 seconds

[2017/09/04 22:58:20] [import_ndologsd] [INFO] Starting

[2017/09/04 22:58:20] [import_ndologsd] [INFO] Daemonised

[2017/09/05 22:58:22] [import_ndologsd] [INFO] Restarting after running for more then 86400 seconds

[2017/09/05 22:58:22] [import_ndologsd] [INFO] Starting

[2017/09/05 22:58:22] [import_ndologsd] [INFO] Daemonised

[2017/09/06 18:01:35] [ndoutils_configdumpend] [INFO] Start

[2017/09/06 18:01:39] [ndoutils_configdumpend] [INFO] End

4)when I ran nagios@opsview:~/var/backups$ /usr/local/nagios/utils/check_ai_count   I got:

Database must be one of Opsview or Runtime



Also, I see below folder have below files, are those files backups of opsview db that we can use to restore the whole opsview settings?

nagios@opsview:~/var/backups$ pwd

/usr/local/nagios/var/backups

ls -l

-rw-rw-r-- 1 nagios nagios    140840 Jun  1 11:06 opsview-db-802.sql.gz

-rw-rw-r-- 1 nagios nagios    141742 Jun  1 11:30 opsview-db-803.sql.gz

-rw-rw-r-- 1 nagios nagios    141786 Jun  1 11:30 opsview-db-804.sql.gz

-rw-rw-r-- 1 nagios nagios    141746 Jun  1 12:58 opsview-db-805.sql.gz

-rw-rw-r-- 1 nagios nagios    141826 Jun  3 01:54 opsview-db-806.sql.gz

-rw-rw-r-- 1 nagios nagios    141867 Jun  3 01:54 opsview-db-807.sql.gz

-rw-rw-r-- 1 nagios nagios    142585 Jun  4 00:12 opsview-db-808.sql.gz

-rw-rw-r-- 1 nagios nagios    142550 Jun  4 00:12 opsview-db-809.sql.gz

-rw-rw-r-- 1 nagios nagios    143518 Jul 14 15:01 opsview-db-810.sql.gz

-rw-rw-r-- 1 nagios nagios    144270 Aug  7 10:56 opsview-db-811.sql.gz

-rw-rw-r-- 1 nagios nagios    144275 Aug  7 11:12 opsview-db-812.sql.gz

-rw-rw-r-- 1 nagios nagios    144360 Aug  7 11:21 opsview-db-813.sql.gz

-rw-rw-r-- 1 nagios nagios    144525 Aug  7 15:36 opsview-db-814.sql.gz

-rw-rw-r-- 1 nagios nagios    144629 Aug  7 17:08 opsview-db-815.sql.gz

-rw-rw-r-- 1 nagios nagios    144698 Aug  7 17:18 opsview-db-816.sql.gz

-rw-rw-r-- 1 nagios nagios    145343 Aug  8 13:27 opsview-db-817.sql.gz

-rw-rw-r-- 1 nagios nagios    146180 Aug 29 10:45 opsview-db-818.sql.gz

-rw-rw-r-- 1 nagios nagios    146567 Sep  1 11:10 opsview-db-819.sql.gz



thank you for your help.  Do you know how we can restore opsview settings from where the backup files is as a last resort?

Lufan

Duncan Ferguson
dferguson's picture
Please amend the command to

Please amend the command to be 

/usr/local/nagios/utils/check_ai_count runtime
/usr/local/nagios/utils/check_ai_count opsview

You can restore the settings by using the following as the nagios user:

cat opsview-db-819.sql.gz | db_opsview db_restore

but make sure you have a copy of the current database incase you need to get back to that for whatever reason

  Duncs

Lufan
lchen's picture
Thank you again Duncs.  I am

Thank you again Duncs.  I am new to opsview db, could you please tell me what command I need to run to get a current copy of db?  

Best,

Lufan

Duncan Ferguson
dferguson's picture
Every time you reload you

Every time you reload you should get a copy of the opsview database.  A copy should also be created every night, so as long as you keep the most recent opsview-db-NNN.sql.gz or opsview-db-YYYY-MM-DD-HHMMSS.sql.gz file you should be fine (all stored within /usr/local/nagios/var/backups)

  Duncs

Lufan
lchen's picture
Thank you Duncs,  Here is

Thank you Duncs,  Here is what I got:

nagios@opsview:~/var/backups$ cat opsview-db-818.sql.gz| /usr/local/nagios/bin/db_opsview db_restore

Restoring database opsview

ERROR at line 1: Unknown command '\M'.

Cannot import

Also, two commands have below output:

nagios@opsview:~$ /usr/local/nagios/utils/check_ai_count runtime

Table nagios_acknowledgements: max acknowledgement_id = 24

Table nagios_commands: max command_id = 136186

Table nagios_commenthistory: max commenthistory_id = 70207

Table nagios_comments: max comment_id = 62194

Table nagios_contactgroup_members: max contactgroup_member_id = 125744

Table nagios_contactgroups: max contactgroup_id = 35813

Table nagios_contactnotificationmethods: max contactnotificationmethod_id = 1651310

Table nagios_contactnotifications: max contactnotification_id = 891697

Table nagios_contacts: max contact_id = 4724

Table nagios_contactstatus: max contactstatus_id = 4701

Table nagios_customvariables: max customvariable_id = 2376

Table nagios_customvariablestatus: max customvariablestatus_id = 1237

Table nagios_downtimehistory: max downtimehistory_id = 13196

Table nagios_host_contactgroups: max host_contactgroup_id = 255914

Table nagios_host_parenthosts: max host_parenthost_id = 35060

Table nagios_hostchecks: max hostcheck_id = 5420365

Table nagios_hostgroup_members: max hostgroup_member_id = 36026

Table nagios_hostgroups: max hostgroup_id = 5712

Table nagios_hosts: max host_id = 36026

Table nagios_hoststatus: max hoststatus_id = 81752

Table nagios_instances: max instance_id = 1

Table nagios_notifications: max notification_id = 12728375

Table nagios_objects: max object_id = 2392

Table nagios_processevents: max processevent_id = 5100

Table nagios_programstatus: max programstatus_id = 9837144

Table nagios_scheduleddowntime: max scheduleddowntime_id = 16718

Table nagios_service_contactgroups: max service_contactgroup_id = 1123335

Table nagios_servicechecks: max servicecheck_id = 93616848

Table nagios_servicedependencies: max servicedependency_id = 16066

Table nagios_services: max service_id = 502608

Table nagios_servicestatus: max servicestatus_id = 61084573

Table nagios_statehistory: max statehistory_id = 780936

Table nagios_timeperiod_timeranges: max timeperiod_timerange_id = 23184

Table nagios_timeperiods: max timeperiod_id = 3864

Table opsview_hosts_matpaths: max id = 59

Table opsview_performance_metrics: max id = 1562

Table opsview_topology_map: max id = 117

nagios@opsview:~$ /usr/local/nagios/utils/check_ai_count opsview

Table access: max id = 30

Table attributes: max id = 15

Table auditlogs: max id = 11385

Table checktypes: max id = 5

Table contacts: max id = 10

Table hostcheckcommands: max id = 16

Table hostgroups: max id = 11

Table hosts: max id = 89

Table hostsnmpinterfaces: max id = 5

Table hosttemplatemanagementurls: max id = 11

Table hosttemplates: max id = 50

Table keywords: max id = 17

Table modules: max id = 8

Table monitor_packs: max id = 65

Table monitoringservers: max id = 1

Table notificationmethods: max id = 7

Table notificationprofiles: max id = 3

Table reloadtimes: max id = 819

Table roles: max id = 15

Table servicechecks: max id = 435

Table servicegroups: max id = 51

Table sharednotificationprofiles: max id = 1

Table snmptraprules: max id = 4

Table systempreferences: max id = 1

Table timeperiods: max id = 4

Any clues?

Thank you in advance for your help!

Lufan

Duncan Ferguson
dferguson's picture
Sorry, missing letter as the

Sorry, missing letter as the backup files are compressed...

$ zcat opsview-db-818.sql.gz| /usr/local/nagios/bin/db_opsview db_restore

  Duncs

Lufan
lchen's picture
Hi Duncs, I tried above

Hi Duncs, I tried above command to restore db to Aug 8 when the GUI showed normal settings and restarted mysql/opsview/opsview-web but the issue is still there...  Would it be possible that you can do us a favor to jump into video conf call to do a quick look?  I would not take you more than 10-20 minutes of time.  Or any other places on the logs/tests I need to do to find out where the issue is?  Thank you in advance again for your help!!!

 

Best,

 

Lufan

Duncan Ferguson
dferguson's picture
Sorry, without a support

Sorry, without a support contact I cannot check your server for you, especially on such an old version of the software.

Do you have a configuration backup from before the 8th?  It may be that config on the 8th introduced the problem, even though the UI looked to be okay.  

There should also be an audit log that lists all changes made on the system which may contain the info you are looking for - this is stored in the opsview.auditlogs table.  I know in later version the UI can search this log but I cannot remember how much functionality there was in the audit log back in code.

  Duncs

Lufan
lchen's picture
Thank you Duncs.  I tried to

Thank you Duncs.  I tried to restore db back to June but still not luck.  Can you do us a favor and make one exception(maybe you will get permission from your supervisor) to have it checked that way I can provide more facts to my management that it is worthy to sign up for support?  It is not a lot of money to sign up for support but if you can get this issue fixed then it will convince my managment that the contract support is very helpful.  :=)

I did see different hosts monitored came up when I restored different db, so that could mean the admin account settings may not in the db that I restored.

 

Thanks,



Lufan