« lib/Monitoring/Generator/TestConfig/ShinkenInitScriptData.pm
↑ Summary
script/create_monitoring_test_config.pl »
| 1 | package Monitoring::Generator::TestConfig::Modules::Shinken; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | =head1 NAME | ||||||||||
| 9 | |||||||||||
| 10 | Monitoring::Generator::TestConfig::Modules::Shinken - shinken specificy functions | ||||||||||
| 11 | |||||||||||
| 12 | =head1 METHODS | ||||||||||
| 13 | |||||||||||
| 14 | =over 4 | ||||||||||
| 15 | |||||||||||
| 16 | =item new | ||||||||||
| 17 | |||||||||||
| 18 | returns a shinken module object | ||||||||||
| 19 | |||||||||||
| 20 | =back | ||||||||||
| 21 | |||||||||||
| 22 | =cut | ||||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | ######################################## | ||||||||||
| 26 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 27 | 0 | my($class,%options) = @_; | |||||||||
| 28 | 0 | my $self = {}; | |||||||||
| 29 | 0 | bless $self, $class; | |||||||||
| 30 | 0 | return $self; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | =head1 METHODS | ||||||||||
| 35 | |||||||||||
| 36 | =over 4 | ||||||||||
| 37 | |||||||||||
| 38 | =cut | ||||||||||
| 39 | |||||||||||
| 40 | ######################################## | ||||||||||
| 41 | 0 | ▶ | sub _get_shinken_specific_cfg { | ||||||||
|
Subroutine
_get_shinken_specific_cfg: not called CC=2 SCAR=17.9
| |||||||||||
| 42 | 0 | my $self = shift; | |||||||||
| 43 | |||||||||||
| 44 | 0 | my $max_workers = ($self->{'hostcount'} * $self->{'services_per_host'}) / 256 / 10; # 100000 services -> 39 | |||||||||
| 45 | 0 | ▶ | $max_workers = ($max_workers < 10) ? 10 : abs($max_workers); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 0 | my $cfg = " | |||||||||
| 47 | define scheduler{ | ||||||||||
| 48 | scheduler_name scheduler-All | ||||||||||
| 49 | address localhost | ||||||||||
| 50 | port 7768 | ||||||||||
| 51 | spare 0 | ||||||||||
| 52 | realm All | ||||||||||
| 53 | weight 1 | ||||||||||
| 54 | } | ||||||||||
| 55 | define reactionner{ | ||||||||||
| 56 | reactionner_name reactionner-All | ||||||||||
| 57 | address localhost | ||||||||||
| 58 | port 7769 | ||||||||||
| 59 | spare 0 | ||||||||||
| 60 | realm All | ||||||||||
| 61 | manage_sub_realms 0 | ||||||||||
| 62 | } | ||||||||||
| 63 | define poller{ | ||||||||||
| 64 | poller_name poller-All | ||||||||||
| 65 | address localhost | ||||||||||
| 66 | port 7771 | ||||||||||
| 67 | realm All | ||||||||||
| 68 | manage_sub_realms 0 | ||||||||||
| 69 | min_workers 4 | ||||||||||
| 70 | max_workers $max_workers | ||||||||||
| 71 | processes_by_worker 256 | ||||||||||
| 72 | polling_interval 1 | ||||||||||
| 73 | } | ||||||||||
| 74 | define broker{ | ||||||||||
| 75 | broker_name broker-All | ||||||||||
| 76 | address localhost | ||||||||||
| 77 | port 7772 | ||||||||||
| 78 | spare 0 | ||||||||||
| 79 | realm All | ||||||||||
| 80 | manage_sub_realms 0 | ||||||||||
| 81 | modules Simple-log,Status-Dat,Livestatus | ||||||||||
| 82 | } | ||||||||||
| 83 | define module{ | ||||||||||
| 84 | module_name Simple-log | ||||||||||
| 85 | module_type simple_log | ||||||||||
| 86 | path $self->{'output_dir'}/var/shinken.log | ||||||||||
| 87 | archive_path $self->{'output_dir'}/archives/ | ||||||||||
| 88 | } | ||||||||||
| 89 | define module{ | ||||||||||
| 90 | module_name Status-Dat | ||||||||||
| 91 | module_type status_dat | ||||||||||
| 92 | status_file $self->{'output_dir'}/var/status.dat | ||||||||||
| 93 | object_cache_file $self->{'output_dir'}/var/objects.cache | ||||||||||
| 94 | status_update_interval 15 ; update status.dat every 15s | ||||||||||
| 95 | } | ||||||||||
| 96 | define module{ | ||||||||||
| 97 | module_name Livestatus | ||||||||||
| 98 | module_type livestatus | ||||||||||
| 99 | host * ; * = listen on all configured ip addresses | ||||||||||
| 100 | port 50000 | ||||||||||
| 101 | database_file $self->{'output_dir'}/var/livestatus.db | ||||||||||
| 102 | } | ||||||||||
| 103 | define realm { | ||||||||||
| 104 | realm_name All | ||||||||||
| 105 | default 1 | ||||||||||
| 106 | } | ||||||||||
| 107 | "; | ||||||||||
| 108 | 0 | return($cfg); | |||||||||
| 109 | } | ||||||||||
| 110 | |||||||||||
| 111 | ######################################## | ||||||||||
| 112 | 0 | ▶ | sub _get_shinken_schedulerd_cfg { | ||||||||
|
Subroutine
_get_shinken_schedulerd_cfg: not called CC=1 SCAR=6.9
| |||||||||||
| 113 | 0 | my $self = shift; | |||||||||
| 114 | |||||||||||
| 115 | 0 | my $cfg = "[daemon] | |||||||||
| 116 | workdir=$self->{'output_dir'}/var | ||||||||||
| 117 | pidfile=%(workdir)s/schedulerd.pid | ||||||||||
| 118 | port=7768 | ||||||||||
| 119 | host=0.0.0.0 | ||||||||||
| 120 | user=$self->{'user'} | ||||||||||
| 121 | group=$self->{'group'} | ||||||||||
| 122 | idontcareaboutsecurity=0 | ||||||||||
| 123 | "; | ||||||||||
| 124 | 0 | return($cfg); | |||||||||
| 125 | } | ||||||||||
| 126 | |||||||||||
| 127 | ######################################## | ||||||||||
| 128 | 0 | ▶ | sub _get_shinken_pollerd_cfg { | ||||||||
|
Subroutine
_get_shinken_pollerd_cfg: not called CC=1 SCAR=6.9
| |||||||||||
| 129 | 0 | my $self = shift; | |||||||||
| 130 | |||||||||||
| 131 | 0 | my $cfg = "[daemon] | |||||||||
| 132 | workdir=$self->{'output_dir'}/var | ||||||||||
| 133 | pidfile=%(workdir)s/pollerd.pid | ||||||||||
| 134 | interval_poll=5 | ||||||||||
| 135 | maxfd=1024 | ||||||||||
| 136 | port=7771 | ||||||||||
| 137 | host=0.0.0.0 | ||||||||||
| 138 | user=$self->{'user'} | ||||||||||
| 139 | group=$self->{'group'} | ||||||||||
| 140 | idontcareaboutsecurity=no | ||||||||||
| 141 | "; | ||||||||||
| 142 | 0 | return($cfg); | |||||||||
| 143 | } | ||||||||||
| 144 | |||||||||||
| 145 | ######################################## | ||||||||||
| 146 | 0 | ▶ | sub _get_shinken_brokerd_cfg { | ||||||||
|
Subroutine
_get_shinken_brokerd_cfg: not called CC=1 SCAR=6.9
| |||||||||||
| 147 | 0 | my $self = shift; | |||||||||
| 148 | |||||||||||
| 149 | 0 | ($self->{'shinken_dir'} = $self->{'binary'}) =~ s/\/[^\/]*?\/[^\/]*?$//mxg; | |||||||||
| 150 | 0 | my $cfg = "[daemon] | |||||||||
| 151 | workdir=$self->{'output_dir'}/var | ||||||||||
| 152 | pidfile=%(workdir)s/brokerd.pid | ||||||||||
| 153 | interval_poll=5 | ||||||||||
| 154 | maxfd=1024 | ||||||||||
| 155 | port=7772 | ||||||||||
| 156 | host=0.0.0.0 | ||||||||||
| 157 | user=$self->{'user'} | ||||||||||
| 158 | group=$self->{'group'} | ||||||||||
| 159 | idontcareaboutsecurity=no | ||||||||||
| 160 | modulespath=$self->{'shinken_dir'}/modules | ||||||||||
| 161 | "; | ||||||||||
| 162 | 0 | return($cfg); | |||||||||
| 163 | } | ||||||||||
| 164 | |||||||||||
| 165 | ######################################## | ||||||||||
| 166 | 0 | ▶ | sub _get_shinken_reactionnerd_cfg { | ||||||||
|
Subroutine
_get_shinken_reactionnerd_cfg: not called CC=1 SCAR=6.9
| |||||||||||
| 167 | 0 | my $self = shift; | |||||||||
| 168 | |||||||||||
| 169 | 0 | my $cfg = "[daemon] | |||||||||
| 170 | workdir=$self->{'output_dir'}/var | ||||||||||
| 171 | pidfile=%(workdir)s/reactionnerd.pid | ||||||||||
| 172 | interval_poll=5 | ||||||||||
| 173 | maxfd=1024 | ||||||||||
| 174 | port=7769 | ||||||||||
| 175 | host=0.0.0.0 | ||||||||||
| 176 | user=$self->{'user'} | ||||||||||
| 177 | group=$self->{'group'} | ||||||||||
| 178 | idontcareaboutsecurity=no | ||||||||||
| 179 | "; | ||||||||||
| 180 | 0 | return($cfg); | |||||||||
| 181 | } | ||||||||||
| 182 | |||||||||||
| 183 | ######################################## | ||||||||||
| 184 | 0 | ▶ | sub _get_shinken_initscript { | ||||||||
|
Subroutine
_get_shinken_initscript: not called CC=1 SCAR=6.9
| |||||||||||
| 185 | 0 | my $self = shift; | |||||||||
| 186 | 0 | return ""; | |||||||||
| 187 | } | ||||||||||
| 188 | |||||||||||
| 189 | 3 | 1; | |||||||||
| 190 | |||||||||||
| 191 | __END__ | ||||||||||