danielgoepp opened a new issue, #3486:
URL: https://github.com/apache/hertzbeat/issues/3486
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Current Behavior
When adding monitors via the API, most (but not all strangely) will come up
in a down state unless all fields (even unused) are added. If I go into the web
interface, edit a monitor, change nothing, just hit save, the monitor would
change to up. I compared the output of the JSON for the monitor before and
after, and the only change was a bunch of unused fields getting added to the
monitor:
```
{
"field": "uri",
"type": 1
},
{
"field": "authType",
"type": 1
},
{
"field": "username",
"type": 1
},
{
"field": "password",
"type": 1
},
{
"field": "keyword",
"type": 1
}
```
I changed my code to include these with no values, and that seems to have
resolved the problem. However, if I don't use a field, I shouldn't have to
provide it.
### Expected Behavior
I would expect that if I don't set a field and it is not necessary, that the
test would run and show up just fine.
### Steps To Reproduce
If I build my monitors using this, 90% will come up down:
```
monitor = {
"monitor": {
"name": row.get("name"),
"app": "website",
"host": row.get("host"),
"intervals": 60,
},
"params": [
{"field": "timeout", "paramValue": 1000},
{"field": "host", "paramValue": row.get("host")},
{"field": "port", "paramValue": row.get("port")},
{
"field": "ssl",
"paramValue": False if row.get("protocol") == "http"
else True,
},
],
}
```
If I change that and build them adding extra unused parameters, they will
all come up fine.
```
monitor = {
"monitor": {
"name": row.get("name"),
"app": "website",
"host": row.get("host"),
"intervals": 60,
},
"params": [
{"field": "timeout", "paramValue": 1000},
{"field": "host", "paramValue": row.get("host")},
{"field": "port", "paramValue": row.get("port")},
{
"field": "ssl",
"paramValue": False if row.get("protocol") == "http"
else True,
},
{"field": "uri"},
{"field": "authType"},
{"field": "username"},
{"field": "password"},
{"field": "keyword"},
],
}
```
### Environment
```markdown
HertzBeat version(s): 1.7.0
```
### Debug logs
N/A
### Anything else?
N/A
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]