1
2######################################################################
3#
4# Zenoss integration template example
5#
6######################################################################
7
8body common control
9{
10      bundlesequence  => { "zenoss_host", "zenoss_client"  };
11      syslog_host     => "zenoss_syslog.example.org";
12      syslog_port     => "514";
13      inputs => { "$(sys.libdir)/stdlib.cf" };
14}
15
16########################################################
17
18bundle agent zenoss_host
19{
20  vars:
21
22      "cf_server_hosts"         string => "cfengine_policy.example.org";
23      "cf_doc_root"             string => "/srv/www/html";
24      "zCfengineComplianceFile" string => "/home/zenoss/compliance.zen";
25
26  files:
27
28      # Assume Cfengine is running on the zenoss server to collect data
29
30    zenoss_syslog_example_org::
31
32      "$(zCfengineComplianceFile)"
33
34      comment => "Collect data from the Cfengine policy server",
35      perms => mo("644","zenoss"),
36      copy_from => secure_cp("$(cf_doc_root)/reports/summary.z","$(cf_server_host)");
37
38}
39
40########################################################
41
42bundle agent zenoss_client
43{
44  processes:
45
46      # On clients, we just pass any messages to the zenoss server
47      # for logging...
48
49      "bad_process"
50
51      comment => "Make sure that process X is not running, tell zenoss if it was",
52      signals => { "term", "kill" },
53      action => tell_zenoss_repaired("bad_process was killed");
54
55  files:
56
57      "/etc/passwd"
58
59      comment => "Check passwd security, tell zenoss if permissions were wrong",
60      perms => mog("644","root","root"),
61      action => tell_zenoss_repaired("passwd file had incorrect permissions");
62
63  commands:
64
65      "/my/important/script -xyz"
66
67      comment => "Run my mission critical batch process",
68      action => tell_zenoss_failed("myscript failed to execute or returned error");
69
70}
71
72#
73# Library stuff
74#
75
76body action tell_zenoss_repaired(x)
77{
78      log_repaired => "udp_syslog";
79      log_string   => "zenoss_cfengine_integration $(x) promise repaired";
80      ifelapsed    => "10"; # Every 10 mins
81}
82
83body action tell_zenoss_failed(x)
84{
85      log_failed => "udp_syslog";
86      log_string  => "zenoss_cfengine_integration $(x) persistent problem";
87      ifelapsed   => "10"; # Every 10 mins
88}
89