Project

General

Profile

Download (656 Bytes) Statistics
| Branch: | Revision:
1
#!/usr/bin/perl
2
# save_groups.cgi
3
# Save all hostgroup directives
4

    
5
require './mon-lib.pl';
6
&ReadParse();
7
&error_setup($text{'groups_err'});
8
$conf = &get_mon_config();
9
@ogroups = &find("hostgroup", $conf);
10

    
11
for($i=0; defined($in{"group_$i"}); $i++) {
12
	next if (!$in{"group_$i"});
13
	$in{"group_$i"} =~ /^\S+$/ || &error($text{'groups_egroup'});
14
	@mems = split(/\s+/, $in{"members_$i"});
15
	@mems || &error($text{'groups_emembers'});
16
	push(@groups, { 'name' => 'hostgroup',
17
			'values' => [ $in{"group_$i"}, @mems ] });
18
	}
19

    
20
for($i=0; $i<@ogroups || $i<@groups; $i++) {
21
	&save_directive($conf, $ogroups[$i], $groups[$i]);
22
	}
23
&flush_file_lines();
24

    
25
&redirect("");
26

    
(40-40/46)