Hi folks,
I've got an external provisioning system setup here, which I want to interface to Zabbix.
Is there some way I can call a php script on the command line, with arguements that contain the host settings?
I've got this far thanks to other posts, but get errors relating to permissions.....
#!/usr/bin/php4
<?php
include "include/config.inc.php";
$page["title"] = "Hosts";
$page["file"] = "hosts.php";
$hard_port = "10050"; //cause I want to use ZABBIX agentd on this port
$hard_status = "0"; //cause I want the status to be monitored
$hard_useip = "0"; //cause I want to use IP address
$hard_newgroup = ""; //I did not used it
$hard_host_templateid = "10014"; //This is the hostid of the host template
$hard_groups = array(4); //This is the group I want my new host to belong to...
$host = $argv[0]; //hostname from command line
$ip = '';//not using ip addresses
add_host($host,$hard_port,$hard_status,$hard_useip ,$ip,$hard_host_templateid,$hard_newgroup,$hard_gr oups);
?>
this script doesn't work
Error in query [select permission from rights where name='Default permission' and userid=] [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/zabbix/include/db.inc.php on line 149
Error in query [select permission from rights where name='Host' and id=0 and userid=] [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/zabbix/include/db.inc.php on line 149
So how can I 'jig' the permissions stuff?
-Cheers Max
I've got an external provisioning system setup here, which I want to interface to Zabbix.
Is there some way I can call a php script on the command line, with arguements that contain the host settings?
I've got this far thanks to other posts, but get errors relating to permissions.....
#!/usr/bin/php4
<?php
include "include/config.inc.php";
$page["title"] = "Hosts";
$page["file"] = "hosts.php";
$hard_port = "10050"; //cause I want to use ZABBIX agentd on this port
$hard_status = "0"; //cause I want the status to be monitored
$hard_useip = "0"; //cause I want to use IP address
$hard_newgroup = ""; //I did not used it
$hard_host_templateid = "10014"; //This is the hostid of the host template
$hard_groups = array(4); //This is the group I want my new host to belong to...
$host = $argv[0]; //hostname from command line
$ip = '';//not using ip addresses
add_host($host,$hard_port,$hard_status,$hard_useip ,$ip,$hard_host_templateid,$hard_newgroup,$hard_gr oups);
?>
this script doesn't work

Error in query [select permission from rights where name='Default permission' and userid=] [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/zabbix/include/db.inc.php on line 149
Error in query [select permission from rights where name='Host' and id=0 and userid=] [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/zabbix/include/db.inc.php on line 149
So how can I 'jig' the permissions stuff?
-Cheers Max
I wanted to do it as cleanly as possible.
Comment