Snowsql not connecting - command

I did install Snowsql 1.25. Installation went fine.
I configure the config file the the right account (xq59548.us-east-2.aws) user and password.
My .profile file seems fine and so is the $PATH:
Error with zhh - command not found
Has anyone encoutered this issue?

As I see, the path of Snowsql is missing. I can see that my path includes the following:
/Applications/SnowSQL.app/Contents/MacOS
Could you try to run it after adding the above path to your PATH variable?

Yep...The PATH was missing indeed.
The Python librairies were not visible by the z shell program.
I added a zprofile file at the root with the following:
alias snowsql=/Applications/SnowSQL.app/Contents/MacOS/snowsql
And it worked fine.
Funny that the SnowSQL installer does not create that file.
Thanks for your input bud!

Related

Nagios Error : /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

I am trying to install nagios-plugins-2.2.1 on redhat machine
when running this command:
Nagios /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
i am getting the error as
no such file or directory
pls help
https://www.youtube.com/watch?v=VsIrAsXzbx4
It looks like the nagios binary is located in another location not in /usr/local/nagios/bin/nagios
To find where it is run:
which nagios
If nagios was installed using the RHEL package manager so it will be usually in:
/usr/sbin/nagios
If it did not come back with result just type the first 3 letters "nag" then type the "Tab" key and it will complete it.
Once you find it then use it instead of /usr/local/nagios/bin/nagios
Then make sure you get the right nagios.cfg file location by running the 2 following commands:
updatedb
locate nagios.cfg
If when you run updatedb you got "Command not found" error message then mlocate package is not installed and you can get the nagios.cfg location by running this command instead
find / -xdev -type f -name "nagios.cfg"
So by that you should have both "nagios binary" and "nagios.cfg file", you can then re-run the command with the right file paths
It looks like "nagios.cfg" does not exist.
Try to create it and configuring it manually.
Then try again.
You can try to look at where your nagios.cfg file has been created, using
locate nagios.cfg
for instance, to make sure your file is in the right path and maybe call that newly displayed path instead.
/usr/local/nagios/bin/nagios -v [path_of_nagios_cfg]
Also you need to omit the first "Nagios" from the command line as it is in Capital N which sure is supposed to come back with "no such file or directory" message
The command should only be like this:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
you will find nagios.cfg file in #/usr/local/nagios/etc
then run that command giving this path.

How/where to create mongod.conf file?

I need to create a mongod.conf file but I'm having trouble with the where and how.
Where: Since the command to run the file is mongod --config /etc/mongod.conf, I understand I need to create the file in C:\Program Files\MongoDB\Server\3.4\bin\etc
How: When I right-click or open the path in Atom, I'm only given the option to create a folder. How can I override this?
Thank you!
Finally figured it out!
It was related to admin privileges on my Windows computer.
I was able to create the file elsewhere and then move it to the path, where I was prompted to give admin permission. Wish I thought of this at some point during the past week when the struggle was real :P

mongod and mongo commands not working on windows 10

