-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathuninstall.pl
executable file
·66 lines (55 loc) · 1.56 KB
/
uninstall.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/perl -w
# Configuration
my $binDir = "/usr/bin/erd/";
my $agentConf = "/etc/zabbix/zabbix_agentd.d/erd_nodes.conf";
my $oldbinDir = "/usr/bin/";
my $oldsudoersConf = "/etc/sudoers.d/zabbix";
my $oldagentConf = "/etc/zabbix/zabbix_agentd.d/elrond_nodes.conf";
my @files = (
"ERD/Api.pm",
"ERD/Utils.pm",
"nodes_discovery.pl",
"shards_discovery.pl",
"node_status.pl",
"node_statistics.pl",
"validator_statistics.pl",
"heartbeat_statistics.pl"
);
my @oldfiles = (
"elrond_check.pl",
"elrond_discovery.pl",
"discovery.pl"
);
print("###\n### Uninstalling the Elrond Zabbix Plugin.\n###\n");
print("Removing zabbix scripts:\n");
foreach my $file(@oldfiles){
$filePath = $oldbinDir . $file;
print(" => $filePath\n");
system("rm -f $filePath");
$filePath = $binDir . $file;
print(" => $filePath\n");
system("rm -f $filePath");
}
foreach my $file(@files){
$filePath = $binDir . $file;
print(" => $filePath\n");
system("rm -f $filePath");
}
print("Removing sudoers configuration:\n");
print(" => $oldsudoersConf\n");
system("rm -f $oldsudoersConf");
print("Removing zabbix agent configuration:\n");
print(" => $oldagentConf\n");
system("rm -f $oldagentConf");
print(" => $agentConf\n");
system("rm -f $agentConf");
my $cacheRoot = "/var/run/zabbix/erd_cache";
print("Removing cache:\n");
print(" => $cacheRoot\n");
system("rm -rf $cacheRoot");
if(!$ARGV[0] || $ARGV[0] ne "skip-restart"){
print("Restarting zabbix agent.\n");
system("service zabbix-agent restart");
}
print("### DONE!\n");
exit 0;