mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
Modified default Linux config file and added pandora_mem_used plugin
This commit is contained in:
parent
1b1f1165e8
commit
7b9e053389
@ -175,7 +175,7 @@ temporal_min_size 1024
|
|||||||
|
|
||||||
# System information
|
# System information
|
||||||
|
|
||||||
# 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_begin
|
||||||
module_name CPU Load
|
module_name CPU Load
|
||||||
module_type generic_data
|
module_type generic_data
|
||||||
@ -189,9 +189,10 @@ module_max_warning 90
|
|||||||
module_min_critical 91
|
module_min_critical 91
|
||||||
module_max_critical 100
|
module_max_critical 100
|
||||||
module_unit %
|
module_unit %
|
||||||
|
module_group System
|
||||||
module_end
|
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_begin
|
||||||
module_name CPU IOWait
|
module_name CPU IOWait
|
||||||
module_type generic_data
|
module_type generic_data
|
||||||
@ -200,6 +201,8 @@ module_exec vmstat 1 2 | tail -1 | awk '{ print $16 }'
|
|||||||
module_min_warning 10
|
module_min_warning 10
|
||||||
module_min_critical 16
|
module_min_critical 16
|
||||||
module_unit %
|
module_unit %
|
||||||
|
module_description Too much IOwait means IO bottleneck and performance problems. Check also LoadAVG.
|
||||||
|
module_group System
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
# Get load average
|
# Get load average
|
||||||
@ -208,60 +211,30 @@ module_name Load Average
|
|||||||
module_type generic_data
|
module_type generic_data
|
||||||
module_exec cat /proc/loadavg | cut -d' ' -f1
|
module_exec cat /proc/loadavg | cut -d' ' -f1
|
||||||
module_description Average process in CPU (Last minute)
|
module_description Average process in CPU (Last minute)
|
||||||
|
module_group System
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
#IO Wait CPU ticks /sec
|
# Basic info about TCP Connection
|
||||||
module_begin
|
module_begin
|
||||||
module_name IOWaitCPU
|
module_name TCP_Connections
|
||||||
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
|
|
||||||
module_begin
|
|
||||||
module_name Connected users
|
|
||||||
module_type generic_data
|
module_type generic_data
|
||||||
module_exec who | wc -l
|
module_exec netstat -an | grep tcp | grep -v LIST | wc -l
|
||||||
|
module_description Total number of TCP connections active
|
||||||
|
module_group Networking
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
#Count total number of processes
|
# This plugin detects all disk and report used space (%)
|
||||||
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 (%)
|
|
||||||
|
|
||||||
module_plugin pandora_df_used
|
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)
|
# This plugin will get the network usage (bytes/sec)
|
||||||
|
|
||||||
module_plugin pandora_netusage
|
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)
|
# 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
|
||||||
|
|
||||||
@ -269,3 +242,24 @@ module_plugin grep_log /var/log/syslog Syslog_error ERROR
|
|||||||
# This is for LOG monitoring, only on enterprise version
|
# This is for LOG monitoring, only on enterprise version
|
||||||
#module_plugin grep_log_module /var/log/messages Syslog \.\*
|
#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
|
||||||
|
52
pandora_agents/unix/plugins/pandora_mem_used
Executable file
52
pandora_agents/unix/plugins/pandora_mem_used
Executable file
@ -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";
|
@ -10,5 +10,6 @@ echo " <type><![CDATA[generic_data_inc]]></type>"
|
|||||||
echo " <data><![CDATA[$TOTAL]]></data>"
|
echo " <data><![CDATA[$TOTAL]]></data>"
|
||||||
echo " <unit><![CDATA[bytes/sec]]></unit>"
|
echo " <unit><![CDATA[bytes/sec]]></unit>"
|
||||||
echo " <description><![CDATA[Total bytes/sec transfered in this system]]></description>"
|
echo " <description><![CDATA[Total bytes/sec transfered in this system]]></description>"
|
||||||
|
echo " <module_group>Networking</module_group>"
|
||||||
echo "</module>"
|
echo "</module>"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user