I've installed mongoDB on my windows 10 OS. Then I tried setting its database path to some directory by moving to it and typing mongod --datapath=data in cmd, where data is the folder which is to contain the db(I've used the relative path because I'm in that directory). But message comes that mongod is unrecognized command. After some searching I found that by specifying mongod path, i.e. "C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe" --datapath=data works. Similar thing happens for mongo.
I want to directly run mongod and mongo commands, I have seen people directly using it(without going to the directory or specifying the path).
For a Windows installation, by default you have to use the full path to the exe unless you add it to the PATH.
To add it to the PATH:
01) Get path to bin, something like: C:\Program Files\MongoDB\Server\4.0\bin
02) Press the Windows key, type env, select Edit the system environment variables
03) On the Advanced tab, click Environment Variables
04) In the User variables for xxxx section, select path and then click the Edit... button
05) Click New and paste your path with a trailing slash, eg:
C:\Program Files\MongoDB\Server\4.0\bin\
06) Click OK, OK, OK and restart your command window.
Source
The examples you have seen are probably based on UNIX installations which I think by default install mongo as a service (which Windows doesn't) and that is what is called in those examples.
To simplify startup and configuration on Windows, you can also install it as a service. See the Mongo documentation here and the
"Configure Windows Service for MongoDB' section".
This will then allow you to start and stop Mongo by simply calling
net start MongoDB
Or
net stop MongoDB
If installed MongoDB version is 6.0 or above, mongo command will not work on Powershell/cmd. If you run the command you will get the following error:
'mongo' is not recognized as an internal or external command,
operable program or batch file.
To run mongo commands, you have to install MongoDB Shell from
After installing the shell, extract the zip file, you can rename the extracted folder (mongosh-1.6.0-win32-x64) as "MongoDB Shell" and move that folder to Windows(:C) > Program Files
Now open the folder, go to bin and copy the path:
C:\Program Files\MongoDB Shell\mongosh-1.6.0-win32-x64\bin (or
C:\Program Files\mongosh-1.6.0-win32-x64\mongosh-1.6.0-win32-x64\bin)
Go to
Settings > System > About > Advanced system settings > Environment
Variables > Under System Variables, click on 'Path' then 'Edit' >
Click 'New' and paste the above copied path > Click 'Ok' 'Ok' 'Ok'
Now open Powershell/cmd, run the command 'mongosh'
You're all set to work with MongoDB
To add it to the PATH:
Add Mongo’s bin folder to the Path Environment Variable
Kindly check the link:
here
After adding bin folder to the path Environment Variable
then simply type mongo in terminal it will start working
reference : Microsoft document
set your path like this
;C:\Program Files\MongoDB\Server\4.0\bin
this is worked for me.
Based on welshGaz answer above, I edited the User Path variable but it did not work for me yet. I wasn't able to access the System Path variables.
What I noticed from the errors on the command prompt is that it what missing the "C:\data\db" directory to store its files (I don't know what those files are for just yet). So I created that directory myself and it worked.
Same problem here. I installed through the .msi file provided for windows X64bit. In the installer instructions from MongoDB (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/), I read that you can add C:\Program Files\MongoDB\Server\4.2\bin to the System Path. Then it asks to omit the full path to the the MongoDB binaries. That is where I think some information is missing. How are we supposed to omit the full path to the MongoDB binaries?
Currently I can get MongoDB to run mongod using:
"C:\Program Files\MongoDB\Server\4.2\bin\mongod.exe" --dbpath="c:\data\db"
For --dbpath="c:\data\db" you can replace "c:\data\db" with the path to your database.
I can also run mongo using:
"C:\Program Files\MongoDB\Server\4.2\bin\mongo.exe"
Another reason to it if you enabled any property in YAML file and it is not formatted properly. YAML looks for specific syntax like colon":"+space" ".
E.g.-
security:
authorization: enabled
use mongosh command from your terminal. mongo command no longer works for 6.0 and above.
if you are trying to connect from connection url eg mongodb://localhost:27017/yourdb try changing it to something like mongodb://127.0.0.1/yourdb

How to load scripts in MongoDB

I'm using MongoDB version 3.0 and I want to run script.js on database
Problem I have find is that mongo is not seeing my file script.js.
What I have done step by step:
I have installed MongoDB in directory MongoDB\Server\3.0\bin\
I have put script.js inside \bin directory
I want to do is run script.js using load() method
I have got an error
load("script.js")
2016-10-09T22:17:17.557+0200 E - file [script.js] doesn't exist
2016-10-09T22:17:17.558+0200 E QUERY Error: error loading js file: script.js
at (shell):1:1
Probably I have put script.js in wrong place but where I should put it?
Next step is I'm using mlab and I want to load my script to the online server, how to do this?
I don't know of any magic that would make a \bin directory relevant, but assuming that your script is located in /bin, you just need to call out the full path when you do the load from within the mongoshell
load('/bin/script.js');
If your script is located off your home directory it will be like
load('/Users/yourname/script.js');
See the docs for load: https://docs.mongodb.com/manual/reference/method/load/
Ditto for how you run it on "the server". Its not so much running on the server, but in the shell that you are running. If the shell is connected to a particular server, the effects of the script will be on the server but the script itself executes in your shell.
For windows try:
load('c:\MongoDB\Server\3.0\bin\prova.js')
load("C:\\Data\\Mongo\\M001\\loadMovieDetailsDataset\\loadMovieDetailsDataset.js")
Double \ does the trick. I was receiving similar error as my install path was not set and the file res
Try changing the name of the .js file. In my case, the error was coming because the folder name and the file name were the same.

Mac OS X 10.11 - Add Postgres to $PATH Unsuccessful

I am trying to install Postgres in order to use Heroku.
I am following the instructions in the Heroku tutorial, and after Postgres installation (which was successful), it says to configure my .bash_profile to allow for Postgres command line functionality.
I am following the instructions here, but I am unable to successfully add this line:
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
That folder does in fact contain "psql" on my computer, so it should work. Here is my current .bash_profile:
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
# The next line updates PATH for the Google Cloud SDK.
source '/Users/user/google-cloud-sdk/path.bash.inc'
# The next line enables shell command completion for gcloud.
source '/Users/user/google-cloud-sdk/completion.bash.inc'
I tried to add the Postgres line to the end of that file, but it is not working. After searching online, there does not seem to be consensus on how to add PATHs to .bash_profile. I have tried many versions listed, but none have worked.
Please let me know if I'm doing this incorrectly!
Add this line to the end of your .bash_profile:
export PATH=/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH
This makes the search of a binary to look in that location "BEFORE the rest of the PATH"
Kill all instances of terminal and open it again, then it should work.
Try which xxx where xxx is the name of some binary inside /Applications/Postgres.app/Contents/Versions/latest/bin and check if it's returning that location.
Tell me if it works.