globalnoc-monitoring-service-status


Nameglobalnoc-monitoring-service-status JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-08-08 15:09:52
maintainerNone
docs_urlNone
authorYour Name
requires_python<4.0,>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # GlobalNOC Status Monitoring Library

This Python library is used to write status files for GRNOC software.

---

## Requirements

Please make sure you have the following dependencies already installed on your host:

- `python3`
- `python3-setuptools`

## Installation

Run the following command to install the library:

```console
foo@bar:~$ sudo yum install python3-globalnoc-monitoring-service-status
```

## Import 

Import the `write_service_status` function using the following line of code:

```python
from globalnoc_monitoring_service_status import write_service_status
```

## Function Parameters
The `write_service_status` function has the following parameters:

| Parameter | Required? |  Default Value | Description |
| ------ | ------ | ------ | ------ |
| `error` | Yes | - | Error Number |
| `error_text` | Yes | - | Error Description |
| `path` | No | - | Target folder |
| `service` | No | - | Service Name |
| `filename` | No | `status.txt` | Status File Name|
| `timestamp` | No | Current Time | Unix Timestamp|

**Note**: You must either provide a path to the status file folder or a service name.

If for some reason `path` and `service` are both passed as arguments, the function will create the status file at the provided `path`.

## Usage
Here are some code snippets using this module:

```python
from globalnoc_monitoring_service_status import write_service_status

# Create status.txt at /var/lib/grnoc/fortigate_collector/
write_service_status(error=0,
                     error_text='Data queued to RabbitMQ Successfully.', 
                     service='fortigate_collector')

# Create status_log at /var/lib/my_service/
write_service_status(error=1,
                     error_text='Error making GET request.', 
                     path='/var/lib/my_service/', 
                     filename='status_log')

# Create status.txt at /var/lib/my_service/ with custom timestamp
write_service_status(error=1,
                     error_text='Error making GET request.', 
                     path='/var/lib/my_service/',
                     timestamp='1596547846')
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "globalnoc-monitoring-service-status",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/e8/41/bda296e13c78816aae81ea74e7346d66e578be16bcabadcaed18ec5f2678/globalnoc-monitoring-service-status-0.1.0.tar.gz",
    "platform": null,
    "description": "# GlobalNOC Status Monitoring Library\n\nThis Python library is used to write status files for GRNOC software.\n\n---\n\n## Requirements\n\nPlease make sure you have the following dependencies already installed on your host:\n\n- `python3`\n- `python3-setuptools`\n\n## Installation\n\nRun the following command to install the library:\n\n```console\nfoo@bar:~$ sudo yum install python3-globalnoc-monitoring-service-status\n```\n\n## Import \n\nImport the `write_service_status` function using the following line of code:\n\n```python\nfrom globalnoc_monitoring_service_status import write_service_status\n```\n\n## Function Parameters\nThe `write_service_status` function has the following parameters:\n\n| Parameter | Required? |  Default Value | Description |\n| ------ | ------ | ------ | ------ |\n| `error` | Yes | - | Error Number |\n| `error_text` | Yes | - | Error Description |\n| `path` | No | - | Target folder |\n| `service` | No | - | Service Name |\n| `filename` | No | `status.txt` | Status File Name|\n| `timestamp` | No | Current Time | Unix Timestamp|\n\n**Note**: You must either provide a path to the status file folder or a service name.\n\nIf for some reason `path` and `service` are both passed as arguments, the function will create the status file at the provided `path`.\n\n## Usage\nHere are some code snippets using this module:\n\n```python\nfrom globalnoc_monitoring_service_status import write_service_status\n\n# Create status.txt at /var/lib/grnoc/fortigate_collector/\nwrite_service_status(error=0,\n                     error_text='Data queued to RabbitMQ Successfully.', \n                     service='fortigate_collector')\n\n# Create status_log at /var/lib/my_service/\nwrite_service_status(error=1,\n                     error_text='Error making GET request.', \n                     path='/var/lib/my_service/', \n                     filename='status_log')\n\n# Create status.txt at /var/lib/my_service/ with custom timestamp\nwrite_service_status(error=1,\n                     error_text='Error making GET request.', \n                     path='/var/lib/my_service/',\n                     timestamp='1596547846')\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49b6f2469af292a08f053fb31e2b39b7e2a85ae014f33a340fe291756c2f6087",
                "md5": "b1759da6511e97e3288bf90dc23b6775",
                "sha256": "13e4aa58fbb03980b7425a55e35dee894bb67320f81d36bb70e162369822506e"
            },
            "downloads": -1,
            "filename": "globalnoc_monitoring_service_status-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b1759da6511e97e3288bf90dc23b6775",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 2384,
            "upload_time": "2024-08-08T15:09:54",
            "upload_time_iso_8601": "2024-08-08T15:09:54.557039Z",
            "url": "https://files.pythonhosted.org/packages/49/b6/f2469af292a08f053fb31e2b39b7e2a85ae014f33a340fe291756c2f6087/globalnoc_monitoring_service_status-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e841bda296e13c78816aae81ea74e7346d66e578be16bcabadcaed18ec5f2678",
                "md5": "81a0e58c74a351f5f571b1c6cd5fdcb7",
                "sha256": "f8c630b267a3374c7ba33bf06e8053ecf0507fc3fb1be0cb170d5d934509b4c1"
            },
            "downloads": -1,
            "filename": "globalnoc-monitoring-service-status-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "81a0e58c74a351f5f571b1c6cd5fdcb7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 2221,
            "upload_time": "2024-08-08T15:09:52",
            "upload_time_iso_8601": "2024-08-08T15:09:52.969004Z",
            "url": "https://files.pythonhosted.org/packages/e8/41/bda296e13c78816aae81ea74e7346d66e578be16bcabadcaed18ec5f2678/globalnoc-monitoring-service-status-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-08 15:09:52",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "globalnoc-monitoring-service-status"
}
        
Elapsed time: 0.28249s