Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/security/forefront_ | ||
|---|---|---|
| 3 | 3 |
# Plugin to monitor Forefront Client Security status in MOM database |
| 4 | 4 |
# |
| 5 | 5 |
# Copyright (c) 2008 Rune Nordb?e Skillingstad - <rune.skillingstad@ntnu.no> |
| 6 |
#
|
|
| 6 |
# |
|
| 7 | 7 |
# This program is free software; you can redistribute it and/or modify |
| 8 | 8 |
# it under the terms of the GNU General Public License as published by |
| 9 | 9 |
# the Free Software Foundation; version 2 dated June, 1991. |
| ... | ... | |
| 18 | 18 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 19 | 19 |
# USA. |
| 20 | 20 |
# |
| 21 |
# Parameters:
|
|
| 21 |
# Parameters: |
|
| 22 | 22 |
# |
| 23 | 23 |
# config |
| 24 | 24 |
# autoconf |
| 25 | 25 |
# suggest |
| 26 | 26 |
# |
| 27 | 27 |
# Config variables |
| 28 |
#
|
|
| 28 |
# |
|
| 29 | 29 |
# dsn - If DSN name differs from hostname |
| 30 | 30 |
# dbuser - Valid MS SQL user (Windows authentication is possible using "DOMAIN\user") |
| 31 |
# dbpass - Password
|
|
| 31 |
# dbpass - Password |
|
| 32 | 32 |
# |
| 33 | 33 |
# Install guide: |
| 34 | 34 |
# This plugin relies on correct configured ODBC for the MOM database |
| ... | ... | |
| 36 | 36 |
# * Install and configure FreeTDS and DBD::Sybase (packages tdsodbc and libdbd-sybase-perl on Ubuntu) |
| 37 | 37 |
# - DBD::Sybase is preferred over ODBC because of strange TEXT field handling in DBD::ODBC |
| 38 | 38 |
# |
| 39 |
# Example
|
|
| 39 |
# Example |
|
| 40 | 40 |
# /etc/freetds/freetds.conf: |
| 41 | 41 |
# [MyHost] |
| 42 | 42 |
# host = MyHost.domain.tld |
| 43 | 43 |
# port = 1433 |
| 44 | 44 |
# tds version = 7.0 |
| 45 |
#
|
|
| 45 |
# |
|
| 46 | 46 |
# Copy this script to /usr/share/munin/plugins and run "munin-node-configure --shell" |
| 47 | 47 |
# If freetds.conf has one or more lines containing "host = <server>", the output will be something like this: |
| 48 | 48 |
# ln -s /usr/share/munin/plugins/forefront_ /etc/munin/plugins/forefront_MyHost.Domain.tld_computers |
| 49 | 49 |
# ln -s /usr/share/munin/plugins/forefront_ /etc/munin/plugins/forefront_MyHost.domain.tld_deployments |
| 50 | 50 |
# ln -s /usr/share/munin/plugins/forefront_ /etc/munin/plugins/forefront_MyHost.domain.tld_status |
| 51 | 51 |
# |
| 52 |
# To manually add, symlink forefront_ to forefront_MyHost.domain.tld_computers,
|
|
| 53 |
# forefront_MyHost.domain.tld_deployments and forefront_MyHost.domain.tld_status
|
|
| 52 |
# To manually add, symlink forefront_ to forefront_MyHost.domain.tld_computers, |
|
| 53 |
# forefront_MyHost.domain.tld_deployments and forefront_MyHost.domain.tld_status |
|
| 54 | 54 |
# |
| 55 | 55 |
# Add your DSN and user/password to /etc/munin/plugin-conf.d/munin-node: |
| 56 | 56 |
# [forefront_MyHost.domain.tld_*] |
| 57 | 57 |
# env.dsn MyHost |
| 58 | 58 |
# env.dbuser <user> |
| 59 | 59 |
# env.dbpass <password> |
| 60 |
#
|
|
| 60 |
# |
|
| 61 | 61 |
# On your munin server, add this to /etc/munin/munin.conf |
| 62 | 62 |
# |
| 63 | 63 |
# [MyHost.domain.tld] |
| ... | ... | |
| 211 | 211 |
my %profiles = &deployments_general(); |
| 212 | 212 |
foreach my $policy (sort(keys(%profiles))) {
|
| 213 | 213 |
my $field = encode_base64($policy); |
| 214 |
chomp($field);
|
|
| 214 |
chomp($field); |
|
| 215 | 215 |
print $field . ".label " . $profiles{$policy}{'name'} . "\n";
|
| 216 | 216 |
print $field . ".draw LINE2\n"; |
| 217 | 217 |
print $field . ".info Numer of computers having the " .$profiles{$policy}{'name'} . " profile.\n";
|
| ... | ... | |
| 268 | 268 |
while(my @row = $sth->fetchrow_array) {
|
| 269 | 269 |
$alerts{$row[0]} = 0;
|
| 270 | 270 |
} |
| 271 |
$sth = $dbh->prepare("SELECT al.Level, COUNT(a.AlertLevel) FROM Alert a, AlertLevel al WHERE a.AlertLevel = al.Level AND a.ResolutionState <> 255 GROUP BY al.Level",
|
|
| 271 |
$sth = $dbh->prepare("SELECT al.Level, COUNT(a.AlertLevel) FROM Alert a, AlertLevel al WHERE a.AlertLevel = al.Level AND a.ResolutionState <> 255 GROUP BY al.Level",
|
|
| 272 | 272 |
{odbc_exec_direct => 1});
|
| 273 | 273 |
$sth->execute(); |
| 274 | 274 |
while(my @row = $sth->fetchrow_array) {
|
| ... | ... | |
| 300 | 300 |
$profiles{'d3b75be9-7125-4db1-8b24-93004bd9d88e'}{'instance'} = "";
|
| 301 | 301 |
$profiles{'d3b75be9-7125-4db1-8b24-93004bd9d88e'}{'count'} = 0;
|
| 302 | 302 |
my $dbh = DBI->connect("DBI:Sybase:$dsn", $dbuser, $dbpass, { PrintError => 1, AutoCommit => 1});
|
| 303 |
|
|
| 303 |
|
|
| 304 | 304 |
my $sth = $dbh->prepare("SELECT Id, Name, LatestInstanceID From fcs_Profiles", {odbc_exec_direct => 1});
|
| 305 | 305 |
$sth->execute(); |
| 306 | 306 |
while(my @row = $sth->fetchrow_array) {
|
Formats disponibles : Unified diff