Forum Discussion

DamienC's avatar
DamienC
Icon for Neophyte rankNeophyte
5 hours ago

Python script to run API call - AddWebsite - Need help with collectors

Hello,

I'm having troubles having a python script to work properly.
I manage to have my webcheck created. But it always comes with no collector/checkpoint.

Looking at the API sdk documentation doesn't really help me figure what I'm doing wrong.

I tried doing a GET on existing webchecks, to copy/paste the following blocks: test_location, Checkpoints, Collectors.

Here is a sample of my script:

(the collector name is: "domain\\servername")

I grabbed these blocks from the getwebsitelist output:

 

Here is the API output when I try to create the webcheck:

{'alert_expr': '',
 'checkpoints': [{'geo_info': 'Overall', 'id': randomNumber, 'smg_id': 0}],
 'collectors': [],
 'description': 'Test API by Damien',
 'disable_alerting': True,
 'domain': 'Valid_website_url',
 'global_sm_alert_cond': 0,
 'group_id': 321,
 'id': 4701,
 'ignore_ssl': True,
 'individual_alert_level': 'warn',
 'individual_sm_alert_enable': False,
 'is_internal': True,
 'last_updated': 1732304976,
 'name': 'testDamien',
 'overall_alert_level': 'warn',
 'page_load_alert_time_in_ms': 30000,
 'polling_interval': 5,
 'properties': [],
 'role_privileges': [],
 'schema': 'http',
 'status': 'dead-collector',
 'steps': [{'auth': None,
            'description': '',
            'enable': True,
            'follow_redirection': True,
            'fullpage_load': False,
            'http_body': '',
            'http_headers': '',
            'http_method': 'GET',
            'http_version': '1.1',
            'invert_match': False,
            'keyword': 'Alive',
            'label': '',
            'match_type': 'plain',
            'name': '__step0',
            'path': '',
            'post_data_edit_type': None,
            'req_script': '',
            'req_type': 'config',
            'require_auth': False,
            'resp_script': '',
            'resp_type': 'config',
            'schema': 'http',
            'status_code': '',
            'timeout': 30,
            'type': 'script',
            'url': '',
            'use_default_root': True}],
 'stop_monitoring': False,
 'stop_monitoring_by_folder': False,
 'template': None,
 'test_location': {'all': True,
                   'collector_ids': [],
                   'collectors': [],
                   'smg_ids': []},
 'transition': 5,
 'trigger_ssl_expiration_alert': False,
 'trigger_ssl_status_alert': False,
 'type': 'webcheck',
 'use_default_alert_setting': False,
 'use_default_location_setting': False,
 'user_permission': 'write'}

And how it looks in the portal:

 

Anyone has any idea of what I may be missing ?

Thanks in advance.

No RepliesBe the first to reply