I want to monitor Azure Paas database with Nagios. I'm using this plugin available at https://github.com/MsOpenTech/WaMo
When I try to check database:
./check_azure_sql.py -u -p -d -k top5queries
I get this error message:
('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)')
Error connecting to database
All dependencies are installed (list in GitHub plugin site).
Here you can see my /etc/odbcinst.ini:
[ODBC]
Trace = Yes
TraceFile = /tmp/odbc.log
[FreeTDS]
Description = ODBC For TDS
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
UsageCount = 1
Here you can see my /etc/freetds/freetds.conf:
# $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".
# Global settings are overridden by those in a database
# server specific section
[global]
# TDS protocol version
; tds version = 4.2
# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug flags = 0xffff
# Command and connection timeouts
; timeout = 10
; connect timeout = 10
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
# A typical Sybase server
[egServer50]
host = symachine.domain.com
port = 5000
tds version = 5.0
# A typical Microsoft server
[egServer70]
host = ntmachine.domain.com
port = 1433
tds version = 7.0
And my /etc/odbc.ini is empty.
Does anybody have any idea?
bhagdev, to do simple, i'm trying to monitor Sql database Azure Paas with nagios.
It's not me that is written the plugin available at github.com/MsOpenTech/WaMo. For a nagios admin, i only need to execute the command ./check_azure_sql.py -u (username) -p (password) -d (database) -k (key) (check_azure_sql.py written in python) from debian linux cli.
So when i execute the command above i get the error message :
('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)') Error connecting to database.
Than'ks for your help guy's
Related
Over the past week, our users have been reaching out complaining that they can't upload/modify files on the company file server. Specifically, they'll try dragging files onto the share through Windows Explorer and will be faced with 'Access Denied'.
The fileserver is a Ubuntu VM that's joined to the Windows domain using the following documentation Setting_up_Samba_as_a_Domain_Member. Admittedly I used our old smb.conf(see below) from the old file server, as my understanding of Linux/Samba is very limited and needing to get the share up and running as soon as possible.
Here's what I've done so far
1. SSHd into the file server and checked the permissions of a folder that was known to be having issues.
ls -ll directory_in_question
drwxrwsr-x 12 root name_of_active_directory_group 4096 Dec 17 15:21 ./
Noticed that 'name_of_active_directory_group' seems to be correct, however the members of this group still can't upload files to this location through Explorer.
2. Checked to see if I can even access the group using getent group 'name_of_active_directory_group, and I'm given name_of_active_directory_group:*:10083:username_one,username_two..., I even try running id username_one and It seems to be reaching our AD DC fine.
3. Set the logging level of Samba to 5 and monitor for anything useful in /var/log/samba/. The only line that really jumps out to me is smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED]. However I can always provide the full log if it helps.
Temporary Fix
If I run setfacl -Rm u:username:rwX directory_in_question then the user will be able to make changes. Or if I change the permissions of the folder to chmod o+rwx directory_in_question then It works without a hitch. However, chmod g+rwx directory_in_question where I'm specifying the group directly with chmod doesn't work.
The smb.conf looks like this
#======================= Global Settings =======================
[global]
## Browsing/Identification ###
server string = %h server (Samba, Ubuntu)
security = ads
workgroup = COMPANY_A
realm = COMPANY_A.net
# dedicated keytab file = /etc/krb5.keytab
kerberos method = system keytab
disable netbios = Yes
load printers = No
printing = bsd
printcap name = /dev/null
disable spoolss = Yes
## User mapping!! (to map old users on server)
username map = /etc/samba/smbusers
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m
# log level = 5
# Cap the size of the individual log files (in KiB).
max log size = 1000
# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
# syslog only = no
# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0
# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d
# Log level
# log level = 5
lm announce = no
server max protocol = SMB3
server min protocol = NT1
client max protocol = SMB3
client min protocol = NT1
[share]
comment = Share folder
path = /mnt/share_name
read only = no
guest ok = no
directory mask = 0744
force directory mode = 02775
create mask = 0664
force create mode = 0664
follow symlinks = yes
wide links = no
veto files = /._*/.DS_Store/
vfs objects = streams_xattr
Realm List Info
realm list info
company_A.net
type: kerberos
realm-name: company_A.NET
domain-name: company_A.net
configured: kerberos-member
server-software: active-directory
client-software: winbind
required-package: winbind
required-package: libpam-winbind
required-package: samba-common-bin
login-formats: COMPAND_A\%U
login-policy: allow-any-login
company_A.net
type: kerberos
realm-name: company_A.NET
domain-name: company_A.net
configured: kerberos-member
server-software: active-directory
client-software: sssd
required-package: sssd-tools
required-package: sssd
required-package: libnss-sss
required-package: libpam-sss
required-package: adcli
required-package: samba-common-bin
login-formats: %U
login-policy: allow-permitted-logins
permitted-logins:
permitted-groups:
Go and read the Samba wiki page again and then setup your smb.conf correctly, this time without sssd.
I also noticed this '## User mapping!! (to map old users on server)' , that isn't what the usermap is for (well, not in an AD domain).
I'm trying to using psqlODBC driver to receive data from PostgreSQL to Excel in macOS Catalina.
But I keep getting this error IM003 [iODBC][Driver Manager]Specified driver could not be loaded
Following things are the method I've tried but still don't succeed.
Disable SIP
Move psqlodbca.so under the /Library/ODBC folder in order to let Excel open in sandbox environment.
Changed original /usr/lib/libpq.5.dylib to PostgreSQL's dylib file by using command
sudo ln -s /postgresql_install_folder/lib/libpq.5.dylib /usr/lib/libpq.5.dylib
I download the source from https://www.postgresql.org/ftp/odbc/versions/src/ and follow this article https://odbc.postgresql.org/docs/unix-compilation.html to compile the driver and install the psqlodbca.so under /Library/ODBC
My /Library/ODBC/odbc.ini
[ODBC Data Sources]
postgresAscii = ascii
[postgresAscii]
Driver = {ascii}
Description = postgres odbc for user type ascii
Database = db
Server = 127.0.0.1
Port = 5432
FetchBufferSize = 99
My /Library/ODBC/odbcinst.ini
[ODBC Drivers]
ascii = Installed
[ascii]
Driver = /Library/ODBC/psqlodbca.so
Setup =
I can connected to my DB using iODBC Administrator64.app
I have created an Azure cache for Redis and I am trying to use it as external redis for Gitlab.
My gitlab.rb is this:
#external_url "https://ci.example.com"
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/ci.example.com.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/ci.example.com.key"
### The duration in seconds to keep backups before they are allowed to be deleted
gitlab_rails['backup_keep_time'] = 604800
### External postgres settings
postgresql['enable'] = false
gitlab_rails['db_adapter'] = "postgresql"
gitlab_rails['db_encoding'] = "unicode"
gitlab_rails['db_database'] = "cisomething"
# username string for AWS
# gitlab_rails['db_username'] = "gitlab"
# username string for Azure
gitlab_rails['db_username'] = "gitlab#ci-something.postgres.database.azure.com"
gitlab_rails['db_password'] = "really long password"
gitlab_rails['db_host'] = "ci-something.postgres.database.azure.com"
gitlab_rails['db_port'] = 5432
gitlab_rails['auto_migrate'] = false
### External redis settings
redis['enable'] = false
gitlab_rails['redis_host'] = "ci.redis.cache.windows.net"
gitlab_rails['redis_port'] = 6379
gitlab_rails['redis_password'] = "azure-redis-primary-access-key"
### Whitelist VPC cidr for access to health checks
gitlab_rails['monitoring_whitelist'] = ['XX.XXX.X.X/24']
### Default Theme
gitlab_rails['gitlab_default_theme'] = 2
### Enable or disable automatic database migrations
gitlab_rails['auto_migrate'] = false
### GitLab email server settings
... other settings here
I can connect to Redis with redis-cli
redis-cli -h ci.redis.cache.windows.net -p 6379 -a azure-redis-primary-access-key
and execute commands.
When I execute gitlab-ctl tail I see this error:
==> /var/log/gitlab/gitlab-workhorse/current <==
{"error":"keywatcher: pubsub receive: NOAUTH Authentication required.","level":"error","msg":"unknown error","time":"2020-02-21T10:26:08Z"}
{"address":"ci.redis.cache.windows.net","level":"info","msg":"redis: dialing","scheme":"redis","time":"2020-02-21T10:26:08Z"}
{"error":"keywatcher: pubsub receive: NOAUTH Authentication required.","level":"error","msg":"unknown error","time":"2020-02-21T10:26:08Z"}
{"address":"ci.redis.cache.windows.net","level":"info","msg":"redis: dialing","scheme":"redis","time":"2020-02-21T10:26:08Z"}
{"error":"keywatcher: pubsub receive: NOAUTH Authentication required.","level":"error","msg":"unknown error","time":"2020-02-21T10:26:08Z"}
{"address":"ci.redis.cache.windows.net","level":"info","msg":"redis: dialing","scheme":"redis","time":"2020-02-21T10:26:08Z"}
{"error":"keywatcher: pubsub receive: NOAUTH Authentication required.","level":"error","msg":"unknown error","time":"2020-02-21T10:26:08Z"}
{"address":"ci.redis.cache.windows.net","level":"info","msg":"redis: dialing","scheme":"redis","time":"2020-02-21T10:26:08Z"}
I searched the internet but I cannot find something to resolve this.
System information
System: Ubuntu 16.04
Current User: git
Using RVM: no
Ruby Version: 2.6.5p114
Gem Version: 2.7.10
Bundler Version:1.17.3
Rake Version: 12.3.3
Redis Version: 5.0.7
Git Version: 2.24.1
Sidekiq Version:5.2.7
GitLab information
Version: 12.7.6
Revision: 61654d25b20
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 9.5.20,
So, I figured it out.
For future reference here it goes.
gitlab.rb
### External redis settings
redis['enable'] = false
gitlab_rails['redis_host'] = "ci.redis.cache.windows.net"
gitlab_rails['redis_port'] = 6380
gitlab_rails['redis_password'] = "azure-primary-access-key"
gitlab_rails['redis_ssl'] = true
Azure Cache for Redis configuration [Azure portal]
Final note:
When deploying the Gitlab VM, check the logs with gitlab-ctl tail. If you see the redis default port to be 6379 means that Sidekiq has old configuration, which as I observed is not updated with gitlab-ctl reconfigure. Delete the VM and redeploy it.
I'm trying to connect from ubuntu (kubuntu 13.04) with nodejs to a sql server db! (sql server 2012)
I was looking at node odbc..
so.. I start installing FreeTds, then unixOdbc, then launch: npm install odbc
1) I configured the file "etc/freetds/freetds.conf" like this:
[FreeTDS]
host = gerry_win7
port = 1433
tds_version = 8.0
client charset = UTF-8
2) install sqsh (sudo apt-get install sqsh) and try to connect with
sqsh -S FreeTDS -U trm1 -P user
and execute a query: works perfectly!
3) then, I tried to configure ODBC access in this way:
file "/etc/odbcinst.ini":
[FreeTDS]
Description = TDS driver
Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/i386-linux-gnu/odbc/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1
file "/etc/odbc.ini":
[FreeTDS]
Driver = FreeTDS
Description = ODBC connectin via FreeTDS
Trace = No
Servername = gerry_win7
Database = testsql
UID = trm1
PWD = user
Port = 1433
4) with this sample code with nodejs I received the following error:
code:
var cn = 'DRIVER={FreeTDS};SERVER=gerry_win7;UID=trm1;PWD=user;DATABASE=testsql';
var Database = require('odbc').Database, db = new Database();
db.open(cn, function(err){
if (err) {return console.log(err);}
});
error:
[unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[Error: Error opening database]
but, as I wrote before, with the "sqsh" client the connection works: I can run queries!
can someone help me understand what I'm doing wrong?
This is the connection string I would use if I were specifying the DRIVER in it:
"DRIVER={FreeTDS};SERVERNAME=gerry_win7;DATABASE=testsql;UID=trm1;PWD=user;AutoTranslate=yes"
If you want to use the DSN that you have configured in /etc/odbc.ini then you would want to do:
"DSN=FreeTDS;UID=trm1;PWD=user;DATABASE=testsql"
Testing with the sqsh command may just use the configuration information that is in /etc/freetds/freetds.conf (citation needed). It is best to test your ODBC configuration (outside of node) with the isql command like:
$ isql FreeTDS trm1 user
Where FreeTDS is the DSN configured in /etc/odbc.ini.
Your configuration may be a little bit confusing because both the driver name and the DSN name are FreeTDS. I personally find it more helpful to use the server name or some other identifier as the DSN name specified in /etc/odbc.ini. I would suggest something like this in your odbc.ini:
[gerry]
Driver = FreeTDS
Description = ODBC connectin via FreeTDS
Trace = No
Servername = gerry_win7
Database = testsql
UID = trm1
PWD = user
Port = 1433
Then use this connection string:
"DSN=gerry;UID=trm1;PWD=user;DATABASE=testsql"
Doing it that way, you could potentially just change the Driver entry in the odbc.ini file if you want to use the SQL Server Native Client 11.0, if you get to that point. :)
Hi i have installed CVS binary(means created link to binary file) in the path /home/mrsx/bin folder and created the respositry in the path /apps/src/CVSROOT(CVSROOT respository name).
and added entries in inetd.conf as(all in single line):
cvspserver stream tcp nowait root /home/mrsx/bin/cvs cvs -f --allow-root=/apps/src/CVSROOT pserver
and in /etc/services as : cvspserver 2401/tcp
and restarted inetd.
and set CVSROOT to :pserver:username#servername:2401/apps/src/CVSROOT
and tried to login and i got connection refused error..
can anybody please tell me what is wrong in the above mentioned steps.
I just had this problem migrating an Ubuntu cvs repository. In the Debian-Ubuntu world, do this:
apt-get install cvs xinetd
establish your repository ( just follow instructions in the manual)
make sure your users have write permission. Typically create a cvs group, put them in it, and mark the repos 775; chgrp -R cvs * ( cvs lacks security, read the manual)
add a file in /etc/xinetd.d called cvspserver
edit the file similar to this:
service cvspserver
{
port = 2401
socket_type = stream
protocol = tcp
user = root
wait = no
type = UNLISTED
server = /usr/bin/cvs
server_args = -f --allow-root /usr/local/cvs pserver
disable = no
}
reboot or restart xinetd