From df66e4ecb6308a85a1719688ac4fb85dd3535304 Mon Sep 17 00:00:00 2001
From: slerena <slerena@gmail.com>
Date: Fri, 22 Feb 2013 18:06:57 +0000
Subject: [PATCH] 2013-02-22  Sancho Lerena <slerena@artica.es>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

        * Darwrin: Added Darwin (MacOS) agent on directory, i don't
        know why was removed from trunk ¿?




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7709 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_agents/unix/ChangeLog                 |   5 +
 .../Darwin/com.pandorafms.pandorafms.plist    |  19 ++
 pandora_agents/unix/Darwin/pandora_agent.conf | 226 ++++++++++++++++++
 3 files changed, 250 insertions(+)
 create mode 100644 pandora_agents/unix/Darwin/com.pandorafms.pandorafms.plist
 create mode 100644 pandora_agents/unix/Darwin/pandora_agent.conf

diff --git a/pandora_agents/unix/ChangeLog b/pandora_agents/unix/ChangeLog
index 5fb349414d..115ea1058a 100644
--- a/pandora_agents/unix/ChangeLog
+++ b/pandora_agents/unix/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-22  Sancho Lerena <slerena@artica.es>
+
+	* Darwrin: Added Darwin (MacOS) agent on directory, i don't
+	know why was removed from trunk ¿?
+
 2013-02-19  Koichiro Kikuchi <koichiro@rworks.jp>
 
 	* pandora_agent_installer: Removed duplicated chown line.
