{"id":20502691,"url":"https://github.com/little-brother/httpsql","last_synced_at":"2025-04-13T20:14:31.090Z","repository":{"id":64307769,"uuid":"129067232","full_name":"little-brother/httpsql","owner":"little-brother","description":"Http server to monitoring SQL databases","archived":false,"fork":false,"pushed_at":"2018-04-11T09:18:49.000Z","size":4,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T20:14:21.746Z","etag":null,"topics":["db-connection","db-monitoring","http-server","monitoring","remote-sql","sql","sql-gateway","usql","zabbix"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/little-brother.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-11T09:15:17.000Z","updated_at":"2023-06-13T06:31:21.000Z","dependencies_parsed_at":"2023-01-15T11:00:23.193Z","dependency_job_id":null,"html_url":"https://github.com/little-brother/httpsql","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/little-brother%2Fhttpsql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/little-brother%2Fhttpsql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/little-brother%2Fhttpsql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/little-brother%2Fhttpsql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/little-brother","download_url":"https://codeload.github.com/little-brother/httpsql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248774968,"owners_count":21159534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["db-connection","db-monitoring","http-server","monitoring","remote-sql","sql","sql-gateway","usql","zabbix"],"created_at":"2024-11-15T19:27:03.590Z","updated_at":"2025-04-13T20:14:31.072Z","avatar_url":"https://github.com/little-brother.png","language":"Go","readme":"Httpsql is a http server to provides a simple way of monitoring SQL databases via a http request by predefined queries.\n\n### How to build app\n1. Download and install [Golang](https://golang.org/dl/)\n2. Download dependencies\n   ```bash\n   go get -v -d ./\n    ```\n3. Build application\n   ```bash \n   go build -ldflags=\"-s -w\"\n   ```\n\nAlso you can download [binary](https://github.com/little-brother/httpsql/releases).\n\n### How to use\nBefore continue you must create `config.json` in app folder. Below is an example:\n\n\u003cpre\u003e\n{\n  \"port\": \"9000\",\n  \"databases\": {\n  \n    \"demo\": {\n      \"driver\": \"mysql\",\n      \"dns\": \"myuser@tcp(192.168.0.101)/mydb\",\n      \"metrics\": [\"now\", \"count\", \"minmax\", \"getbyid\"]\n    },\n    \n    \"demo2\": {\n      \"driver\": \"postgres\",\n      \"dns\": \"host=192.168.0.101 user=home password=password dbname=mydb2 sslmode=disable\",\n      \"metrics\": [\"count\", \"minmax\"]\n    }\n  },\n\n  \"metrics\": {\n  \n    \"now\": {\n      \"query\": \"select now()\",\n      \"description\": \"Params: none. Returns current date and time.\"\n    },\n\n    \"count\": {\n      \"query\": \"select count(1) as count from #table\",\n      \"description\": \"Params: table. Returns row count of table.\"\n    },\n    \n    \"minmax\": {\n      \"query\": \"select min(#column) min, max(#column) max from #table\",\n      \"description\": \"Params: table, column. Returns max and min value.\"\n    },\n    \n    \"getbyid\": {\n      \"query\": \"select * from #table where id = $id\",\n      \"description\": \"Params: table, id. Returns row with requested id.\"\n    }\n  }\n}\n\u003c/pre\u003e\n\nThe following links will be available for this configuration:\n* `/` returns all database aliases: `demo` and `demo2`\n* `/demo` returns all available metrics for database `demo` and their description\n* `/demo/now` returns `mydb` date and time\n* `/demo/count?table=orders` returns row count for `mydb.orders`\n* `/demo/minmax?table=orders\u0026column=price` returns minimal and maximum `price` in `mydb.orders`\n* `/demo/getbyid?table=orders\u0026id=10` returns order detail with id = `10`\n* `/demo2/count?table=customers` returns customer count in `mydb2.customers`\n* `/demo2/minmax?table=...`\n \nIn query `#param` defines a url parameter `param` that value will be substituted directly into the query. To avoid sql injections, all characters except `a-Z0-9_.$` will be removed from value and length is limited to 64 characters. `$param` defines a placeholder parameter and can contains any symbols.\n\u003cbr\u003e\n\nRequest result is `json` or `text`(csv). By default data format defines by http `Accept` header. You can lock format by adding `json` or `text` to requested url e.g. `/demo2/count?table=customers\u0026text`.\n\u003cbr\u003e\n\n| One permanent connection is used for each database. If necessary, the connection will be restored. |\n|---|\n\n### Supported databases\n\n|DBMS|Driver|Dns example|\n|-----|--------|----------|\n|MySQL|[mysql](https://github.com/go-sql-driver/mysql)|myuser@tcp(192.168.0.101)/mydb|\n|PosgreSQL|[postgres](https://github.com/lib/pq)|host=192.168.0.101 user=home password=password dbname=mydb sslmode=disable|\n|MSSQL|[mssql](https://github.com/denisenkom/go-mssqldb)|sqlserver://username:password@host/instance?param1=value\u0026param2=value\u003cbr\u003esqlserver://username:password@host:port?param1=value\u0026param2=value|\n|ADODB|[adodb](https://github.com/mattn/go-adodb)|Provider=Microsoft.Jet.OLEDB.4.0;Data Source=my.mdb;|\n|ODBC|[odbc](https://github.com/alexbrainman/odbc)|Driver={Microsoft ODBC for Oracle};Server=ORACLE8i7;Persist Security Info=False;Trusted_Connection=Yes|\n|ClickHouse|[clickhouse](https://github.com/kshvakov/clickhouse)|tcp://127.0.0.1:9000?username=\u0026debug=true|\n|Firebird|[firebirdsql](https://github.com/nakagami/firebirdsql)|user:password@servername/foo/bar.fdb|\n|SQLite3|[sqlite3](https://github.com/mattn/go-sqlite3)|D:/aaa/bbb/mydb.sqlite|\n\n\u003e Notice: most databases require additional configuration for remote connections\n\nYou can add other [drivers](https://github.com/golang/go/wiki/SQLDrivers) but some of them requires additional software.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flittle-brother%2Fhttpsql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flittle-brother%2Fhttpsql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flittle-brother%2Fhttpsql/lists"}