Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-5656

API in Zabbix v2 fails to add maintenance period via API (SQL error)

    Details

      Description

      Im trying to create a maintenance period here. Ive got the correct array, but zabbix gives me this error:

      string(92) "API error -32500: SQL statement execution has failed "INSERT INTO timeperiods () VALUES ()"."
      

      Small piece of code:

      <?php
      	public function createMaintenance($params = null, $name, $description, $from, $till){
      		try{
      			$params['groupids'] = array('23');
      			$params['name'] = $name;
      			$params['description'] = $description;
      			$params['active_since'] = $from;
      			$params['active_till'] = $till;
      			$params['maintenance_type'] = 0;
      			$params['timeperiods'] = array('timeperiod_type' => 0, 'start_date' => $from, 'period' => 36000);
      
      			$response = $this->api->maintenanceCreate($params);
      		}catch(Exception $e){
      			return $e->getMessage();
      		}
      		
      		return $response;
      	}
      ?>
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nforce NFOrce Entertainment
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: