Puppet Class: puppi::extras

Defined in:
manifests/extras.pp

Overview

Class puppi::extras

Default extras class with predefined puppi check, log , info content. You can provide a custom extra class to use instead of this with a parameter like:

extra_class=> 'example42::puppi::extras',


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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'manifests/extras.pp', line 9

class puppi::extras {

  # Default Checks

  puppi::check { 'NTP_Sync':
    command  => "check_ntp -H ${puppi::params::ntp}" ,
    priority => '99' ,
    hostwide => 'yes' ,
  }

  puppi::check { 'Disks_Usage':
    command  => 'check_disk -w 20% -c 10% -L -X tmpfs' ,
    priority => '10' ,
    hostwide => 'yes' ,
  }

  puppi::check { 'System_Load':
    command  => 'check_load -w 15,10,5 -c 30,25,20' ,
    priority => '10' ,
    hostwide => 'yes' ,
  }

  puppi::check { 'Zombie_Processes':
    command  => 'check_procs -w 5 -c 10 -s Z' ,
    priority => '10' ,
    hostwide => 'yes' ,
  }

  puppi::check { 'Local_Mail_Queue':
    command  => 'check_mailq -w 2 -c 5' ,
    priority => '10' ,
    hostwide => 'yes' ,
  }

  puppi::check { 'Connected_Users':
    command  => 'check_users -w 5 -c 10' ,
    priority => '10' ,
    hostwide => 'yes' ,
  }

  puppi::check { 'DNS_Resolution':
    command  => 'check_dns -H example.com' ,
    priority => '15' ,
    hostwide => 'yes' ,
  }


  # Info Pages
  $network_run = $::operatingsystem ? {
    'Solaris' => [ 'ifconfig -a' , 'netstat -nr' , 'cat /etc/resolv.conf' , 'arp -an' , 'netstat -na' ],
    default   => [ 'ifconfig' , 'route -n' , 'cat /etc/resolv.conf' , 'arp -an' , 'netstat -natup | grep LISTEN' ],
  }

  puppi::info { 'network':
    description => 'Network settings and stats' ,
    run         => $network_run,
  }

  $users_run = $::operatingsystem ? {
    'Solaris' => [ 'who' , 'last' ],
    default   => [ 'who' , 'last' , 'LANG=C lastlog | grep -v \'Never logged in\'' ],
  }

  puppi::info { 'users':
    description => 'Users and logins information' ,
    run         => $users_run,
  }

  $perf_run = $::operatingsystem ? {
    'Solaris' => [ 'uptime' , 'vmstat 1 5' ],
    default   => [ 'uptime' , 'free' , 'vmstat 1 5' ],
  }

  puppi::info { 'perf':
    description => 'System performances and resources utilization' ,
    run         => $perf_run,
  }

  $disks_run = $::operatingsystem ? {
    'Solaris' => [ 'df -h' , 'mount' ],
    default   => [ 'df -h' , 'mount' , 'blkid' , 'fdisk -l' ],
  }

  puppi::info { 'disks':
    description => 'Disks and filesystem information' ,
    run         => $disks_run,
  }

  $hardware_run = $::operatingsystem ? {
    'Solaris' => [ 'find /devices/' ],
    default   => [ 'lspci' , 'cat /proc/cpuinfo' ],
  }

  puppi::info { 'hardware':
    description => 'Hardware information' ,
    run         => $hardware_run,
  }

  $packages_run = $::operatingsystem ? {
    /(?i:RedHat|CentOS|Scientific|Amazon|Linux)/ => [ 'yum repolist' , 'rpm -qa' ] ,
    /(?i:Debian|Ubuntu|Mint)/                    => [ 'apt-config dump' , 'apt-cache stats' , 'apt-key list' , 'dpkg -l' ],
    /(Solaris)/                                  => [ 'pkginfo' ],
    /(Archlinux)/                                => [ 'pacman -Qet' ],
    default                                      => [ 'echo' ],
  }

  puppi::info { 'packages':
    description => 'Packages information' ,
    run         => $packages_run,
  }

  puppi::info::module { 'puppi':
    configfile  => ["${puppi::params::basedir}/puppi.conf"],
    configdir   => [$puppi::params::basedir],
    datadir     => [$puppi::params::archivedir],
    logdir      => [$puppi::params::logdir],
    description => 'What Puppet knows about puppi' ,
    verbose     => 'yes',
#   run         => "ls -lR ${puppi::params::logdir}/puppi-data/",
  }

  ### Default Logs
  case $::osfamily {

    'Debian': {
      puppi::log { 'system':
        description => 'General System Messages',
        log         => ['/var/log/syslog'],
      }
      puppi::log { 'auth':
        description => 'Users and authentication',
        log         => ['/var/log/user.log','/var/log/auth.log'],
      }
      puppi::log { 'mail':
        description => 'Mail messages',
        log         => ['/var/log/mail.log'],
      }
    }

    'RedHat': {
      puppi::log { 'system':
        description => 'General System Messages',
        log         => ['/var/log/messages'],
      }
      puppi::log { 'auth':
        description => 'Users and authentication',
        log         => ['/var/log/secure'],
      }
      puppi::log { 'mail':
        description => 'Mail messages',
        log         => ['/var/log/maillog'],
      }
    }

    'SLES': {
      puppi::log { 'system':
        description => 'General System Messages',
        log         => ['/var/log/messages'],
      }
      puppi::log { 'mail':
        description => 'Mail messages',
        log         => ['/var/log/mail'],
      }
      puppi::log { 'zypper':
        description => 'Zypper messages',
        log         => ['/var/log/zypper.log'],
      }
    }

    'Solaris': {
      puppi::log { 'system':
        description => 'General System Messages',
        log         => ['/var/adm/messages'],
      }
      puppi::log { 'auth':
        description => 'Users and authentication',
        log         => ['/var/log/authlog'],
      }
    }

    'Archlinux': {
      puppi::log { 'system':
        description => 'General System Messages',
        log         => ['/var/log/messages.log','/var/log/syslog.log'],
      }
      puppi::log { 'auth':
        description => 'Users and authentication',
        log         => ['/var/log/user.log','/var/log/auth.log'],
      }
      puppi::log { 'mail':
        description => 'Mail messages',
        log         => ['/var/log/mail.log'],
      }
    }

    default: { }

  }

}