neilmunday / Salt-Minion-Inventory

Salt Minion Inventory provides a web based interface to your SaltStack minions to view their state.
GNU General Public License v3.0
36 stars 4 forks source link

Inventory Setup #37

Closed mdtabrezpasha closed 2 years ago

mdtabrezpasha commented 2 years ago

Hi Neil, i am trying to setup the inventory system for my salt master. have configured everthing as per your instructions. getting this error " root@saltsrv:/var/lib/salt/runners# salt labtest-ubuntu inventory.audit force=True labtest-ubuntu: 'inventory.audit' is not available. ERROR: Minions returned with non-zero exit code"

image

plz advise.

mdtabrezpasha commented 2 years ago

we are using the latest version of salt-master 3004.2. would be very helpful if you can post a step by step install instructions.

neilmunday commented 2 years ago

Hi @mdtabrezpasha.

Sorry to hear the Salt Minion Inventory is not working for you. Step by step instructions are provided at: https://github.com/neilmunday/Salt-Minion-Inventory#installation

Please can you try the steps mentioned in the Debugging section of the readme? The logs under /var/log/salt/minion in particular may offer some clues.

You can also check your Python set-up is ok on your minions by running:

python3 /srv/salt/_modules/inventory.py

Note: depending on your OS, you might need to use python above.

If no errors are produced then the modules required by the script are installed at least.

mdtabrezpasha commented 2 years ago

Hi Niel Thanks for responding so quickly. I am sure I am making a mistake in the MySQL setup too. will be very helpful if you can send me detailed setup instructions.

Thanks in advance.

