# NetSpyGlass Command Line Tools
this package installs Python module `nsgcli` and two command line scripts: `nsgcli` and `nsgql` that
use it
Use script `tools/build.sh` to build and `tools/upload.sh` to push to pypi
Example of API call made by `nsgcli` to nsg-api service:
* System status
```bash
curl -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/status
```
* NSGQL
```bash
curl -d '{"targets": [{"format":"table", "nsgql":"select count(key) from alerts"}]}' -X POST -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/query/net/1/data/
```
* NSGGROK
Parse text with custom pattern
```bash
nsggrok --pattern "hello world of %{WORD:world_name}" text "hello world of Grok"
{
"world_name": "Grok"
}
```
Parse syslog message with built-in patterns
```bash
nsggrok log "<13>May 18 11:22:43 carrier sshd: SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'"
{
"sshUser": "root",
"index": "labdcdev-syslog-short",
"sshSrcIp": "10.1.1.1",
"logText": "SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'",
"prio": "13",
"logSyslogSeverityName": "notice",
"logSource": "carrier",
"logSyslogText": "<13>May 18 11:22:43 carrier sshd: SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'",
"logSyslogFacilityName": "user",
"logTimestamp": "2021-05-18T11:22:43.000Z",
"program": "sshd",
"logSyslogPriority": 13,
"timestamp": "May 18 11:22:43",
"logSyslogFacilityCode": 1,
"logSyslogSeverityCode": 5
}
```
* Meraki API call
```bash
curl -G -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/exec/api --data-urlencode 'region=world' --data-urlencode 'url=https://api.meraki.com/api/v1/organizations/626563298157920259/devices' --data-urlencode 'method=GET' --data-urlencode 'args=gap-meraki'
```
* Test connection to remote server
```bash
curl -G -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/exec/connect --data-urlencode 'region=world' --data-urlencode 'args=10.210.24.112 9339 1000'
```
* Set log level
```bash
curl -G -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/exec/set_log_level --data-urlencode 'region=world' --data-urlencode 'args=tme-server-15v io.grpc DEBUG'
```
* Send PING command to an agent
```bash
curl -L -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/apiv3/net/1/exec/ping/agent/vkhome?address=127.0.0.1
```
Raw data
{
"_id": null,
"home_page": "https://github.com/happygears/nsgcli",
"name": "nsgcli",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "network monitoring NMS netspyglass",
"author": "Happy Gears, Inc",
"author_email": "vadim@happygears.net",
"download_url": "https://files.pythonhosted.org/packages/f5/7d/9675ec8966c6f0691925c053377b2d40ba24836da0c449e1949e3adc796e/nsgcli-2.2.5.tar.gz",
"platform": null,
"description": "# NetSpyGlass Command Line Tools\n\nthis package installs Python module `nsgcli` and two command line scripts: `nsgcli` and `nsgql` that\nuse it\n\nUse script `tools/build.sh` to build and `tools/upload.sh` to push to pypi\n\nExample of API call made by `nsgcli` to nsg-api service:\n\n* System status\n\n ```bash\n curl -H \"X-NSG-Auth-API-Token:$NSG_API_TOKEN\" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/status\n ```\n\n* NSGQL\n\n ```bash\n curl -d '{\"targets\": [{\"format\":\"table\", \"nsgql\":\"select count(key) from alerts\"}]}' -X POST -H \"X-NSG-Auth-API-Token:$NSG_API_TOKEN\" $NSG_SERVICE_URL/v2/query/net/1/data/\n ```\n\n* NSGGROK\n\n Parse text with custom pattern\n ```bash\n nsggrok --pattern \"hello world of %{WORD:world_name}\" text \"hello world of Grok\"\n {\n \"world_name\": \"Grok\"\n }\n ```\n\n Parse syslog message with built-in patterns\n ```bash\n nsggrok log \"<13>May 18 11:22:43 carrier sshd: SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'\"\n {\n \"sshUser\": \"root\",\n \"index\": \"labdcdev-syslog-short\",\n \"sshSrcIp\": \"10.1.1.1\",\n \"logText\": \"SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'\",\n \"prio\": \"13\",\n \"logSyslogSeverityName\": \"notice\",\n \"logSource\": \"carrier\",\n \"logSyslogText\": \"<13>May 18 11:22:43 carrier sshd: SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'\",\n \"logSyslogFacilityName\": \"user\",\n \"logTimestamp\": \"2021-05-18T11:22:43.000Z\",\n \"program\": \"sshd\",\n \"logSyslogPriority\": 13,\n \"timestamp\": \"May 18 11:22:43\",\n \"logSyslogFacilityCode\": 1,\n \"logSyslogSeverityCode\": 5\n }\n ```\n\n* Meraki API call\n```bash\ncurl -G -H \"X-NSG-Auth-API-Token:$NSG_API_TOKEN\" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/exec/api --data-urlencode 'region=world' --data-urlencode 'url=https://api.meraki.com/api/v1/organizations/626563298157920259/devices' --data-urlencode 'method=GET' --data-urlencode 'args=gap-meraki'\n```\n\n* Test connection to remote server\n```bash\ncurl -G -H \"X-NSG-Auth-API-Token:$NSG_API_TOKEN\" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/exec/connect --data-urlencode 'region=world' --data-urlencode 'args=10.210.24.112 9339 1000'\n```\n\n* Set log level\n```bash\ncurl -G -H \"X-NSG-Auth-API-Token:$NSG_API_TOKEN\" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/exec/set_log_level --data-urlencode 'region=world' --data-urlencode 'args=tme-server-15v io.grpc DEBUG'\n```\n\n* Send PING command to an agent\n```bash\ncurl -L -H \"X-NSG-Auth-API-Token:$NSG_API_TOKEN\" $NSG_SERVICE_URL/apiv3/net/1/exec/ping/agent/vkhome?address=127.0.0.1\n```\n\n",
"bugtrack_url": null,
"license": "Apache",
"summary": "NetSpyGlass CLI",
"version": "2.2.5",
"project_urls": {
"Homepage": "https://github.com/happygears/nsgcli"
},
"split_keywords": [
"network",
"monitoring",
"nms",
"netspyglass"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6f370aa4608f2acd5693d0118921c456bd6baceeb24d0b5f644f59922c735e53",
"md5": "54e9c87229709e75da4ff6370957525e",
"sha256": "792e571e399a7099a253f60b110d9943992257e7586e8a4b04d7cf845b52eb8d"
},
"downloads": -1,
"filename": "nsgcli-2.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "54e9c87229709e75da4ff6370957525e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 47685,
"upload_time": "2023-11-16T22:45:40",
"upload_time_iso_8601": "2023-11-16T22:45:40.130065Z",
"url": "https://files.pythonhosted.org/packages/6f/37/0aa4608f2acd5693d0118921c456bd6baceeb24d0b5f644f59922c735e53/nsgcli-2.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f57d9675ec8966c6f0691925c053377b2d40ba24836da0c449e1949e3adc796e",
"md5": "89436496d9b604c65a7bbcfd8215e6ed",
"sha256": "5d5b3508dddbde7e26bb1444195899274f1c2615062113417f6d83ecd3d7bb2d"
},
"downloads": -1,
"filename": "nsgcli-2.2.5.tar.gz",
"has_sig": false,
"md5_digest": "89436496d9b604c65a7bbcfd8215e6ed",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 34000,
"upload_time": "2023-11-16T22:45:42",
"upload_time_iso_8601": "2023-11-16T22:45:42.005122Z",
"url": "https://files.pythonhosted.org/packages/f5/7d/9675ec8966c6f0691925c053377b2d40ba24836da0c449e1949e3adc796e/nsgcli-2.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-16 22:45:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "happygears",
"github_project": "nsgcli",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nsgcli"
}