View Full Version : batch or autocreate?
I'm looking into using Zabbix for our operations monitoring tool. I installed Zabbix-1.0 on FC4 with MySQL and agents on 7.2, AS, RHEL4, Mandrake & win2K & 2003
Before I start adding every server to the host list along with adding a graph item for each item and then building screens, I was wondering what resources are available for doing this in batch forms? I see I can write some php buttons to add functionality to the existing interface, but maybe the functions already exist?
I'd like to be able to :
1. add hosts in batch
2. add graphs to all items (or just some items by default)
3. have graphs assigned to templates
4. and this is critical, add a y2 axis to graphs
and last....and least, is there something to auto detect the partitions within the agent and have it report those back?
thanks
-zac
James Wells
14-10-2005, 18:53
Greetings,
Yes, and no. Most of the functionality you are looking for is there, but does require some PHP modifications. Check out howto batch populate/insert/add of numerous hosts (http://www.zabbix.com/forum/showthread.php?t=242) to see a code mod that will allow for bulk host addition. Once the hosts are added, you can then go and add the items, screens, graphs, etc to the template that you linked the hosts to.
That is just about the easiest way to bulk load hosts. Hope it helps.
1: the add multiple hosts modifications to hosts.php worked. thank you.
2:you mention that graphs/screens can be added to templates, but I don't see how this is accomplished. I see items can be, but I'd like to have graphs for specific items (lets say cpu,network & disk by default for every host when added). Is it possible to do this now or do I have to write a button that says
foreach host in group
foreach item in host
add_graph()
add_item_to_graph();
?
3: when creating new templates I am unable to have the items from the source template added to the new template. for instance if I make a new host, select "Use the host as a template" with host.unix and say "add" then I get a new template, but it has none of the items from the template. if I then "change" the host and say "add items from template" with Host.unix selected as the template, I get a "[ERROR:Cannot add items. Select template first]"
Am I doing this correctly?
thanks
-zac
in the example of adding multipul hosts I didn't realize that the <form> wasn't terminated so when using a form above it, the host form would get the templateID of 0 from the mform
Also instead of using a text file, I just read a textarea from the form
echo "<form method=\"get\" action=\"hosts.php#mform\">";
echo "HOST LIST<BR>host,ip,port";
show_table2_h_delimiter();
echo "<textarea class=\"biginput\" name=\"mhoststext\" value=\"$mhoststext\" rows=10 cols=40 ></TEXTAREA>";
show_table2_v_delimiter();
with the addition to the register checks as follows
if($HTTP_GET_VARS["register"]=="add multiple hosts")
{
//$listing=file($HTTP_GET_VARS['mfile']);
$listing=($HTTP_GET_VARS["mhoststext"]);
$array = explode("\n", $listing);
foreach($array as $element_number => $element)
{
list($mhost, $mip, $mport)=explode (",", $element);
$result=add_host($mhost,$mport,$HTTP_GET_VARS["mstatus"],$HTTP_GET_VARS["museip"],$mip,$HTTP_GET_VARS["host_templateid"],$HTTP_GET_VARS["mnewgroup"],$HTTP_GET_VARS["mgroups"]);
show_messages($result,"Host added","Cannot add host");
unset($HTTP_GET_VARS["hostid"]);
}
}
so that's mostly working now...moving on to auto graph creation