phpservermon/puphpet/puppet/modules/puppi/templates/info/instance.erb

90 lines
2.6 KiB
Plaintext

#!/bin/bash
# <%= @description %>
# Script generated by Puppet. It's executed when you run:
# puppi info <%= @name %>
#
# Sources common header for Puppi scripts
. <%= scope.lookupvar('puppi::params::scriptsdir') %>/header || exit 10
<% if @configdir != "" -%>
# Show config info
echo_title "$HOSTNAME - <%= @name %>: Configurations directory: <%= @configdir %>"
show_command "ls -latr <%= @configdir %>"
<% end -%>
<% if @datadir != "" -%>
# Show data dir
echo_title "$HOSTNAME - <%= @name %>: Application data are in: <% datadir.each do |item| %><%= item %><% end %>"
<% @datadir.each do |item| -%>
show_command "ls -latr <%= item %>"
<% end -%>
<% end -%>
<% if @bindir != "" -%>
# Show bin dir
echo_title "$HOSTNAME - <%= @name %>: Startup scripts are in: <% bindir.each do |item| %><%= item %><% end %>"
<% @bindir.each do |item| -%>
show_command "ls -latr <%= item %>"
<% end -%>
<% end -%>
<% if @logdir != "" -%>
# Show log dir
echo_title "$HOSTNAME - <%= @name %>: Logs are in: <% logdir.each do |item| %><%= item %><% end %>"
<% @logdir.each do |item| -%>
show_command "ls -latr <%= item %>"
show_command "tail -30 <%= item %>/catalina.out"
<% end -%>
<% end -%>
<% if @run != "" -%>
echo_title "$HOSTNAME - <%= @name %>: Extra info"
<% @run.each do |cmd| %>show_command "<%= cmd %>"
<% end -%>
<% end -%>
<% if @servicename != "" -%>
# Show service info
echo_title "$HOSTNAME - <%= @name %>: Services: <% @servicename.each do |item| %><%= item %><% end %>"
<% @servicename.each do |item| -%>
show_command "/etc/init.d/<%= item %> status"
<% end -%>
<% if @verbose == "yes" -%>
show_command "ps -adef | grep java | grep <%= @processname %>"
<% else -%>
show_command "ps -adef | grep java | grep <%= @processname %> | head -20"
<% end -%>
<% end -%>
<% if @httpport != "" -%>
# Show port info
echo_title "$HOSTNAME - <%= @name %>: httpport - <%= @httpport %>"
<% if @verbose == "yes" -%>
show_command "netstat -natup | grep ':<%= @httpport %> '"
<% else -%>
show_command "netstat -natup | grep ':<%= @httpport %> ' | head -20"
<% end -%>
<% end -%>
<% if @controlport != "" -%>
# Show port info
echo_title "$HOSTNAME - <%= @name %>: controlport - <%= @controlport %>"
<% if @verbose == "yes" -%>
show_command "netstat -natup | grep ':<%= @controlport %> '"
<% else -%>
show_command "netstat -natup | grep ':<%= @controlport %> ' | head -20"
<% end -%>
<% end -%>
<% if @ajpport != "" -%>
# Show port info
echo_title "$HOSTNAME - <%= @name %>: ajpport - <%= @ajpport %>"
<% if @verbose == "yes" -%>
show_command "netstat -natup | grep ':<%= @ajpport %> '"
<% else -%>
show_command "netstat -natup | grep ':<%= @ajpport %> ' | head -20"
<% end -%>
<% end -%>