line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Ym; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
6
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
24
|
use Ym; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
157
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# List of configs that will be generated by Ym. |
11
|
|
|
|
|
|
|
# In ordinary usage there is no need to change it. |
12
|
|
|
|
|
|
|
our @NAGIOS_CONFIGS = qw/ |
13
|
|
|
|
|
|
|
nagios.cfg commands.cfg |
14
|
|
|
|
|
|
|
contact-templates.cfg contactgroups.cfg contacts.cfg |
15
|
|
|
|
|
|
|
host-templates.cfg hostgroups.cfg |
16
|
|
|
|
|
|
|
services.cfg service-templates.cfg |
17
|
|
|
|
|
|
|
timeperiods.cfg |
18
|
|
|
|
|
|
|
service-dependencies.cfg host-dependencies.cfg |
19
|
|
|
|
|
|
|
/; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Describes structure where Ym stores parsed configs. |
22
|
|
|
|
|
|
|
# Key - is a main value. If you 'use Ym;' in your programms |
23
|
|
|
|
|
|
|
# you can access Ym config tree using these keys. See ymcmd.pl. |
24
|
|
|
|
|
|
|
# First array element is an object name which is used when |
25
|
|
|
|
|
|
|
# generating object definitions like 'define |
26
|
|
|
|
|
|
|
# Second array element tells where to place object definition. |
27
|
|
|
|
|
|
|
# This memo is for information only. |
28
|
|
|
|
|
|
|
# Do not change this data structure uless you have a good reason for that. |
29
|
|
|
|
|
|
|
our %BRANCHES = ( |
30
|
|
|
|
|
|
|
'commands' => ['command', 'commands.cfg'], |
31
|
|
|
|
|
|
|
'contact_templates' => ['contact', 'contact-templates.cfg'], |
32
|
|
|
|
|
|
|
'contactgroups' => ['contactgroup', 'contactgroups.cfg'], |
33
|
|
|
|
|
|
|
'contacts' => ['contact', 'contacts.cfg'], |
34
|
|
|
|
|
|
|
'host_templates' => ['host', 'host-templates.cfg'], |
35
|
|
|
|
|
|
|
'hostgroups' => ['hostgroup', 'hostgroups.cfg'], |
36
|
|
|
|
|
|
|
'hosts' => ['host', 'services.cfg'], |
37
|
|
|
|
|
|
|
'service_templates' => ['service', 'service-templates.cfg'], |
38
|
|
|
|
|
|
|
'timeperiods' => ['timeperiod', 'timeperiods.cfg'], |
39
|
|
|
|
|
|
|
'service_dependencies' => ['servicedependency', 'service-dependencies.cfg'], |
40
|
|
|
|
|
|
|
'host_dependencies' => ['hostdependency', 'host-dependencies.cfg'], |
41
|
|
|
|
|
|
|
'services' => ['service',], |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|