diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index 0fbce4900c..c7990ffcbc 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -154,6 +154,11 @@ temporal_min_size 1024 # Agent mode: Learn (default), No-learn, Autodisable # agent_mode autodisable +# eHorus agent configuration file path: +# The agent will create a custom field named eHorusID that contains +# the eHorus agent's identifying key +ehorus_conf /etc/ehorus/ehorus_agent.conf + # Secondary server configuration # ============================== @@ -175,8 +180,8 @@ temporal_min_size 1024 # System information -# vmstat syntax depends on linux distro and vmstat command version, please check before use it -module_begin +# Could change depending on linux distro and vmstat command version +module_begin module_name CPU Load module_type generic_data module_interval 1 @@ -189,9 +194,10 @@ module_max_warning 90 module_min_critical 91 module_max_critical 100 module_unit % +module_group System module_end -# vmstat syntax depends on linux distro and vmstat command version, please check before use it +# Could change depending on linux distro and vmstat command version module_begin module_name CPU IOWait module_type generic_data @@ -200,72 +206,65 @@ module_exec vmstat 1 2 | tail -1 | awk '{ print $16 }' module_min_warning 10 module_min_critical 16 module_unit % +module_description Too much IOwait means IO bottleneck and performance problems. Check also LoadAVG. +module_group System module_end -#Get load average -module_begin +# Get load average +module_begin module_name Load Average module_type generic_data -module_exec cat /proc/loadavg | cut -d' ' -f1 -module_description Average process in CPU (Last minute) +module_exec cat /proc/loadavg | cut -d' ' -f1 +module_description Average process in CPU (Last minute) +module_group System module_end -#IO Wait CPU ticks /sec -module_begin -module_name IOWaitCPU -module_type generic_data_inc -module_exec vmstat -s | grep "IO-wait cpu ticks" | awk '{ print $1 }' -module_unit ticks/sec -module_description Too much IOwait means IO bottleneck and performance problems. Check also LoadAVG. -module_end - -#Connected users +# Basic info about TCP Connection module_begin -module_name Connected users -module_type generic_data -module_exec who | wc -l +module_name TCP_Connections +module_type generic_data +module_exec netstat -an | grep tcp | grep -v LIST | wc -l +module_description Total number of TCP connections active +module_group Networking module_end -#Count total number of processes -module_begin -module_name Number processes -module_type generic_data -module_exec ps aux | wc -l -module_description Total processes -module_unit processes -module_end - -# Async data example - -module_begin -module_name LastLogin -module_type async_string -module_exec last | head -1 -module_description Monitor last user loggin -module_end - - -# This plugin detects all disk and report free space (%) +# This plugin detects all disk and report used space (%) module_plugin pandora_df_used -# This plugin detects system free memory and free swap (in %) +# This plugin detects system free memory and used swap (in %) -module_plugin pandora_mem +module_plugin pandora_mem_used # This plugin will get the network usage (bytes/sec) module_plugin pandora_netusage -# This parses /var/log/syslog file, under the module name "Syslog_error" -# And search for "ERROR" string into it, sending only that information. - -module_plugin grep_log /var/log/syslog Syslog_error ERROR - # Plugin for inventory on the agent (Only Enterprise) -# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route +#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route # Log collection modules. Only for enterprise version, this will collect log files for forensic analysis. # This is for LOG monitoring, only on enterprise version #module_plugin grep_log_module /var/log/messages Syslog \.\* +#module_begin +#module_name HTTPD_Status +#module_type generic_proc +#module_exec ps aux | grep httpd | grep -v grep | wc -l +#module_group Application +#module_end + +#module_begin +#module_name MySQL_Status +#module_type generic_proc +#module_exec ps aux | grep -v grep | grep mysqld_safe | wc -l +#module_group Database +#module_end + +#module_begin +#module_name Zombies +#module_type generic_data +#module_exec ps aux | grep "<defunct>" | grep -v grep | wc -l +#module_description Zombies process on system +#module_group System +#module_end diff --git a/pandora_agents/unix/plugins/pandora_mem_used b/pandora_agents/unix/plugins/pandora_mem_used new file mode 100755 index 0000000000..a09d0231c6 --- /dev/null +++ b/pandora_agents/unix/plugins/pandora_mem_used @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +# Returns memory USED +# (c) 2017 Sancho Lerena <slerena@artica.es> + +use POSIX; + +my $STOTAL=`vmstat -s | grep "total swap" | awk '{ print $1 } '`; +my $SUSED=`vmstat -s | grep "free swap" | awk '{ print $1 } '`; +my $SFREE; +eval { +$SFREE=($SUSED/$STOTAL)*100; +}; +if ($@) { + $SFREE = 0; +} + +$SFREE = floor($SFREE); +$FREEP = floor($FREEP); + +# Available memory as FreeMemory + Cached + SwapCached. +my $freemem=`cat /proc/meminfo | grep 'MemFree' | awk '{ print \$2 } '`; +my $cached=`cat /proc/meminfo | grep '^Cached:' | awk '{ print \$2 } '`; +my $cachedswap=`cat /proc/meminfo | grep '^SwapCached:' | awk '{ print \$2 }'`; +my $total_meminfo=`cat /proc/meminfo | grep 'MemTotal:' | awk '{ print \$2 }'`; +my $available=$freemem+$cached+$cachedswap; +my $available_percent = floor(($available / $total_meminfo)*100); + +my $USED = 100 - $available_percent; +my $SWAP_USED = 100 - $SFREE; + +print "<module>\n"; +print "<name><![CDATA[Memory_Used]]></name>\n"; +print "<type><![CDATA[generic_data]]></type>\n"; +print "<description><![CDATA[Used memory %]]></description>\n"; +print "<unit><![CDATA[%]]></unit>\n"; +print "<min_critical><![CDATA[95]]></min_critical>\n"; +print "<max_critical><![CDATA[100]]></max_critical>\n"; +print "<data><![CDATA[$USED]]></data>\n"; +print "<module_group><![CDATA[System]]></module_group>\n"; +print "</module>\n"; + +print "<module>\n"; +print "<name><![CDATA[Swap_Used]]></name>\n"; +print "<type><![CDATA[generic_data]]></type>\n"; +print "<description><![CDATA[Used Swap %]]></description>\n"; +print "<unit><![CDATA[%]]></unit>\n"; +print "<min_critical><![CDATA[95]]></min_critical>\n"; +print "<max_critical><![CDATA[100]]></max_critical>\n"; +print "<data><![CDATA[$SWAP_USED]]></data>\n"; +print "<module_group><![CDATA[System]]></module_group>\n"; +print "</module>\n"; diff --git a/pandora_agents/unix/plugins/pandora_netusage b/pandora_agents/unix/plugins/pandora_netusage index 3a5e33510b..4c8c006903 100755 --- a/pandora_agents/unix/plugins/pandora_netusage +++ b/pandora_agents/unix/plugins/pandora_netusage @@ -10,5 +10,6 @@ echo " <type><![CDATA[generic_data_inc]]></type>" echo " <data><![CDATA[$TOTAL]]></data>" echo " <unit><![CDATA[bytes/sec]]></unit>" echo " <description><![CDATA[Total bytes/sec transfered in this system]]></description>" +echo " <module_group>Networking</module_group>" echo "</module>" diff --git a/pandora_agents/win32/bin/util/df_percent_used.vbs b/pandora_agents/win32/bin/util/df_percent_used.vbs new file mode 100644 index 0000000000..49440b5e16 --- /dev/null +++ b/pandora_agents/win32/bin/util/df_percent_used.vbs @@ -0,0 +1,49 @@ +' df_all.vbs +' Returns used space (%) for all drives +' Pandora FMS Plugin, (c) 2014 Sancho Lerena +' ------------------------------------------ + +Option Explicit +On Error Resume Next + +' Variables +Dim objWMIService, objItem, colItems, argc, argv, i, Percent + + +' Parse command line parameters +argc = Wscript.Arguments.Count +Set argv = CreateObject("Scripting.Dictionary") +For i = 0 To argc - 1 + argv.Add Wscript.Arguments(i), i +Next + +' Get drive information +Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2") +Set colItems = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk") + +For Each objItem in colItems + If argc = 0 Or argv.Exists(objItem.Name) Then + ' Include only harddrivers (type 3) + If (objItem.FreeSpace <> "") AND (objItem.DriveType =3) Then + Percent = round (100 - (objItem.FreeSpace / objItem.Size) * 100, 2) + Wscript.StdOut.WriteLine "<module>" + Wscript.StdOut.WriteLine " <name><![CDATA[DiskUsed_" & objItem.Name & "]]></name>" + Wscript.StdOut.WriteLine " <description><![CDATA[% used space. Filesystem unit: " & objItem.Name & "]]></description>" + If (Percent > 99.99) then + Wscript.StdOut.WriteLine " <data><![CDATA[" & 100 & "]]></data>" + Elseif (Percent < 0.01) then + Wscript.StdOut.WriteLine " <data><![CDATA[" & 0 & "]]></data>" + Else + Wscript.StdOut.WriteLine " <data><![CDATA[" & Percent & "]]></data>" + End If + Wscript.StdOut.WriteLine " <unit>%</unit>" + Wscript.StdOut.WriteLine " <min_warning>90</min_warning>" + Wscript.StdOut.WriteLine " <max_warning>0</max_warning>" + Wscript.StdOut.WriteLine " <min_critical>95</min_critical>" + Wscript.StdOut.WriteLine " <max_critical>0</max_critical>" + Wscript.StdOut.WriteLine " <module_group>System</module_group>" + Wscript.StdOut.WriteLine "</module>" + Wscript.StdOut.flush + End If + End If +Next diff --git a/pandora_agents/win32/bin/util/mem_percent_used.vbs b/pandora_agents/win32/bin/util/mem_percent_used.vbs new file mode 100644 index 0000000000..15733b60f1 --- /dev/null +++ b/pandora_agents/win32/bin/util/mem_percent_used.vbs @@ -0,0 +1,57 @@ +' mem_percent_used.vbs +' Returns used RAM (%) +' Pandora FMS Plugin, (c) 2017 Fermin Hernandez +' ------------------------------------------ + +Dim usedMEM, totalMEM, Percent + +strComputer = "." +Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") + +Set colRAMs = objWMIService.ExecQuery("Select capacity from Win32_PhysicalMemory") +For Each total in colRAMs + totalMEM = total.capacity +Next + +Set colUSEDs = objWMIService.ExecQuery("Select freePhysicalMemory from Win32_OperatingSystem") +For Each used in colUSEDs + usedMEM = used.freePhysicalMemory * 1024 +Next + +on error resume next +flag = colRAMs.Count +If (err.number <> 0) Then + flag = true +Else + flag = false +End If +on error goto 0 + +on error resume next +flag = colUSEDs.Count +If (err.number <> 0) Then + flag = true +Else + flag = false +End If +on error goto 0 + +'Print only when there's results +If (NOT flag) Then + Percent = round (100 - (usedMEM / totalMEM) * 100, 2) + Wscript.StdOut.WriteLine "<module>" + Wscript.StdOut.WriteLine " <name><![CDATA[Memory_Used]]></name>" + Wscript.StdOut.WriteLine " <description><![CDATA[Used memory %]]></description>" + If (Percent > 99.99) then + Wscript.StdOut.WriteLine " <data><![CDATA[" & 100 & "]]></data>" + Elseif (Percent < 0.01) then + Wscript.StdOut.WriteLine " <data><![CDATA[" & 0 & "]]></data>" + Else + Wscript.StdOut.WriteLine " <data><![CDATA[" & Percent & "]]></data>" + End If + Wscript.StdOut.WriteLine " <unit>%</unit>" + Wscript.StdOut.WriteLine " <min_critical>95</min_critical>" + Wscript.StdOut.WriteLine " <max_critical>100</max_critical>" + Wscript.StdOut.WriteLine " <module_group>System</module_group>" + Wscript.StdOut.WriteLine "</module>" +End If diff --git a/pandora_agents/win32/bin/util/network.vbs b/pandora_agents/win32/bin/util/network.vbs new file mode 100644 index 0000000000..c2a511339d --- /dev/null +++ b/pandora_agents/win32/bin/util/network.vbs @@ -0,0 +1,26 @@ +' Agent Plugin to get detailed network information per network interface +' Execute as module_plugin cscript //B network.vbs + +Option Explicit + +Dim colAdapters, objAdapter, NicDescription, strFileName, objFS, objTS, colAdapters2, objAdapter2 + +Dim totalNetworkUsage + +totalNetworkUsage=0 + +Set colAdapters2 = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("SELECT * FROM Win32_PerfRawData_Tcpip_NetworkInterface WHERE Name != 'isatap.localdomain'") +For Each objAdapter2 in colAdapters2 + totalNetworkUsage = totalNetworkUsage + objAdapter2.BytesTotalPersec +Next + + Wscript.StdOut.WriteLine "<module>" + Wscript.StdOut.WriteLine " <name>Network_Usage_Bytes</name>" + Wscript.StdOut.WriteLine " <description>Total bytes/sec transfered in this system</description>" + Wscript.StdOut.WriteLine " <type>generic_data_inc</type>" + Wscript.StdOut.WriteLine " <data>" & totalNetworkUsage & "</data>" + Wscript.StdOut.WriteLine " <unit>bytes/sec</unit>" + Wscript.StdOut.WriteLine " <module_group>Networking</module_group>" + Wscript.StdOut.WriteLine "</module>" + +WScript.Quit