update_health_check

The unit/update_health_check request is used to configure health check settings for a unit.

Copied!
svc=unit/update_health_check&params={
    "itemId":<long>, 
    "settings":<text>
    }

Parameters

The following parameters are required:

Name Description
itemId Unit ID.
settings JSON with parameters of health check settings. See below.

JSON example

Below is an example of a JSON object with parameters of health check settings.

Copied!

    "settings": {
    "low_battery": { 
        "period": "1h",
        "unhealthy_conditions": [
            {
                "type": "less",  // less, greater, equal, not_equal, unchanged
                "value": 20.0
            }
        ]
    },
    "max_messages_last_hour": {
        "period": "1m",
        "unhealthy_conditions": [
            {
                "type": "greater",  // less, greater, equal, not_equal, unchanged
                "value": 1000.0
            }
        ]
    },
    "no_data": {
        "period": "1d"
    },
    "missing_position_data": {
        "period": "1m"
    },
    "insufficient_satellite_coverage": {
        "period": "1m",
        "unhealthy_conditions": [
            {
                "type": "less",  // less, greater, equal, not_equal, unchanged
                "value": 4.0
            }
        ]
    },
    "max_distance_between_messages": {
        "period": "1h",
        "unhealthy_conditions": [
            {
                "type": "greater",  // less, greater, equal, not_equal, unchanged
                "value": 100000.0 // m
            }
        ]
    },
    "sensor": {
        "items": [
            {
                "id": 1, // voltage
                "period": "1m",
                "unhealthy_conditions": [
                    {
                        "type": "less", // less, greater, equal, not_equal, unchanged
                        "value": 12.0
                    }, 
                    {
                        "type": "greater",  // less, greater, equal, not_equal, unchanged
                        "value": 13.0
                    }
                ]
            },
            {
                "id": 3, // fuel
                "period": "1m",
                "unhealthy_conditions": [
                    {
                        "type": "unchanged",  // less, greater, equal, not_equal, unchanged
                        "value": 0.0 // do not parse
                    }
                ]
            },
            {
                "id": 2, // digital (ignition)
                "period": "1m",
                "unhealthy_conditions": [
                    {
                        "type": "equal", // equal, not_equal
                        "value": 0.0 // 0.0 - off, 1.0 - on
                    }
                ]
            }
        ]
    }
}

Example

Below is an example of the unit/update_health_check request.

Copied!

svc=unit/update_health_check&params={
    "itemId": 1583,
    "settings": {
        "low_battery": { 
            "period": "1h",
            "unhealthy_conditions": [
                {
                    "type": "less",
                    "value": 20.0
                }
            ]
        },
        "max_messages_last_hour": {
            "period": "1m",
            "unhealthy_conditions": [
                {
                    "type": "greater", 
                    "value": 1000.0
                }
            ]
        },
        "no_data": {
            "period": "1d"
        },
        "missing_position_data": {
            "period": "1m"
        },
        "insufficient_satellite_coverage": {
            "period": "1m",
            "unhealthy_conditions": [
                {
                    "type": "less", 
                    "value": 4.0
                }
            ]
        },
        "max_distance_between_messages": {
            "period": "1h",
            "unhealthy_conditions": [
                {
                    "type": "greater", 
                    "value": 100000.0 
                }
            ]
        },
        "sensor": {
            "items": [
                {
                    "id": 1, 
                    "period": "1m",
                    "unhealthy_conditions": [
                        {
                            "type": "less", 
                            "value": 12.0
                        }, 
                        {
                            "type": "greater", 
                            "value": 13.0
                        }
                    ]
                },
                {
                    "id": 3, 
                    "period": "1m",
                    "unhealthy_conditions": [
                        {
                            "type": "unchanged",
                            "value": 0.0 
                        }
                    ]
                },
                {
                    "id": 2, 
                    "period": "1m",
                    "unhealthy_conditions": [
                        {
                            "type": "equal", 
                            "value": 0.0 
                        }
                    ]
                }
            ]
        }
    }
}

Response

If the request is completed successfully, an empty response is returned.

Copied!
{ }

Otherwise, an error code is returned.

Error codes

Error code Description
4 Wrong input parameters.
7 The “Health check” service is not enabled or the user doesn’t have the ADF_ACL_ITEM_EDIT_OTHER access right to the unit.
6 Error updating health check settings.
Download PDF file
Download Word document

See also