28
|
1 |
# Class puppi::extras |
|
2 |
# |
|
3 |
# Default extras class with predefined puppi |
|
4 |
# check, log , info content. |
|
5 |
# You can provide a custom extra class to use instead of this |
|
6 |
# with a parameter like: |
|
7 |
# extra_class=> 'example42::puppi::extras', |
|
8 |
# |
|
9 |
class puppi::extras { |
|
10 |
|
|
11 |
# Default Checks |
|
12 |
|
|
13 |
puppi::check { 'NTP_Sync': |
|
14 |
command => "check_ntp -H ${puppi::params::ntp}" , |
|
15 |
priority => '99' , |
|
16 |
hostwide => 'yes' , |
|
17 |
} |
|
18 |
|
|
19 |
puppi::check { 'Disks_Usage': |
|
20 |
command => 'check_disk -w 20% -c 10% -L -X tmpfs' , |
|
21 |
priority => '10' , |
|
22 |
hostwide => 'yes' , |
|
23 |
} |
|
24 |
|
|
25 |
puppi::check { 'System_Load': |
|
26 |
command => 'check_load -w 15,10,5 -c 30,25,20' , |
|
27 |
priority => '10' , |
|
28 |
hostwide => 'yes' , |
|
29 |
} |
|
30 |
|
|
31 |
puppi::check { 'Zombie_Processes': |
|
32 |
command => 'check_procs -w 5 -c 10 -s Z' , |
|
33 |
priority => '10' , |
|
34 |
hostwide => 'yes' , |
|
35 |
} |
|
36 |
|
|
37 |
puppi::check { 'Local_Mail_Queue': |
|
38 |
command => 'check_mailq -w 2 -c 5' , |
|
39 |
priority => '10' , |
|
40 |
hostwide => 'yes' , |
|
41 |
} |
|
42 |
|
|
43 |
puppi::check { 'Connected_Users': |
|
44 |
command => 'check_users -w 5 -c 10' , |
|
45 |
priority => '10' , |
|
46 |
hostwide => 'yes' , |
|
47 |
} |
|
48 |
|
|
49 |
puppi::check { 'DNS_Resolution': |
|
50 |
command => 'check_dns -H example.com' , |
|
51 |
priority => '15' , |
|
52 |
hostwide => 'yes' , |
|
53 |
} |
|
54 |
|
|
55 |
|
|
56 |
# Info Pages |
|
57 |
$network_run = $::operatingsystem ? { |
|
58 |
Solaris => [ 'ifconfig -a' , 'netstat -nr' , 'cat /etc/resolv.conf' , 'arp -an' , 'netstat -na' ], |
|
59 |
default => [ 'ifconfig' , 'route -n' , 'cat /etc/resolv.conf' , 'arp -an' , 'netstat -natup | grep LISTEN' ], |
|
60 |
} |
|
61 |
|
|
62 |
puppi::info { 'network': |
|
63 |
description => 'Network settings and stats' , |
|
64 |
run => $network_run, |
|
65 |
} |
|
66 |
|
|
67 |
$users_run = $::operatingsystem ? { |
|
68 |
Solaris => [ 'who' , 'last' ], |
|
69 |
default => [ 'who' , 'last' , 'LANG=C lastlog | grep -v \'Never logged in\'' ], |
|
70 |
} |
|
71 |
|
|
72 |
puppi::info { 'users': |
|
73 |
description => 'Users and logins information' , |
|
74 |
run => $users_run, |
|
75 |
} |
|
76 |
|
|
77 |
$perf_run = $::operatingsystem ? { |
|
78 |
Solaris => [ 'uptime' , 'vmstat 1 5' ], |
|
79 |
default => [ 'uptime' , 'free' , 'vmstat 1 5' ], |
|
80 |
} |
|
81 |
|
|
82 |
puppi::info { 'perf': |
|
83 |
description => 'System performances and resources utilization' , |
|
84 |
run => $perf_run, |
|
85 |
} |
|
86 |
|
|
87 |
$disks_run = $::operatingsystem ? { |
|
88 |
Solaris => [ 'df -h' , 'mount' ], |
|
89 |
default => [ 'df -h' , 'mount' , 'blkid' , 'fdisk -l' ], |
|
90 |
} |
|
91 |
|
|
92 |
puppi::info { 'disks': |
|
93 |
description => 'Disks and filesystem information' , |
|
94 |
run => $disks_run, |
|
95 |
} |
|
96 |
|
|
97 |
$hardware_run = $::operatingsystem ? { |
|
98 |
Solaris => [ 'find /devices/' ], |
|
99 |
default => [ 'lspci' , 'cat /proc/cpuinfo' ], |
|
100 |
} |
|
101 |
|
|
102 |
puppi::info { 'hardware': |
|
103 |
description => 'Hardware information' , |
|
104 |
run => $hardware_run, |
|
105 |
} |
|
106 |
|
|
107 |
$packages_run = $::operatingsystem ? { |
|
108 |
/(?i:RedHat|CentOS|Scientific|Amazon|Linux)/ => [ 'yum repolist' , 'rpm -qa' ] , |
|
109 |
/(?i:Debian|Ubuntu|Mint)/ => [ 'apt-config dump' , 'apt-cache stats' , 'apt-key list' , 'dpkg -l' ], |
|
110 |
/(Solaris)/ => [ 'pkginfo' ], |
|
111 |
/(Archlinux)/ => [ 'pacman -Qet' ], |
|
112 |
default => [ 'echo' ], |
|
113 |
} |
|
114 |
|
|
115 |
puppi::info { 'packages': |
|
116 |
description => 'Packages information' , |
|
117 |
run => $packages_run, |
|
118 |
} |
|
119 |
|
|
120 |
puppi::info::module { 'puppi': |
|
121 |
configfile => ["${puppi::params::basedir}/puppi.conf"], |
|
122 |
configdir => [$puppi::params::basedir], |
|
123 |
datadir => [$puppi::params::archivedir], |
|
124 |
logdir => [$puppi::params::logdir], |
|
125 |
description => 'What Puppet knows about puppi' , |
|
126 |
verbose => 'yes', |
|
127 |
# run => "ls -lR ${puppi::params::logdir}/puppi-data/", |
|
128 |
} |
|
129 |
|
|
130 |
### Default Logs |
|
131 |
case $::operatingsystem { |
|
132 |
|
|
133 |
Debian,Ubuntu: { |
|
134 |
puppi::log { 'system': |
|
135 |
description => 'General System Messages', |
|
136 |
log => ['/var/log/syslog'], |
|
137 |
} |
|
138 |
puppi::log { 'auth': |
|
139 |
description => 'Users and authentication', |
|
140 |
log => ['/var/log/user.log','/var/log/auth.log'], |
|
141 |
} |
|
142 |
puppi::log { 'mail': |
|
143 |
description => 'Mail messages', |
|
144 |
log => ['/var/log/mail.log'], |
|
145 |
} |
|
146 |
} |
|
147 |
|
|
148 |
RedHat,CentOS,Scientific,Amazon,Linux: { |
|
149 |
puppi::log { 'system': |
|
150 |
description => 'General System Messages', |
|
151 |
log => ['/var/log/messages'], |
|
152 |
} |
|
153 |
puppi::log { 'auth': |
|
154 |
description => 'Users and authentication', |
|
155 |
log => ['/var/log/secure'], |
|
156 |
} |
|
157 |
puppi::log { 'mail': |
|
158 |
description => 'Mail messages', |
|
159 |
log => ['/var/log/maillog'], |
|
160 |
} |
|
161 |
} |
|
162 |
|
|
163 |
SLES,OpenSuSE: { |
|
164 |
puppi::log { 'system': |
|
165 |
description => 'General System Messages', |
|
166 |
log => ['/var/log/messages'], |
|
167 |
} |
|
168 |
puppi::log { 'mail': |
|
169 |
description => 'Mail messages', |
|
170 |
log => ['/var/log/mail'], |
|
171 |
} |
|
172 |
puppi::log { 'zypper': |
|
173 |
description => 'Zypper messages', |
|
174 |
log => ['/var/log/zypper.log'], |
|
175 |
} |
|
176 |
} |
|
177 |
|
|
178 |
Solaris: { |
|
179 |
puppi::log { 'system': |
|
180 |
description => 'General System Messages', |
|
181 |
log => ['/var/adm/messages'], |
|
182 |
} |
|
183 |
puppi::log { 'auth': |
|
184 |
description => 'Users and authentication', |
|
185 |
log => ['/var/log/authlog'], |
|
186 |
} |
|
187 |
} |
|
188 |
|
|
189 |
Archlinux: { |
|
190 |
puppi::log { 'system': |
|
191 |
description => 'General System Messages', |
|
192 |
log => ['/var/log/messages.log','/var/log/syslog.log'], |
|
193 |
} |
|
194 |
puppi::log { 'auth': |
|
195 |
description => 'Users and authentication', |
|
196 |
log => ['/var/log/user.log','/var/log/auth.log'], |
|
197 |
} |
|
198 |
puppi::log { 'mail': |
|
199 |
description => 'Mail messages', |
|
200 |
log => ['/var/log/mail.log'], |
|
201 |
} |
|
202 |
} |
|
203 |
|
|
204 |
default: { } |
|
205 |
|
|
206 |
} |
|
207 |
|
|
208 |
} |