diff --git a/pandora_agents/unix/Darwin/com.pandorafms.pandorafms.plist b/pandora_agents/unix/Darwin/com.pandorafms.pandorafms.plist
new file mode 100644
index 0000000000..0a3f6fc98c
--- /dev/null
+++ b/pandora_agents/unix/Darwin/com.pandorafms.pandorafms.plist
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+        <key>Label</key>
+        <string>com.pandorafms.pandorafms</string>
+        <key>ProgramArguments</key>
+        <array>
+                <string>/usr/bin/pandora_agent</string>
+                <string>/etc/pandora</string>
+        </array>
+        <key>RunAtLoad</key>
+        <true/>
+        <key>ServiceDescription</key>
+        <string>PandoraFMS agent</string>
+        <key>UserName</key>
+        <string>root</string>
+</dict>
+</plist>
diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf
new file mode 100644
index 0000000000..7a50a835ff
--- /dev/null
+++ b/pandora_agents/unix/Darwin/pandora_agent.conf
@@ -0,0 +1,226 @@
+# Base config file for Pandora FMS agents
+# Version 4.0.3, GNU/Linux
+# Licensed under GPL license v2,
+# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
+# http://www.pandorafms.com
+
+# General Parameters
+# ==================
+
+server_ip 	localhost
+server_path 	/var/spool/pandora/data_in
+temporal /tmp
+logfile /var/log/pandora/pandora_agent.log
+#include /etc/pandora/pandora_agent_alt.conf
+#broker_agent name_agent
+
+# Interval in seconds, 300 by default
+interval    	300
+
+# Debug mode only generate XML, and stop after first execution, 
+# and does not copy XML to server.
+debug 		0	
+
+# Optional. UDP Server to receive orders from outside
+# By default is disabled, set 1 to enable
+# Set port (41122 by default) 
+# Set address to restrict who can order a agent restart (0.0.0.0 = anybody)
+#
+udp_server 0
+udp_server_port 41122
+udp_server_auth_address 0.0.0.0
+
+# By default, agent takes machine name
+#agent_name     adama
+
+#Parent agent_name
+#parent_agent_name caprica
+
+# Agent description
+#description This is a demo agent for Mac OS X.
+
+# Group assigned for this agent (descriptive, p.e: Servers)
+#group Servers
+
+# address: Enforce to server a ip address to this agent 
+# You can also try to detect the first IP using "auto", for example
+#address auto
+# or setting a fixed IP address, like for example:
+#address 192.168.36.73
+
+# Autotime: Enforce to server to ignore timestamp coming from this
+# agent, used when agents has no timer or it's inestable. 1 to enable
+# this feature
+#autotime 1
+
+# Timezone offset: Difference with the server timezone
+#timezone_offset 0
+
+# Agent position paramters
+# Those parameters define the geographical position of the agent 
+
+# gis_exec: Call a script that returns a string with a fixed
+# format of latitude,longitude,altitude
+# i.e.: 41.377,-5.105,2.365
+
+#gis_exec /tmp/gis.sh
+
+# This sets the GIS coordinates as fixed values:
+# latitude 
+#latitude 0
+# longitude
+#longitude 0
+# altitude
+#altitude 0
+
+#GPS Position description
+#position_description Madrid, centro
+
+# By default agent try to take default encoding defined in host.
+#encoding 	UTF-8
+
+# Listening TCP port for remote server. By default is 41121 (for tentacle)
+# if you want to use SSH use 22, and FTP uses 21.
+server_port	41121
+
+# Transfer mode: tentacle, ftp, ssh or local 
+transfer_mode tentacle
+
+# Server password (Tentacle or FTP). Leave empty for no password (default).
+#server_pwd mypassword
+
+# Set to yes/no to enable/disable OpenSSL support for Tentacle (disabled by default).
+#server_ssl no
+
+# Extra options for the Tentacle client (for example, server_opts "-v -r 5").
+#server_opts
+
+# delayed_startup defines number of seconds before start execution
+# for first time when startup Pandora FMS Agent
+#delayed_startup 10
+
+# Pandora nice defines priority of execution. Less priority means more intensive execution
+# A recommended value is 10. 0 priority means no Pandora CPU protection enabled (default)
+#pandora_nice 0
+
+# Cron mode replace Pandora FMS own task schedule each XX interval seconds by the use
+# of old style cron. You should add to crontab Pandora FMS agent script to use this mode.
+# This is disabled by default, and is not recommended.  Use Pandora FMS internal scheduler
+# is much more safe
+#cron_mode 
+
+# If set to 1 allows the agent to be configured via the web console (Only Enterprise version) 
+#remote_config 1
+
+# If set to 1 start Drone Agent's Proxy Mode 
+# proxy_mode 1
+
+# Max number of simmultaneus connection for proxy (by default 10)
+# proxy_max_connection 10
+
+# Proxy timeout (by default 1s)
+# proxy_timeout 1
+
+# Number of threads to execute modules in parallel
+#agent_threads 1
+
+# User the agent will run as
+#pandora_user root
+
+# Enable or disable XML buffer.
+# If you are in a secured environment and want to enable the XML buffer you
+# should consider changing the temporal directory, since /tmp is world writable.
+#xml_buffer 0
+
+# Minimum available bytes in the temporal directory to enable the XML buffer
+#temporal_min_size 1024
+
+# Secondary server configuration
+# ==============================
+
+# If secondary_mode is set to on_error, data files are copied to the secondary
+# server only if the primary server fails. If set to always, data files are
+# always copied to the secondary server.
+#secondary_mode on_error
+#secondary_server_ip localhost
+#secondary_server_path /var/spool/pandora/data_in
+#secondary_server_port 41121
+#secondary_transfer_mode tentacle
+#secondary_server_pwd mypassword
+#secondary_server_ssl no
+#secondary_server_opts
+
+# Module Definition
+# =================
+
+# System information
+
+# vmstat syntax depends on linux distro and vmstat command version, please check before use it
+module_begin 
+module_name cpu_user
+module_type generic_data
+module_interval 1
+module_exec sar 1 2 | tail -1 | awk '{ print $2 }'
+module_max 100
+module_min 0
+module_description User CPU Usage (%)
+module_min_warning 70
+module_max_warning 90
+module_min_critical 91
+module_max_critical 100
+module_end
+
+#Get load average
+module_begin 
+module_name Load Average
+module_type generic_data
+module_exec uptime | sed 's/.*load averages: //'|awk '{print $1}'
+module_description Average process in CPU (Last minute) 
+module_end
+
+#Get free memory in MB
+module_begin
+module_name Cache mem free
+module_type generic_data
+module_exec vm_stat | grep 'Pages free'| awk '{print $3/256}'
+module_description Free cache memory in MB
+module_min_warning 500
+module_max_warning 600
+module_min_critical 100
+module_max_critical 499
+module_end
+
+#Count total number of processes
+module_begin
+module_name proctotal
+module_type generic_data
+module_exec ps -A | tail -n +2 | wc -l | sed 's/ //g'
+module_description Total processes
+module_min_warning 150
+module_max_warning 249
+module_min_critical 250
+module_max_critical 300
+module_end
+
+# Async data example
+ 
+module_begin
+module_name LastLogin
+module_type async_string
+module_exec last | head -1 | awk '{print $1}'
+module_description Monitor last user loggin
+module_end 
+
+# Get disk space free in %
+module_begin 
+module_name disk_root_free
+module_type generic_data
+module_exec df -kh / | tail -1 | awk '{ print 100-$5 }'
+module_max 100
+module_min 0
+module_description Free disk Percentage of root partition
+module_min_warning 70
+module_max_warning 90
+module_min_critical 91
+module_max_critical 100
+module_end