From: Neil Munday @.> Sent: Thursday, July 14, 2022 4:14 AM To: neilmunday/Salt-Minion-Inventory @.> Cc: mdtabrezpasha @.>; Mention @.> Subject: Re: [neilmunday/Salt-Minion-Inventory] Inventory Setup (Issue #37)

Hi @mdtabrezpasha https://github.com/mdtabrezpasha .

Sorry to hear the Salt Minion Inventory is not working for you. Step by step instructions are provided at: https://github.com/neilmunday/Salt-Minion-Inventory#installation

Please can you try the steps mentioned in the Debugging https://github.com/neilmunday/Salt-Minion-Inventory#debugging section of the readme? The logs under /var/log/salt/minion in particular may offer some clues.

You can also check your Python set-up is ok on your minions by running:

python3 /srv/salt/_modules/inventory.py

Note: depending on your OS, you might need to use python above.

If no errors are produced then the modules required by the script are installed at least.

— Reply to this email directly, view it on GitHub https://github.com/neilmunday/Salt-Minion-Inventory/issues/37#issuecomment-1183754166 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AL6SSLCHAVR55SCLRXHR53DVT5BDDANCNFSM53PTYIYA . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AL6SSLA6VVRC5OHYP5Q2VCLVT5BDDA5CNFSM53PTYIYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOI2HKPNQ.gif Message ID: @. @.> >

neilmunday commented 2 years ago

@mdtabrezpasha can you please try the debugging tasks I mentioned above including the python command?

On the MySQL front, the minions do not perform any MySQL calls - this is done on the Salt master.

mdtabrezpasha commented 2 years ago

Hi Neil, i ran python3 /srv/salt/_modules/inventory.py no errors.

master log file shows "[salt.utils.reactor:417 ][ERROR ][24110] Reactor 'inventory_present' failed to execute runner 'inventory.present': function not available"

debug output

salt -l debug '*' inventory.audit force=True [DEBUG ] Reading configuration from /etc/salt/master [DEBUG ] Missing configuration file: /root/.saltrc [DEBUG ] Using importlib_metadata to load entry points [DEBUG ] Override grains: <module 'salt.loaded.int.log_handlers.sentry_mod' from '/usr/lib/python3/dist-packages/salt/log/handlers/sentry_mod.py'> [DEBUG ] Configuration file path: /etc/salt/master [WARNING ] Insecure logging configuration detected! Sensitive data may be logged. [DEBUG ] Reading configuration from /etc/salt/master [DEBUG ] Missing configuration file: /root/.saltrc [DEBUG ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc [DEBUG ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc [DEBUG ] Popen(['git', 'version'], cwd=/home/zerodha/Salt-Minion-Inventory/srv, universal_newlines=False, shell=None, istream=None) [DEBUG ] Popen(['git', 'version'], cwd=/home/zerodha/Salt-Minion-Inventory/srv, universal_newlines=False, shell=None, istream=None) [DEBUG ] Connecting the Minion to the Master URI (for the return server): tcp://10.10.20.36:4506 [DEBUG ] Trying to connect to: tcp://10.10.20.36:4506 [DEBUG ] Closing AsyncZeroMQReqChannel instance [DEBUG ] LazyLoaded local_cache.get_load [DEBUG ] Reading minion list from /var/cache/salt/master/jobs/fe/5fe67a392460fc76d1816723971ec1e06671c01b80b8252699d81110db2ac5/.minions.p [DEBUG ] get_iter_returns for jid 20220715154544152950 sent to {'labtest-ubuntu'} will timeout at 15:45:49.184956 [DEBUG ] jid 20220715154544152950 return from labtest-ubuntu [DEBUG ] return event: {'labtest-ubuntu': {'ret': "'inventory.audit' is not available.", 'out': 'nested', 'retcode': 1, 'jid': '20220715154544152950'}} [DEBUG ] Using importlib_metadata to load entry points [DEBUG ] LazyLoaded nested.output labtest-ubuntu: 'inventory.audit' is not available. [DEBUG ] jid 20220715154544152950 found all minions {'labtest-ubuntu'} [DEBUG ] Closing IPCMessageSubscriber instance ERROR: Minions returned with non-zero exit code

Web ui also has error

salt inventory web ui error

neilmunday commented 2 years ago

Thanks for the info. Another user has also confirmed that there is an issue with Salt 3004. I am looking into it.

neilmunday commented 2 years ago

After futher testing I think the issue might be due to the Python MySQL module not being installed on your salt master.

Can you check that this module is installed please?

E.g.

pip3 list | grep mysqlclient

On Red Hat based systems the package that provides this module is called python3-mysql. I'm not an Ubuntu user but I think the corresponding package for this OS has the same name.

neilmunday commented 2 years ago

Closing due to no reply. Will re-open if needed.

mdtabrezpasha commented 2 years ago

Hi Neil,

         I have run pip3 list | grep mysqlclient,  no errors, but nothing in the list.

salt -l debug '*' inventory.audit force=True

[DEBUG ] Reading configuration from /etc/salt/master

[DEBUG ] Missing configuration file: /root/.saltrc

[DEBUG ] Using importlib_metadata to load entry points

[DEBUG ] Override grains: <module 'salt.loaded.int.log_handlers.sentry_mod' from '/usr/lib/python3/dist-packages/salt/log/handlers/sentry_mod.py'>

[DEBUG ] Configuration file path: /etc/salt/master

[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.

[DEBUG ] Reading configuration from /etc/salt/master

[DEBUG ] Missing configuration file: /root/.saltrc

[DEBUG ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc

[DEBUG ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc

[DEBUG ] Popen(['git', 'version'], cwd=/home/zerodha, universal_newlines=False, shell=None, istream=None)

[DEBUG ] Popen(['git', 'version'], cwd=/home/zerodha, universal_newlines=False, shell=None, istream=None)

[DEBUG ] Connecting the Minion to the Master URI (for the return server): tcp://10.10.20.36:4506

[DEBUG ] Trying to connect to: tcp://10.10.20.36:4506

[DEBUG ] Closing AsyncZeroMQReqChannel instance

[DEBUG ] LazyLoaded local_cache.get_load

[DEBUG ] Reading minion list from /var/cache/salt/master/jobs/40/bf83c00d6769595e7bd22cc54015cd7318923e2ffb6132beb57f30fcb9b10c/.minions.p

[DEBUG ] get_iter_returns for jid 20220716045923752641 sent to {'labtest-ubuntu'} will timeout at 04:59:28.774153

[DEBUG ] jid 20220716045923752641 return from labtest-ubuntu

[DEBUG ] return event: {'labtest-ubuntu': {'ret': "'inventory.audit' is not available.", 'out': 'nested', 'retcode': 1, 'jid': '20220716045923752641'}}

[DEBUG ] Using importlib_metadata to load entry points

[DEBUG ] LazyLoaded nested.output

labtest-ubuntu:

'inventory.audit' is not available.

[DEBUG ] jid 20220716045923752641 found all minions {'labtest-ubuntu'}

[DEBUG ] Closing IPCMessageSubscriber instance

ERROR: Minions returned with non-zero exit cod

From: Neil Munday @.> Sent: Saturday, July 16, 2022 4:27 AM To: neilmunday/Salt-Minion-Inventory @.> Cc: mdtabrezpasha @.>; Mention @.> Subject: Re: [neilmunday/Salt-Minion-Inventory] Inventory Setup (Issue #37)

After futher testing I think the issue might be due to the Python MySQL module not being installed on your salt master.

Can you check that this module is installed please?

E.g.

pip3 list | grep mysqlclient

On Red Hat based systems the package that provides this module is called python3-mysql. I'm not an Ubuntu user but I think the corresponding package for this OS has the same name.

— Reply to this email directly, https://github.com/neilmunday/Salt-Minion-Inventory/issues/37#issuecomment-1186008572 view it on GitHub, or https://github.com/notifications/unsubscribe-auth/AL6SSLBGHZDCTNMUUJPVE5DVUHUDBANCNFSM53PTYIYA unsubscribe. You are receiving this because you were mentioned. https://github.com/notifications/beacon/AL6SSLHFVWHXDYMSBU2HROTVUHUDBA5CNFSM53PTYIYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOI2YQ37A.gif Message ID: < @.> @.>

neilmunday commented 2 years ago

Ok, so sounds like to me that the Python mysqlclient module is not installed if the grep command is returning no results. Please install this package for your OS.