监控全网服务的服务 2018.03.26
Project description
# slavem
监控全网其他服务的服务
## MongoDB
1. 配置一个MongoDB数据库,会创建数据库`slavem`。
2. 这个数据库用于接受定时任务的汇报和设置定时任务列表。
3. 为了你的人身安全,请设置用户名密码访问数据库。
## 配置文件
```json
{
"host": "localhost",
"port": 27017,
"dbn": "slavem",
"username": "slavem",
"password": "slavem",
}
```
## 启动服务
```python
import slavem
monitor = slavem.Monitor(
host='localhost',
port=27017,
)
monitor.start()
```
## 任务
### 创建任务
```python
import slavem
import json
settingPath = './slavem_setting.json'
with open(settingPath, 'r') as f:
kwarg = json.load(f)
monitor = slavem.Monitor(**kwarg)
taskKwargs = {
'name': 'serverName', # 可以重复
'type': 'serverType',
'lanuch': '20:50:00', # 启动时刻
'delay': 5, # min 启动后 delay 分钟后查看启动结果
'host': 'localhost', # 服务所在的 host
}
monitor.createTask(**taskKwargs)
monitor.stop()
```
### 查看任务
```python
import slavem
import json
settingPath = './slavem_setting.json'
with open(settingPath, 'r') as f:
kwarg = json.load(f)
monitor = slavem.Monitor(**kwarg)
monitor.showTask()
monitor.stop()
```
监控全网其他服务的服务
## MongoDB
1. 配置一个MongoDB数据库,会创建数据库`slavem`。
2. 这个数据库用于接受定时任务的汇报和设置定时任务列表。
3. 为了你的人身安全,请设置用户名密码访问数据库。
## 配置文件
```json
{
"host": "localhost",
"port": 27017,
"dbn": "slavem",
"username": "slavem",
"password": "slavem",
}
```
## 启动服务
```python
import slavem
monitor = slavem.Monitor(
host='localhost',
port=27017,
)
monitor.start()
```
## 任务
### 创建任务
```python
import slavem
import json
settingPath = './slavem_setting.json'
with open(settingPath, 'r') as f:
kwarg = json.load(f)
monitor = slavem.Monitor(**kwarg)
taskKwargs = {
'name': 'serverName', # 可以重复
'type': 'serverType',
'lanuch': '20:50:00', # 启动时刻
'delay': 5, # min 启动后 delay 分钟后查看启动结果
'host': 'localhost', # 服务所在的 host
}
monitor.createTask(**taskKwargs)
monitor.stop()
```
### 查看任务
```python
import slavem
import json
settingPath = './slavem_setting.json'
with open(settingPath, 'r') as f:
kwarg = json.load(f)
monitor = slavem.Monitor(**kwarg)
monitor.showTask()
monitor.stop()
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
slavem-0.3.4.tar.gz
(10.4 kB
view details)
File details
Details for the file slavem-0.3.4.tar.gz
.
File metadata
- Download URL: slavem-0.3.4.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a129cc4d8b2a5977e9ab33e399fd9344dea413aa68a1f72908dd6062ee33585c |
|
MD5 | aa7256a2ae9a5bccbd811672a55eea1e |
|
BLAKE2b-256 | 509898405f9d24e2f7773094f2b13139a9e22f359a05c483d468d7c61793abe0 |