Code backup
This commit is contained in:
2026-05-10 16:59:01 +02:00
commit 368d6fafea
796 changed files with 315310 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
#REQUIRED PARAMS
username="ced@pal.it"
password="#zPG6tax1yuiWU*8iw"
#EXTRA OPTIONS
uagent="Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" #user agent (fake a browser)
sleeptime=0 #add pause between requests
touch "cookie.txt" #create a temp. cookie file
#INITIAL PAGE
echo "[+] Fetching" && sleep $sleeptime
initpage=`curl -s -b "cookie.txt" -c "cookie.txt" -L --sslv3 -A "$uagent" "https://monitoring.solaredge.com/solaredge-web/p/login"`
token=`echo "$initpage" | grep "authenticity_token" | sed -e 's/.*value="//' | sed -e 's/" \/>.*//'`
#LOGIN
echo "[+] Submitting the login form..." && sleep $sleeptime
loginpage=`curl -s -b "cookie.txt" -c "cookie.txt" -L --sslv3 -A "$uagent" -d "username=$username&password=$password" "https://monitoring.solaredge.com/solaredge-web/p/login"`
#HOME PAGE
echo "[+] Getting page" && sleep $sleeptime
homepage=`curl -s -b "cookie.txt" -c "cookie.txt" -L -A "$uagent" "https://monitoring.solaredge.com/solaredge-web/p/site/3834979/#/alerts"`
echo $token > "tk.txt"
echo $loginpage > "lp.txt"
echo $homepage > "se.txt"
rm "cookie.txt"
+6
View File
@@ -0,0 +1,6 @@
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_monitoring.solaredge.com FALSE / TRUE 0 TS01f1db2e 014c1b7298ca68ea2ef928dec008bef8acb1b2f66dc59f0f23813465ee09a6bafd405e9d34b7838cdfd749ccd005e119bba626ebe543d6f1a98b805861e40d0a87b03be0f3
monitoring.solaredge.com FALSE / FALSE 0 CSRF-TOKEN 6C8D6F6E4D4C506D27A4FD3989833DA7B52CDFF9F21952B0141E300236B273A3B18D93C601B5D5C6CD472BAF4FEF570E462C
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
username="ced@pal.it"
password="#zPG6tax1yuiWU*8iw"
urlTargetLogin="https://monitoring.solaredge.com/solaredge-web/p/login"
urlTargetData="https://monitoring.solaredge.com/solaredge-web/p/site/3834979/#/alerts"
echo $(curl --cookie-jar cookies.txt --form passphrase=$password --form username=$username $urlTargetLogin)
+15
View File
@@ -0,0 +1,15 @@
#! /bin/sh
HOSTNAME=$(hostname)
IP=$(hostname -I)
MAC=$(cat /sys/class/net/eth0/address)
echo "Device Information:" > file.txt
echo ">HOST:" >> file.txt
echo " $HOSTNAME" >> file.txt
echo ">IP:" >> file.txt
echo " $IP" >> file.txt
echo ">MAC:" >> file.txt
echo " $MAC" >> file.txt
exit 0
+5
View File
@@ -0,0 +1,5 @@
Device Information
PC210VM
172.31.237.42
00:15:5d:52:af:07
+132
View File
@@ -0,0 +1,132 @@
#!/bin/bash
show_menu(){
NORMAL=`echo "\033[m"`
MENU=`echo "\033[36m"` #Blue
NUMBER=`echo "\033[33m"` #yellow
FGRED=`echo "\033[41m"`
RED_TEXT=`echo "\033[31m"`
ENTER_LINE=`echo "\033[33m"`
echo -e "${MENU}*********************************************${NORMAL}"
echo -e "Welcome to Parrot On-Debian Installer Script"
echo -e "\t\trev 0.2 - 2015-06-10"
echo -e "${MENU}**${NUMBER} 1)${MENU} Install Core Only ${NORMAL}"
echo -e "${MENU}**${NUMBER} 2)${MENU} Install Headless Edition ${NORMAL}"
echo -e "${MENU}**${NUMBER} 3)${MENU} Install Security Edition ${NORMAL}"
echo -e "${MENU}**${NUMBER} 4)${MENU} Install Home Edition ${NORMAL}"
echo -e "${MENU}**${NUMBER} 5)${MENU} Install Embedded Edition ${NORMAL}"
echo -e "${MENU}*********************************************${NORMAL}"
echo -e "${ENTER_LINE}Please enter a menu option and enter or ${RED_TEXT}enter to exit. ${NORMAL}"
read opt
}
function option_picked() {
COLOR='\033[01;31m' # bold red
RESET='\033[00;00m' # normal white
MESSAGE=${@:-"${RESET}Error: No message passed"}
echo -e "${COLOR}${MESSAGE}${RESET}"
}
function core_install() {
# Protect against HTTP vulnerabilities [https://www.debian.org/security/2016/dsa-3733], [https://www.debian.org/security/2019/dsa-4371]
apt-get update
#echo -e "deb https://mirror.parrotsec.org/parrot rolling main contrib non-free" > /etc/apt/sources.list.d/parrot.list
#echo -e "# This file is empty, feel free to add here your custom APT repositories\n\n# The standard Parrot repositories are NOT here. If you want to\n# edit them, take a look into\n# /etc/apt/sources.list.d/parrot.list\n# /etc/apt/sources.list.d/debian.list\n\n\n\n# If you want to change the default parrot repositories setting\n# another localized mirror, then use the command parrot-mirror-selector\n# and see its usage message to know what mirrors are available\n\n\n\n#uncomment the following line to enable the Parrot Testing Repository\n#deb http://us.repository.frozenbox.org/parrot testing main contrib nonfree" > /etc/apt/sources.list
wget -qO - https://deb.parrotsec.org/parrot/misc/parrotsec.gpg | apt-key add -
apt-get update
apt-get -y --force-yes -o Dpkg::Options::="--force-overwrite" install apt-parrot parrot-archive-keyring --no-install-recommends
#parrot-mirror-selector default stable #change it if you want another mirror, launch it without parameters to get the full list of available mirrors
apt-get update
apt -y --allow-downgrades -o Dpkg::Options::="--force-overwrite" install parrot-core
apt -y --allow-downgrades -o Dpkg::Options::="--force-overwrite" dist-upgrade
apt -y autoremove
}
function headless_install() {
apt -y --allow-downgrades install parrot-pico
}
function security_install() {
apt -y --allow-downgrades install parrot-interface parrot-interface-full parrot-tools-full
}
function home_install() {
apt -y --allow-downgrades install parrot-interface-full parrot-interface
}
function embedded_install() {
apt -y --allow-downgrades install parrot-interface parrot-mini
}
function init_function() {
clear
show_menu
while [ opt != '' ]
do
if [[ $opt = "" ]]; then
exit;
else
case $opt in
1) clear;
option_picked "Installing Core";
core_install;
option_picked "Operation Done!";
exit;
;;
2) clear;
option_picked "Installing Headless Edition";
core_install;
headless_install;
option_picked "Operation Done!";
exit;
;;
3) clear;
option_picked "Installing Parrot Security OS";
core_install;
security_install;
option_picked "Operation Done!";
exit;
;;
4) clear;
option_picked "Installing Home Edition";
core_install;
home_install;
option_picked "Operation Done!";
exit;
;;
5) clear;
option_picked "Installing Embedded Edition";
core_install;
embedded_install;
option_picked "Operation Done!";
exit;
;;
x)exit;
;;
q)exit;
;;
\n)exit;
;;
*)clear;
option_picked "Pick an option from the menu";
show_menu;
;;
esac
fi
done
}
if [ `whoami` == "root" ]; then
init_function;
else
echo "R U Drunk? This script needs to be run as root!"
fi
+3
View File
@@ -0,0 +1,3 @@
usr= unknow
psw= ##ED*4njz1tara0VsJ1X~cYt
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
echo "Password Generator Started"
if [ -z "$1" ]
then
VAR="24"
else
VAR="$1"
fi
PSW=$(head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9~!@#$%^&*_-' | fold -w $VAR | head -n 1)
if [ -z "$2" ]
then
USR="unknow"
else
USR="$2"
fi
echo "Password Generated for:"
echo "usr= $USR" >> psw.txt
echo "psw= $PSW" >> psw.txt
echo "" >> psw.txt
echo "$USR"
echo "$PSW"
exit 0
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
number=$(( $RANDOM % 10 + 1 ))
echo "Guess a number between 1 and 10"
guess=0
while [ "0$guess" -ne $number ] ; do
read guess
[ "0$guess" -lt $number ] && echo "Too low"
[ "0$guess" -gt $number ] && echo "Too high"
done
echo "That's right!"
exit 0
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
# Roll
# This script returns the values and sum of a set of dice rolls. The first
# arg is optional and gives a number of dice. The second arg is the number
# of sides on the dice. For example "roll 2 6" will give two values from 1
# to 6 and also returns their sum.
#
# (c)2009 Dominic Lepiane
sides=6
dice=1
total=0
c=0
if [ $# = 2 ] ; then
dice=$1
sides=$2
elif [ $# = 1 ] ; then
sides=$1
else
echo "Usage: $0 [# of dice] <# of sides>" >&2
exit -1
fi
#echo "Rolling {$dice}d{$sides}"
while [ $c -lt $dice ] ; do
c=$((c+1))
roll=$((RANDOM%sides + 1))
total=$((total+roll))
echo -n "$roll "
done
if [ $dice -gt 1 ] ; then
echo -n " = $total"
fi
echo ""
+17
View File
@@ -0,0 +1,17 @@
#! /bin/sh
#StartScript--V1.0
aprimi="/usr/pal.local/file/ApriMi"
desktop="$HOME/Scrivania/"
palterm="$HOME/Scrivania/ApriMi/PALTERM02.rpd"
if [ ! -f $HOME/Scrivania/ApriMi ];
then
cp -r -u $aprimi $desktop
notify-send "$USER Benvenuto! Uttilizza Remmina per accedere alla tua area di lavoro"
remmina -c $palterm
else
notify-send "$USER Benvenuto! Uttilizza Remmina per accedere alla tua area di lavoro"
remmina -c $palterm
fi
+32
View File
@@ -0,0 +1,32 @@
#!/bin/sh
#AutoUpdate--V1.2
host=$(hostname)
date=$(date +"%T")
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
sgr=$(tput sgr 0)
if [ "$(id -u)" -ne 0 ]; then
echo "${red}This script must be run with root privileges${sgr}" >&2
exit 1
fi
echo "${yellow}! AutoUpdate start !${sgr}"
notify-send "${date} - AutoUpdate start"
echo "${date} - AutoUpdate start"
# Update && Upgrade
apt update && apt full-upgrade -y
if [ -f /var/run/reboot-required ]; then
echo "A ${yellow}reboot${sgr} is required in order to proceed with the install." >&2
echo "Please ${yellow}reboot${sgr} and re-run this script to finish the install." >&2
exit 1
fi
echo "Update Success!"
+55
View File
@@ -0,0 +1,55 @@
#!/bin/sh
#AutoUpdate--V1.1
host=$(hostname)
date=$(date +"%T")
fail="Update Fail"
success="Update Success"
suc_reboot="Update Success and just rebooted"
facility="Linux Server"
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
sgr=$(tput sgr 0)
json_fail='{"version": "1.1","host":"'$host'","facility":"'$facility'","short_message":"Raspberry wrong update","full_message":"The Ubuntu '$facility' was fail check '$host'","level":1,"_user_id":9001,"_some_info":"foo","_some_env_var":"bar"}'
json_success='{"version": "1.1","host":"'$host'","facility":"'$facility'","short_message":"Raspberry success update","full_message":"The Ubuntu '$facility' success","level":6,"_user_id":9001,"_some_info":"foo","_some_env_var":"bar"}'
json_suc_reboot='{"version": "1.1","host":"'$host'","facility":"'$facility'","short_message":"Raspberry updated and start reboot","full_message":"The Ubuntu '$facility' success '$host' start reboot","level":6,"_user_id":9001,"_some_info":"foo","_some_env_var":"bar"}'
echo "${yellow}! AutoUpdate start !${sgr}"
apt update
apt -y dist-upgrade
if [[ $? > 0 ]];
then
echo "${red}Wrong update${sgr}" && echo "${date} - ${fail}" > ./pal.log && echo $json_fail | gzip | nc -u -w 1 palgraylog01.pal.local 12201
notify-send "Se il dispositivo presenta problemi contattare il CED"
exit
else
echo "${green}Don't worry about your device is updating${sgr}"
fi
apt -y autoremove
apt clean
apt purge -y $(dpkg -l | awk '/^rc/ { print $2 }')
echo "${green}! Update completed !${sgr}"
if [ ! -f /var/run/reboot-required ];
then
# no reboot required (0=OK)
echo "${green}Good: no reboot required${sgr}" && echo "${date} - ${success}" > ../pal.log && echo $json_success | gzip | nc -u -w 1 palgraylog01.pal.local 12201
notify-send "Aggiornamento eseguito con successo"
exit 0
else
# reboot required (1=WARN)
echo "${red}WARNING: ${yellow}`cat /var/run/reboot-required`${sgr}" && echo "${date} - ${suc_reboot}" > ../pal.log && echo $json_suc_reboot | gzip | nc -u -w 1 palgraylog01.pal.local 12201
notify-send "Aggiornamento eseguito con successo il dispositivo si riavvia a breve"
v
reboot now
exit 1
fi
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
String='pippo' # Zero-length ("null") string variable.
if [ -z "$String" ]
then
echo "\$String is null."
else
echo "\$String is NOT null."
fi # $String is null.
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
count=0
while [ $count -le 10 ]
do
echo "$count"
count=$(( $count + 1 ))
done
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
ping -c1 -W1 -q $server &>/dev/null
#status=$( echo $? )
if [[ $? == 0 ]] ; then
#Connection success!
else
#Connection failure
fi
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
source repo.sh
echo Welcome ${USERNAME}!
echo Your email is ${EMAIL}.
echo prova $COMPUTER Funzione
Funzione
echo test $COMPUTER
+6
View File
@@ -0,0 +1,6 @@
USERNAME="satish"
EMAIL="satish@linuxconcept.com"
Funzione() {
COMPUTER="=PC000"
}
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
EnableDisable() {
case $1 in
1) local stateED="On";;
2) local stateED="Off";;
esac
echo $stateED
}
printf "%s\t%s\t%s\n" "Status:" "$(EnableDisable 1)" "Test On"
printf "%s\t%s\t%s\n" "Status:" "$(EnableDisable 2)" "Test Off"
+53
View File
@@ -0,0 +1,53 @@
Main (){
if [ ! -z $A ];then
RES="${A}"
fi
if [ ! -z $B ];then
RES+=":${B}"
fi
if [ ! -z $C ];then
RES+="\\${C}"
fi
if [ ! -z $D ];then
RES+="//${D}"
fi
echo $RES
}
while test -n "$1"; do
case "$1" in
--protocol | -p)
PROTOCOL=$2
shift ;;
--a )
A=$2
shift;;
--b )
B=$2
shift;;
--c )
C=$2
shift;;
--d )
D=$2
shift;;
*)
echo "Unknown argument: $1"
exit $STATE_UNK ;;
esac
shift
done
Main
+95
View File
@@ -0,0 +1,95 @@
@page
@model webapp_local.Pages.IT.UserListModel
@{
ViewData["Title"] = "Elenco Utenti";
}
@section ToolBar {
@(Html.DevExtreme().Toolbar()
.Items(items =>
{
items.Add()
.Widget(w => w
.Button()
.Icon("menu")
.OnClick("webapp_shared.onMenuButtonClick")
)
.Location(ToolbarItemLocation.Before);
items.Add()
.Template(
@<text>
<div class="toolbar-label">
<h4 id="helpText" style="display: block; margin: 0px;"><i class='@Model.NavigationItem.Icon'></i>&nbsp&nbsp @Model.NavigationItem.Text</h4>
</div>
</text>
)
.LocateInMenu(ToolbarItemLocateInMenuMode.Never)
.Location(ToolbarItemLocation.Center);
items.Add()
.Widget(w => w
.Button()
.ID("btnAutoRefresh")
.Icon("fas fa-recycle")
.Hint("Refresh dei dati")
.OnClick("reloadData")
)
.Location(ToolbarItemLocation.After);
})
)
}
<div id="mainDiv" class="justify-content-center">
@(Html.DevExtreme().DataGrid()
.ID("gridADUser")
.DataSource(d => d.RemoteController().LoadUrl(Url.Page("UserList", "ADUserData")).Key("id"))
.LoadPanel(loadPanel => loadPanel.Enabled(false))
.Scrolling(scrolling => scrolling.Mode(GridScrollingMode.Infinite))
.Sorting(sorting => sorting.Mode(GridSortingMode.None))
.Columns(c =>
{
c.Add().DataField("initials").Caption("Sigla").SortOrder(SortOrder.Asc);
c.Add().DataField("samAccountName").Caption("UserName");
c.Add().DataField("name").Caption("Nome");
})
.WordWrapEnabled(true)
.ShowBorders(true)
.FilterRow(f => f.Visible(true))
.FilterPanel(fp => fp.Visible(true))
.HeaderFilter(f => f.Visible(true))
.RemoteOperations(true)
.ColumnAutoWidth(true)
.AllowColumnResizing(true)
.CacheEnabled(true)
.RowAlternationEnabled(true)
.CustomizeColumns("customizeColumns")
)
</div>
@section scripts {
<script>
var gridADUser;
$(document).ready(function () {
gridADUser = $("#gridADUser").dxDataGrid("instance");
$(window).resize(function () {
if (gridADUser != null) {
var res = layoutdrawer.option('height') - 15;
if (res < 200)
res = 200;
gridADUser.option("height", res);
}
});
$(window).resize();
});
function reloadData() {
gridADUser.getDataSource().reload();
}
</Script>
}
+51
View File
@@ -0,0 +1,51 @@
using DevExtreme.AspNet.Data;
using DevExtreme.AspNet.Mvc;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Localization;
using System.Collections.Generic;
using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
using System.Threading.Tasks;
using webapp_local.Models;
using webapp_shared;
using webapp_shared.Code;
namespace webapp_local.Pages.IT
{
[UserPermissionsOneOfThesePolicies("CanViewUserList")]
[BindProperties]
public class UserListModel : _LayoutModel
{
public UserListModel(IStringLocalizer<_LayoutModel> _localizer, IConfiguration _config, UserManager<ApplicationUser> _userManager) : base(_localizer, _config, _userManager)
{
}
public async Task<JsonResult> OnGetADUserData(DataSourceLoadOptions options)
{
var ret = new List<ArrayADUser>();
int index = 0;
using (var context = new PrincipalContext(ContextType.Domain, "pal.local"))
{
using (var searcher = new PrincipalSearcher(new UserPrincipal(context)))
{
foreach (var result in searcher.FindAll())
{
DirectoryEntry de = result.GetUnderlyingObject() as DirectoryEntry;
ret.Add(new ArrayADUser()
{
id = index++,
Initials = de.Properties.Contains("Initials") ? de.Properties["Initials"].Value.ToString() : "",
SamAccountName = de.Properties.Contains("SamAccountName") ? de.Properties["SamAccountName"].Value.ToString() : "",
Name = de.Properties.Contains("Name") ? de.Properties["Name"].Value.ToString() : "",
});
}
}
}
return new JsonResult(DataSourceLoader.Load(ret, options));
}
}
}
+87
View File
@@ -0,0 +1,87 @@
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Moq;
using webapp_italsort.DataItalsortGestionale;
using webapp_italsort.Repositories.SharePoint;
namespace library_spo_utils.test
{
[TestClass]
public class NonComplianceSettingsRepositoryTest
{
private readonly NonComplianceSettingsRepository _sut;
private readonly Mock<IDbContextFactory<Db_ItalsortGestionaleContext>> _factoryMock = new Mock<IDbContextFactory<Db_ItalsortGestionaleContext>>();
private readonly Mock<IHttpContextAccessor> _accessorMock = new Mock<IHttpContextAccessor>();
private Db_ItalsortGestionaleContext _context;
public NonComplianceSettingsRepositoryTest()
{
_sut = new NonComplianceSettingsRepository(_factoryMock.Object);
}
[TestInitialize]
public void Setup()
{
var httpContext = new DefaultHttpContext();
var fakeTenantId = "abcd";
httpContext.Request.Headers["Tenant-ID"] = fakeTenantId;
_accessorMock.Setup(_ => _.HttpContext).Returns(httpContext);
var options = new DbContextOptionsBuilder<Db_ItalsortGestionaleContextDefault>()
.UseInMemoryDatabase("InMemoryTest")
.Options;
_context = new Db_ItalsortGestionaleContext(options, _accessorMock.Object);
_factoryMock.Setup(x => x.CreateDbContext()).Returns(_context);
}
[TestMethod]
[DataRow("codice-test")]
public async Task GetCode_ShouldReturn_Instance(string code)
{
var record = new InventNonConformanceTable()
{
Code = code
};
_context.InventNonConformanceTable.Add(record);
await _context.SaveChangesAsync();
var result = _sut.GetByCode(code);
Assert.IsNotNull(result);
Assert.AreEqual(code, result.Code);
}
[TestMethod]
[DataRow("codice", "NC23", "00012", "NC23-00012")]
public async Task DefaultNonComplianceProject_Should_Return_ProjId(string code, string projId, string subProj,string projConcat)
{
var record = new InventNonConformanceTable()
{
Code = code,
Proj = new ProjTable()
{
ProjId = projId,
Name = ""
},
SubProj = new SubProjTable()
{
SubProjId = subProj,
}
};
_context.InventNonConformanceTable.Add(record);
await _context.SaveChangesAsync();
var projIdResult = _sut.DefaultNonComplianceProject(code);
Assert.IsNotNull(projIdResult);
Assert.AreEqual(projConcat, projIdResult);
}
}
}
+1878
View File
File diff suppressed because it is too large Load Diff
+142
View File
@@ -0,0 +1,142 @@
using System;
using System.Net;
using System.Linq;
using System.Collections;
using System.Runtime.InteropServices;
namespace devlist
{
public class IPEnumeration: IEnumerable
{
private string startAddress;
private string endAddress;
internal static Int64 AddressToInt(IPAddress addr)
{
byte[] addressBits = addr.GetAddressBytes();
Int64 retval = 0;
for (int i = 0; i < addressBits.Length; i++)
{
retval = (retval << 8) + (int)addressBits[i];
}
return retval;
}
internal static Int64 AddressToInt(string addr)
{
return AddressToInt(IPAddress.Parse(addr));
}
internal static IPAddress IntToAddress(Int64 addr)
{
return IPAddress.Parse(addr.ToString());
}
public IPEnumeration(string startAddress, string endAddress)
{
this.startAddress = startAddress;
this.endAddress = endAddress;
}
IEnumerator IEnumerable.GetEnumerator()
{
return (IEnumerator) GetEnumerator();
}
public IPEnumerator GetEnumerator()
{
return new IPEnumerator(startAddress, endAddress);
}
}
public class IPEnumerator: IEnumerator
{
private string startAddress;
private string endAddress;
private Int64 currentIP;
private Int64 endIP;
public IPEnumerator(string startAddress, string endAddress)
{
this.startAddress = startAddress;
this.endAddress = endAddress;
currentIP = IPEnumeration.AddressToInt(startAddress);
endIP = IPEnumeration.AddressToInt(endAddress);
}
public bool MoveNext()
{
currentIP++;
return (currentIP <= endIP);
}
public void Reset()
{
currentIP = IPEnumeration.AddressToInt(startAddress);
}
object IEnumerator.Current
{
get
{
return Current;
}
}
public IPAddress Current
{
get
{
try
{
return IPEnumeration.IntToAddress(currentIP);
}
catch (IndexOutOfRangeException)
{
throw new InvalidOperationException();
}
}
}
}
public static class IPHelper
{
[DllImport("iphlpapi.dll", ExactSpelling=true)]
public static extern int SendARP( int DestIP, int SrcIP, byte[] pMacAddr, ref uint PhyAddrLen);
public static string getMAC(IPAddress address)
{
int intAddress = BitConverter.ToInt32(address.GetAddressBytes(), 0);
byte[] macAddr = new byte[6];
uint macAddrLen = (uint) macAddr.Length;
if (SendARP(intAddress, 0, macAddr, ref macAddrLen) != 0)
return "(NO ARP result)";
string[] str = new string[(int)macAddrLen];
for (int i = 0; i < macAddrLen; i++)
str[i] = macAddr[i].ToString("x2");
return string.Join(":", str);
}
}
class Program
{
public static void Main(string[] args)
{
foreach(IPAddress addr in new IPEnumeration("172.25.216.10","172.25.216.20"))
{
Console.WriteLine("{0}\t\t{1}",addr.ToString(), IPHelper.getMAC(addr));
}
Console.ReadKey(true);
}
}
}
+11
View File
@@ -0,0 +1,11 @@
TextToBeWritten = "Pinging 172.16.94.95... \r\n";
Ping ping = new Ping();
PingReply pingReply = ping.Send("172.16.94.95");
if (pingReply.Status == IPStatus.Success)
{
//Machine is alive
TextToBeWritten += "Success!";
}
else
TextToBeWritten += "Error!";
+37
View File
@@ -0,0 +1,37 @@
TextToBeWritten = "<div>Pinging... </div>";
string ipBase = "172.16.94.";
for (int i = 1; i < 100; i++)
{
string ip = ipBase + i.ToString();
Ping p = new Ping();
var pingReply = p.Send(ip, 100);
if (pingReply.Status != IPStatus.Success)
TextToBeWritten += "<div><div class=\"host-offline\">Offline</div>" + ip + "</div>";
else
{
//Machine is alive
TextToBeWritten += "<div><div class=\"host-online\">Online</div>" + ip + "</div>";
IPAddress hostIPAddress = IPAddress.Parse(ip);
TextToBeWritten += "<div>";
try
{
IPHostEntry hostInfo = Dns.GetHostByAddress(hostIPAddress);
IPAddress[] address = hostInfo.AddressList;
String[] alias = hostInfo.Aliases;
TextToBeWritten += "Host: " + hostInfo.HostName;
}
catch (Exception e)
{
TextToBeWritten += "DNS Resolution Error: " + e.Message;
}
TextToBeWritten += "</div>";
}
}
+116
View File
@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Localization;
using webapp_shared;
namespace webapp_local.Pages.InfoTech
{
public class ServerLoginsModel : _LayoutModel
{
public string TextToBeWritten { get; set; }
public ServerLoginsModel(IStringLocalizer<_LayoutModel> _localizer, IConfiguration _config) : base(_localizer, _config)
{
}
public override void OnGet()
{
base.OnGet();
if (!Permissions.CanViewVisitorsRegister)
{
// Redirect a 404
Response.Redirect("/Error");
}
TextToBeWritten = "<div>Pinging... </div>";
//ip da teneresott'occhio 172.16.94.1-254
string ipBase = "172.16.91.";
for (int i = 1; i < 254; i++)
{
string ip = ipBase + i.ToString();
Ping p = new Ping();
var pingReply = p.Send(ip, 50);
if (pingReply.Status != IPStatus.Success)
TextToBeWritten += "<div>" + "<span class=\"host-offline\">● </span>Offline " + ip + "<br>Host: Disconnesso" + "<br></div>";
else
{
//Machine is alive
TextToBeWritten += "<div>" + "<span class=\"host-online\">● </span>Online " + ip + "</div>";
IPAddress hostIPAddress = IPAddress.Parse(ip);
TextToBeWritten += "<div>";
//DNS hostbyaddress
try
{
IPHostEntry hostInfo = Dns.GetHostByAddress(hostIPAddress);
IPAddress[] address = hostInfo.AddressList;
String[] alias = hostInfo.Aliases;
TextToBeWritten += "Host: " + hostInfo.HostName + "<br>";
String CmdText = @"/c quser /server:" + ip;
Process proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = CmdText,
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
proc.Start();
String line = proc.StandardOutput.ReadToEnd();
line = line.Replace("\r\n", "<br>" + System.Environment.NewLine);
line = line.Replace("NOMEUTENTE", "UTENTE");
line = line.Replace("NOMESESSIONE", "SESSIONE");
line = line.Replace(" ", "&emsp;&emsp;&emsp;");
line = line.Replace(" ", "&emsp;&emsp;");
line = line.Replace(" ", "&emsp;");
line = line.Replace(" ", "&emsp;");
line = line.Replace(" ", "&emsp;");
line = line.Replace(" ", "&emsp;&emsp;");
line = line.Replace(" ", "&emsp;");
TextToBeWritten += "User Actualy Logged:<br>" + line;
}
catch (Exception e)
{
TextToBeWritten += "DNS Resolution Error: " + e.Message + "<br>";
}
TextToBeWritten += "<br></div>";
}
}
}
}
}
+117
View File
@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Localization;
using webapp_shared;
namespace webapp_local.Pages.InfoTech
{
public class ServerLoginsModel : _LayoutModel
{
public string TextToBeWritten { get; set; }
public ServerLoginsModel(IStringLocalizer<_LayoutModel> _localizer, IConfiguration _config) : base(_localizer, _config)
{
}
public override void OnGet()
{
base.OnGet();
if (!Permissions.CanViewVisitorsRegister)
{
// Redirect a 404
Response.Redirect("/Error");
}
TextToBeWritten = "<div>Pinging... <br></div>";
//ip da teneresott'occhio 172.16.94.1-254
string ipBase = "172.16.94.";
for (int i = 30; i < 40; i++)
{
string ip = ipBase + i.ToString();
Ping p = new Ping();
var pingReply = p.Send(ip, 50);
if (pingReply.Status != IPStatus.Success)
TextToBeWritten += "<hr class=\"solid\">" + "<div>" + "<span class=\"host-offline\">● </span>Offline " + ip + "<br>Host: Disconnesso" + "<br><br></div>";
else
{
//Machine is alive
TextToBeWritten += "<hr class=\"solid\">" + "<div>" + "<span class=\"host-online\">● </span>Online " + ip + "</div>";
IPAddress hostIPAddress = IPAddress.Parse(ip);
TextToBeWritten += "<div>";
//DNS hostbyaddress
try
{
IPHostEntry hostInfo = Dns.GetHostByAddress(hostIPAddress);
IPAddress[] address = hostInfo.AddressList;
String[] alias = hostInfo.Aliases;
TextToBeWritten += "Host: " + hostInfo.HostName + "<br>";
String CmdText = @"/c quser /server:" + ip;
Process proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
Arguments = CmdText,
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
proc.Start();
String line = proc.StandardOutput.ReadToEnd();
line = line.Replace("\r\n", "<br>" + System.Environment.NewLine);
line = line.Replace("NOMEUTENTE", "UTENTE");
line = line.Replace("NOMESESSIONE", "SESSIONE");
line = line.Replace(" ", "&ensp;&ensp;");
line = line.Replace(" ", "&ensp;&ensp;");
line = line.Replace(" ", "&ensp;&ensp;");
line = line.Replace(" ", "&ensp;&ensp;");
line = line.Replace(" ", "&ensp;&ensp;");
line = line.Replace(" ", "&ensp;&ensp;");
line = line.Replace(" ", "&ensp;&ensp;");
TextToBeWritten += "User Actualy Logged:<br>" + line;
}
catch (Exception e)
{
TextToBeWritten += "DNS Resolution Error: " + e.Message;
}
TextToBeWritten += "</div>";
}
}
}
}
}
+38
View File
@@ -0,0 +1,38 @@
string name = "Franco".ToUpper();
string surname = "Di Sorte".ToUpper().Replace(" ","");
List<string> rawAlias = new List<string>();
var range = string.Empty;
if (name.Length > surname.Length) { range = surname; } else { range = name; }
for (int i = 1;
i < 3;
i++)
{
if (i != 1)
{
rawAlias.Add($"{name[0..i]}{surname[0..i]}");
rawAlias.Add($"{name[0..i]}{surname[0]}");
rawAlias.Add($"{name[0]}{surname[0..i]}");
continue;
}
rawAlias.Add($"{name[0..i]}{surname[0..i]}");
}
rawAlias.Sort();
var alias = rawAlias.OrderBy(x => x.Length);
var existAlias = new List<string>()
{
{""}
};
foreach (var a in alias)
{
if(!existAlias.Contains(a))
Console.WriteLine(a);
}
+54
View File
@@ -0,0 +1,54 @@
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme;
void setup() {
Serial.begin(9600);
if (!bme.begin(0x76)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
}
// BME280
void readTemperature() {
Serial.print("Temperature = ");
Serial.print(bme.readTemperature());
Serial.println(" *C");
}
void readPressure() {
Serial.print("Pressure = ");
Serial.print(bme.readPressure() / 100.0F);
Serial.println(" hPa");
}
void readHumidity() {
Serial.print("Humidity = ");
Serial.print(bme.readHumidity());
Serial.println(" %");;
Serial.println();
}
void loop() {
readTemperature();
readPressure();
readHumidity();
delay(1000);
}
//Temperature = 26.10 *C
//Pressure = 1013.46 hPa
//Humidity = 56.13 %
//Temperature = -143.84 *C
//Pressure = 1144.83 hPa
//Humidity = 100.00 %
+152
View File
@@ -0,0 +1,152 @@
#include <WiFi.h>
#include <WebServer.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme;
float temperature, humidity, pressure, altitude;
/*Put your SSID & Password*/
const char* ssid = "Melafonino di Claudio"; // Enter SSID here
const char* password = "1234567890"; //Enter Password here
WebServer server(80);
void setup() {
Serial.begin(115200);
delay(100);
bme.begin(0x76);
Serial.println("Connecting to ");
Serial.println(ssid);
//connect to your local wi-fi network
WiFi.begin(ssid, password);
//check wi-fi is connected to wi-fi network
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected..!");
Serial.print("Got IP: "); Serial.println(WiFi.localIP());
server.on("/", handle_OnConnect);
server.onNotFound(handle_NotFound);
server.begin();
Serial.println("HTTP server started");
}
void loop() {
server.handleClient();
}
void handle_OnConnect() {
temperature = bme.readTemperature();
humidity = bme.readHumidity();
pressure = bme.readPressure() / 100.0F;
altitude = bme.readAltitude(SEALEVELPRESSURE_HPA);
server.send(200, "text/html", SendHTML(temperature,humidity,pressure,altitude));
}
void handle_NotFound(){
server.send(404, "text/plain", "Not found");
}
String SendHTML(float temperature,float humidity,float pressure,float altitude){
String ptr = "<!DOCTYPE html>";
ptr +="<html>";
ptr +="<head>";
ptr +="<title>ESP32 Weather Station</title>";
ptr +="<meta name='viewport' content='width=device-width, initial-scale=1.0'>";
ptr +="<link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,600' rel='stylesheet'>";
ptr +="<style>";
ptr +="html { font-family: 'Open Sans', sans-serif; display: block; margin: 0px auto; text-align: center;color: #444444;}";
ptr +="body{margin: 0px;} ";
ptr +="h1 {margin: 50px auto 30px;} ";
ptr +=".side-by-side{display: table-cell;vertical-align: middle;position: relative;}";
ptr +=".text{font-weight: 600;font-size: 19px;width: 200px;}";
ptr +=".reading{font-weight: 300;font-size: 50px;padding-right: 25px;}";
ptr +=".temperature .reading{color: #F29C1F;}";
ptr +=".humidity .reading{color: #3B97D3;}";
ptr +=".pressure .reading{color: #26B99A;}";
ptr +=".altitude .reading{color: #955BA5;}";
ptr +=".superscript{font-size: 17px;font-weight: 600;position: absolute;top: 10px;}";
ptr +=".data{padding: 10px;}";
ptr +=".container{display: table;margin: 0 auto;}";
ptr +=".icon{width:65px}";
ptr +="</style>";
ptr +="</head>";
ptr +="<body>";
ptr +="<h1>ESP32 Weather Station</h1>";
ptr +="<h3>www.how2electronics.com</h3>";
ptr +="<div class='container'>";
ptr +="<div class='data temperature'>";
ptr +="<div class='side-by-side icon'>";
ptr +="<svg enable-background='new 0 0 19.438 54.003'height=54.003px id=Layer_1 version=1.1 viewBox='0 0 19.438 54.003'width=19.438px x=0px xml:space=preserve xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink y=0px><g><path d='M11.976,8.82v-2h4.084V6.063C16.06,2.715,13.345,0,9.996,0H9.313C5.965,0,3.252,2.715,3.252,6.063v30.982";
ptr +="C1.261,38.825,0,41.403,0,44.286c0,5.367,4.351,9.718,9.719,9.718c5.368,0,9.719-4.351,9.719-9.718";
ptr +="c0-2.943-1.312-5.574-3.378-7.355V18.436h-3.914v-2h3.914v-2.808h-4.084v-2h4.084V8.82H11.976z M15.302,44.833";
ptr +="c0,3.083-2.5,5.583-5.583,5.583s-5.583-2.5-5.583-5.583c0-2.279,1.368-4.236,3.326-5.104V24.257C7.462,23.01,8.472,22,9.719,22";
ptr +="s2.257,1.01,2.257,2.257V39.73C13.934,40.597,15.302,42.554,15.302,44.833z'fill=#F29C21 /></g></svg>";
ptr +="</div>";
ptr +="<div class='side-by-side text'>Temperature</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=(int)temperature;
ptr +="<span class='superscript'>&deg;C</span></div>";
ptr +="</div>";
ptr +="<div class='data humidity'>";
ptr +="<div class='side-by-side icon'>";
ptr +="<svg enable-background='new 0 0 29.235 40.64'height=40.64px id=Layer_1 version=1.1 viewBox='0 0 29.235 40.64'width=29.235px x=0px xml:space=preserve xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink y=0px><path d='M14.618,0C14.618,0,0,17.95,0,26.022C0,34.096,6.544,40.64,14.618,40.64s14.617-6.544,14.617-14.617";
ptr +="C29.235,17.95,14.618,0,14.618,0z M13.667,37.135c-5.604,0-10.162-4.56-10.162-10.162c0-0.787,0.638-1.426,1.426-1.426";
ptr +="c0.787,0,1.425,0.639,1.425,1.426c0,4.031,3.28,7.312,7.311,7.312c0.787,0,1.425,0.638,1.425,1.425";
ptr +="C15.093,36.497,14.455,37.135,13.667,37.135z'fill=#3C97D3 /></svg>";
ptr +="</div>";
ptr +="<div class='side-by-side text'>Humidity</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=(int)humidity;
ptr +="<span class='superscript'>%</span></div>";
ptr +="</div>";
ptr +="<div class='data pressure'>";
ptr +="<div class='side-by-side icon'>";
ptr +="<svg enable-background='new 0 0 40.542 40.541'height=40.541px id=Layer_1 version=1.1 viewBox='0 0 40.542 40.541'width=40.542px x=0px xml:space=preserve xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink y=0px><g><path d='M34.313,20.271c0-0.552,0.447-1,1-1h5.178c-0.236-4.841-2.163-9.228-5.214-12.593l-3.425,3.424";
ptr +="c-0.195,0.195-0.451,0.293-0.707,0.293s-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414l3.425-3.424";
ptr +="c-3.375-3.059-7.776-4.987-12.634-5.215c0.015,0.067,0.041,0.13,0.041,0.202v4.687c0,0.552-0.447,1-1,1s-1-0.448-1-1V0.25";
ptr +="c0-0.071,0.026-0.134,0.041-0.202C14.39,0.279,9.936,2.256,6.544,5.385l3.576,3.577c0.391,0.391,0.391,1.024,0,1.414";
ptr +="c-0.195,0.195-0.451,0.293-0.707,0.293s-0.512-0.098-0.707-0.293L5.142,6.812c-2.98,3.348-4.858,7.682-5.092,12.459h4.804";
ptr +="c0.552,0,1,0.448,1,1s-0.448,1-1,1H0.05c0.525,10.728,9.362,19.271,20.22,19.271c10.857,0,19.696-8.543,20.22-19.271h-5.178";
ptr +="C34.76,21.271,34.313,20.823,34.313,20.271z M23.084,22.037c-0.559,1.561-2.274,2.372-3.833,1.814";
ptr +="c-1.561-0.557-2.373-2.272-1.815-3.833c0.372-1.041,1.263-1.737,2.277-1.928L25.2,7.202L22.497,19.05";
ptr +="C23.196,19.843,23.464,20.973,23.084,22.037z'fill=#26B999 /></g></svg>";
ptr +="</div>";
ptr +="<div class='side-by-side text'>Pressure</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=(int)pressure;
ptr +="<span class='superscript'>hPa</span></div>";
ptr +="</div>";
ptr +="<div class='data altitude'>";
ptr +="<div class='side-by-side icon'>";
ptr +="<svg enable-background='new 0 0 58.422 40.639'height=40.639px id=Layer_1 version=1.1 viewBox='0 0 58.422 40.639'width=58.422px x=0px xml:space=preserve xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink y=0px><g><path d='M58.203,37.754l0.007-0.004L42.09,9.935l-0.001,0.001c-0.356-0.543-0.969-0.902-1.667-0.902";
ptr +="c-0.655,0-1.231,0.32-1.595,0.808l-0.011-0.007l-0.039,0.067c-0.021,0.03-0.035,0.063-0.054,0.094L22.78,37.692l0.008,0.004";
ptr +="c-0.149,0.28-0.242,0.594-0.242,0.934c0,1.102,0.894,1.995,1.994,1.995v0.015h31.888c1.101,0,1.994-0.893,1.994-1.994";
ptr +="C58.422,38.323,58.339,38.024,58.203,37.754z'fill=#955BA5 /><path d='M19.704,38.674l-0.013-0.004l13.544-23.522L25.13,1.156l-0.002,0.001C24.671,0.459,23.885,0,22.985,0";
ptr +="c-0.84,0-1.582,0.41-2.051,1.038l-0.016-0.01L20.87,1.114c-0.025,0.039-0.046,0.082-0.068,0.124L0.299,36.851l0.013,0.004";
ptr +="C0.117,37.215,0,37.62,0,38.059c0,1.412,1.147,2.565,2.565,2.565v0.015h16.989c-0.091-0.256-0.149-0.526-0.149-0.813";
ptr +="C19.405,39.407,19.518,39.019,19.704,38.674z'fill=#955BA5 /></g></svg>";
ptr +="</div>";
ptr +="<div class='side-by-side text'>Altitude</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=(int)altitude;
ptr +="<span class='superscript'>m</span></div>";
ptr +="</div>";
ptr +="</div>";
ptr +="</body>";
ptr +="</html>";
return ptr;
}
+135
View File
@@ -0,0 +1,135 @@
// Load Wi-Fi library
#include <WiFi.h>
#include <Wire.h>
#include <Adafruit_BME280.h>
#include <Adafruit_Sensor.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI
// Replace with your network credentials
const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";
// Set web server port number to 80
WiFiServer server(80);
// Variable to store the HTTP request
String header;
// Current time
unsigned long currentTime = millis();
// Previous time
unsigned long previousTime = 0;
// Define timeout time in milliseconds (example: 2000ms = 2s)
const long timeoutTime = 2000;
void setup() {
Serial.begin(115200);
bool status;
// default settings
// (you can also pass in a Wire library object like &Wire2)
//status = bme.begin();
if (!bme.begin(0x76)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
// Connect to Wi-Fi network with SSID and password
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
// Print local IP address and start web server
Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
server.begin();
}
void loop(){
WiFiClient client = server.available(); // Listen for incoming clients
if (client) { // If a new client connects,
currentTime = millis();
previousTime = currentTime;
Serial.println("New Client."); // print a message out in the serial port
String currentLine = ""; // make a String to hold incoming data from the client
while (client.connected() && currentTime - previousTime <= timeoutTime) { // loop while the client's connected
currentTime = millis();
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
Serial.write(c); // print it out the serial monitor
header += c;
if (c == '\n') { // if the byte is a newline character
// if the current line is blank, you got two newline characters in a row.
// that's the end of the client HTTP request, so send a response:
if (currentLine.length() == 0) {
// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
// and a content-type so the client knows what's coming, then a blank line:
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println("Connection: close");
client.println();
// Display the HTML web page
client.println("<!DOCTYPE html><html>");
client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
client.println("<link rel=\"icon\" href=\"data:,\">");
// CSS to style the table
client.println("<style>body { text-align: center; font-family: \"Trebuchet MS\", Arial;}");
client.println("table { border-collapse: collapse; width:35%; margin-left:auto; margin-right:auto; }");
client.println("th { padding: 12px; background-color: #0043af; color: white; }");
client.println("tr { border: 1px solid #ddd; padding: 12px; }");
client.println("tr:hover { background-color: #bcbcbc; }");
client.println("td { border: none; padding: 12px; }");
client.println(".sensor { color:white; font-weight: bold; background-color: #bcbcbc; padding: 1px; }");
// Web Page Heading
client.println("</style></head><body><h1>ESP32 with BME280</h1>");
client.println("<table><tr><th>MEASUREMENT</th><th>VALUE</th></tr>");
client.println("<tr><td>Temp. Celsius</td><td><span class=\"sensor\">");
client.println(bme.readTemperature());
client.println(" *C</span></td></tr>");
client.println("<tr><td>Temp. Fahrenheit</td><td><span class=\"sensor\">");
client.println(1.8 * bme.readTemperature() + 32);
client.println(" *F</span></td></tr>");
client.println("<tr><td>Pressure</td><td><span class=\"sensor\">");
client.println(bme.readPressure() / 100.0F);
client.println(" hPa</span></td></tr>");
client.println("<tr><td>Approx. Altitude</td><td><span class=\"sensor\">");
client.println(bme.readAltitude(SEALEVELPRESSURE_HPA));
client.println(" m</span></td></tr>");
client.println("<tr><td>Humidity</td><td><span class=\"sensor\">");
client.println(bme.readHumidity());
client.println(" %</span></td></tr>");
client.println("</body></html>");
// The HTTP response ends with another blank line
client.println();
// Break out of the while loop
break;
} else { // if you got a newline, then clear currentLine
currentLine = "";
}
} else if (c != '\r') { // if you got anything else but a carriage return character,
currentLine += c; // add it to the end of the currentLine
}
}
}
// Clear the header variable
header = "";
// Close the connection
client.stop();
Serial.println("Client disconnected.");
Serial.println("");
}
}
+281
View File
@@ -0,0 +1,281 @@
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <HTTPClient.h>
#include <Update.h>
#include <ArduinoJson.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#pragma region BASIC
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme;
IPAddress localIp(192, 168, 0, 24); // IP dell' ESP32
const char* description = "ESP32 Temperature server"; // Description
#pragma endregion
#pragma region GLOBAL VARIABLES
hw_timer_t *wdt_temperature_zone = NULL; // Timer for single solenoid zone
int mustReset = 0;
static long wdt_survey_timeout = 600000; // Time in ms to trigger the watchdog (ten minutes) for solenoid zones
static bool wdt_survey_triggered = false; // Trigger for a single solenoid zone timer
static const char* ssid = "Melafonino di Claudio";
static const char* password = "1234567890";
static const IPAddress gateway(192, 168, 0, 1); //IP del gateway
static const IPAddress subnet(255, 255, 255, 0); // Subnet Mask
static const IPAddress primaryDNS(192, 168, 0, 1); // DNS
WebServer server(80);
WebServer otaServer(8080);
String macAddress = "";
HTTPClient http;
#pragma endregion
#pragma region WIFI
void handle_WiFi(){
if ( WiFi.status() != WL_CONNECTED )
{
WiFi.begin(ssid, password);
int WLcount = 0;
while (WiFi.status() != WL_CONNECTED && WLcount < 200 )
{
delay(100);
++WLcount;
}
mustReset++;
if(WiFi.status() != WL_CONNECTED && mustReset > 4)
{
ESP.restart();
}
}
else
{
mustReset = 0;
server.handleClient();
otaServer.handleClient();
}
}
#pragma endregion
#pragma region WEB SERVER OTA
void handleOtaRoot() {
otaServer.sendHeader("Connection", "close");
otaServer.send(200, "text/html", "<form name='loginForm'>"
"<table width='20%' bgcolor='A09F9F' align='center'>"
"<tr>"
"<td colspan=2>"
"<center><font size=4><b>ESP32 Login Page</b></font></center>"
"<br>"
"</td>"
"<br>"
"<br>"
"</tr>"
"<td>Username:</td>"
"<td><input type='text' size=25 name='userid'><br></td>"
"</tr>"
"<br>"
"<br>"
"<tr>"
"<td>Password:</td>"
"<td><input type='Password' size=25 name='pwd'><br></td>"
"<br>"
"<br>"
"</tr>"
"<tr>"
"<td><input type='submit' onclick='check(this.form)' value='Login'></td>"
"</tr>"
"</table>"
"</form>"
"<script>"
"function check(form)"
"{"
"if(form.userid.value=='Fin3' && form.pwd.value==''passwordDaImpostarePerSicurezza)"
"{"
"window.open('/serverIndex')"
"}"
"else"
"{"
" alert('Error Password or Username')/*displays error message*/"
"}"
"}"
"</script>");
}
void handleOtaServerIndex() {
otaServer.sendHeader("Connection", "close");
otaServer.send(200, "text/html", "<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>"
"<form method='POST' action='#' enctype='multipart/form-data' id='upload_form'>"
"<input type='file' name='update'>"
"<input type='submit' value='Update'>"
"</form>"
"<div id='prg'>progress: 0%</div>"
"<script>"
"$('form').submit(function(e){"
"e.preventDefault();"
"var form = $('#upload_form')[0];"
"var data = new FormData(form);"
" $.ajax({"
"url: '/update',"
"type: 'POST',"
"data: data,"
"contentType: false,"
"processData:false,"
"xhr: function() {"
"var xhr = new window.XMLHttpRequest();"
"xhr.upload.addEventListener('progress', function(evt) {"
"if (evt.lengthComputable) {"
"var per = evt.loaded / evt.total;"
"$('#prg').html('progress: ' + Math.round(per*100) + '%');"
"}"
"}, false);"
"return xhr;"
"},"
"success:function(d, s) {"
"console.log('success!')"
"},"
"error: function (a, b, c) {"
"}"
"});"
"});"
"</script>");
}
void handleOtaUpdate() {
otaServer.sendHeader("Connection", "close");
otaServer.send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK");
ESP.restart();
}
void otaDoUpdate() {
HTTPUpload& upload = otaServer.upload();
if (upload.status == UPLOAD_FILE_START) {
Serial.printf("Update: %s\n", upload.filename.c_str());
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_WRITE) {
/* flashing firmware to ESP*/
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_END) {
if (Update.end(true)) { //true to set the size to the current progress
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
} else {
Update.printError(Serial);
}
}
}
#pragma endregion
void handle_SurveyLoop(){
// Handling temperature zone timer trigger
if(wdt_survey_triggered == true)
{
// execute code when timer trigger
// put your code here
}
}
void handle_GetLights() {
/*DynamicJsonDocument doc(400);
JsonObject light1obj = doc.createNestedObject();
light1obj["LightId"] = light1_Id;
light1obj["Enabled"] = light1_enabled;
JsonObject light2obj = doc.createNestedObject();
light2obj["LightId"] = light2_Id;
light2obj["Enabled"] = light2_enabled;
JsonObject light3obj = doc.createNestedObject();
light3obj["LightId"] = light3_Id;
light3obj["Enabled"] = light3_enabled;
String jsonData = "";
serializeJson(doc, jsonData);
server.send(200, "text/plain", jsonData);*/
server.send(200, "text/plain", "Funziona!!!!");
}
void setup(void) {
Serial.begin(115200);
if (!WiFi.config(localIp, gateway, subnet, primaryDNS)) {
Serial.println("STA Failed to configure");
}
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.println("");
wdt_temperature_zone = timerBegin(0, 8000, true); //timer 0, div 80
//timerAttachInterrupt(wdt_temperature_zone, &onWdTimerElapsed_Zone, true);
timerAlarmWrite(wdt_temperature_zone, wdt_survey_timeout * 10, true);
timerAlarmEnable(wdt_temperature_zone);
Serial.println("");
Serial.print("ESP Board MAC Address: ");
macAddress = WiFi.macAddress();
Serial.println(macAddress);
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
//server.on("/", handleRoot);
//server.on("/setTemperature", HTTP_POST, handle_SetTemperature);
//server.on("/getTemperature", HTTP_GET, handle_GetTemperature);
//server.on("/setLights", HTTP_POST, handle_SetLights);
server.on("/getLights", HTTP_GET, handle_GetLights);
//server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP 80 server started");
otaServer.on("/", HTTP_GET, handleOtaRoot);
otaServer.on("/serverIndex", HTTP_GET, handleOtaServerIndex);
otaServer.on("/update", HTTP_POST, handleOtaUpdate, otaDoUpdate);
otaServer.begin();
Serial.println("HTTP 8080 server started");
Serial.println(localIp);
}
void loop(void) {
handle_WiFi();
handle_SurveyLoop();
}
#pragma region Timer Functions
void IRAM_ATTR onWdTimerElapsed_Zone() {
wdt_survey_triggered = true;
}
#pragma endregion
+162
View File
@@ -0,0 +1,162 @@
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#include <Update.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
const char* host = "esp32";
const char* ssid = "Melafonino di Claudio";
const char* password = "1234567890";
Adafruit_BME280 bme;
WebServer server(80);
/* Style */
String style =
"<style>#file-input,input{width:100%;height:44px;border-radius:4px;margin:10px auto;font-size:15px}"
"input{background:#f1f1f1;border:0;padding:0 15px}body{background:#3498db;font-family:sans-serif;font-size:14px;color:#777}"
"#file-input{padding:0;border:1px solid #ddd;line-height:44px;text-align:left;display:block;cursor:pointer}"
"#bar,#prgbar{background-color:#f1f1f1;border-radius:10px}#bar{background-color:#3498db;width:0%;height:10px}"
"form{background:#fff;max-width:258px;margin:75px auto;padding:30px;border-radius:5px;text-align:center}"
".btn{background:#3498db;color:#fff;cursor:pointer}</style>";
/* Login page */
String loginIndex =
"<form name=loginForm>"
"<h1>ESP32 Login</h1>"
"<input name=userid placeholder='User ID'> "
"<input name=pwd placeholder=Password type=Password> "
"<input type=submit onclick=check(this.form) class=btn value=Login></form>"
"<script>"
"function check(form) {"
"if(form.userid.value=='admin' && form.pwd.value=='admin')"
"{window.open('/serverIndex')}"
"else"
"{alert('Error Password or Username')}"
"}"
"</script>" + style;
/* Server Index Page */
String serverIndex =
"<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>"
"<form method='POST' action='#' enctype='multipart/form-data' id='upload_form'>"
"<input type='file' name='update' id='file' onchange='sub(this)' style=display:none>"
"<label id='file-input' for='file'> Choose file...</label>"
"<input type='submit' class=btn value='Update'>"
"<br><br>"
"<div id='prg'></div>"
"<br><div id='prgbar'><div id='bar'></div></div><br></form>"
"<script>"
"function sub(obj){"
"var fileName = obj.value.split('\\\\');"
"document.getElementById('file-input').innerHTML = ' '+ fileName[fileName.length-1];"
"};"
"$('form').submit(function(e){"
"e.preventDefault();"
"var form = $('#upload_form')[0];"
"var data = new FormData(form);"
"$.ajax({"
"url: '/update',"
"type: 'POST',"
"data: data,"
"contentType: false,"
"processData:false,"
"xhr: function() {"
"var xhr = new window.XMLHttpRequest();"
"xhr.upload.addEventListener('progress', function(evt) {"
"if (evt.lengthComputable) {"
"var per = evt.loaded / evt.total;"
"$('#prg').html('progress: ' + Math.round(per*100) + '%');"
"$('#bar').css('width',Math.round(per*100) + '%');"
"}"
"}, false);"
"return xhr;"
"},"
"success:function(d, s) {"
"console.log('success!') "
"},"
"error: function (a, b, c) {"
"}"
"});"
"});"
"</script>" + style;
/* setup function */
void setup(void) {
Serial.begin(115200);
// Connect to WiFi network
WiFi.begin(ssid, password);
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
/*use mdns for host name resolution*/
if (!MDNS.begin(host)) { //http://esp32.local
Serial.println("Error setting up MDNS responder!");
while (1) {
delay(1000);
}
}
Serial.println("mDNS responder started");
/*return index page which is stored in serverIndex */
server.on("/", HTTP_GET, []() {
server.sendHeader("Connection", "close");
server.send(200, "text/html", loginIndex);
});
server.on("/serverIndex", HTTP_GET, []() {
server.sendHeader("Connection", "close");
server.send(200, "text/html", serverIndex);
});
server.on("/bme", HTTP_GET, []() {
server.sendHeader("Connection", "close");
server.send(200, "text/plain", "work!!");
});
/*handling uploading firmware file */
server.on("/update", HTTP_POST, []() {
server.sendHeader("Connection", "close");
server.send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK");
ESP.restart();
}, []() {
HTTPUpload& upload = server.upload();
if (upload.status == UPLOAD_FILE_START) {
Serial.printf("Update: %s\n", upload.filename.c_str());
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_WRITE) {
/* flashing firmware to ESP*/
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_END) {
if (Update.end(true)) { //true to set the size to the current progress
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
} else {
Update.printError(Serial);
}
}
});
server.begin();
}
void loop(void) {
server.handleClient();
delay(1);
}
+321
View File
@@ -0,0 +1,321 @@
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <HTTPClient.h>
#include <Update.h>
#include <ArduinoJson.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include <LiquidCrystal_I2C.h>
#pragma region GLOBAL VARIABLES
int mustReset = 0;
static long wdt_survey_timeout = 10000; // Time in s to trigger the watchdog for solenoid zones
static bool wdt_survey_triggered = false; // Trigger for a single solenoid zone timer
const char* description = "ESP32 Temperature server"; // Description
static const char* ssid = "XXX"; // SSID
static const char* password = "XXX"; // Password Wifi
static const IPAddress gateway(172, 16, 83, 254); // IP del gateway
static const IPAddress subnet(255, 255, 255, 0); // Subnet Mask
static const IPAddress primaryDNS(172, 16, 94, 95); // DNS
hw_timer_t *wdt_survey = NULL; // Timer for single solenoid zone
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;
WebServer server(80);
WebServer otaServer(8080);
IPAddress localIp(172, 16, 83, 12); // IP dell' ESP32
String hostname = "XXX"; // Hostname
String macAddress = "";
HTTPClient http;
LiquidCrystal_I2C lcd(0x27, 16, 2);
Adafruit_BME280 bme; // BME variable
float Temperature;
float Humidity;
float Pressure;
#pragma endregion
#pragma region WIFI
void handle_WiFi(){
if ( WiFi.status() != WL_CONNECTED )
{
WiFi.begin(ssid, password);
int WLcount = 0;
while (WiFi.status() != WL_CONNECTED && WLcount < 200 )
{
delay(100);
++WLcount;
}
mustReset++;
if(WiFi.status() != WL_CONNECTED && mustReset > 4)
{
ESP.restart();
}
}
else
{
mustReset = 0;
server.handleClient();
otaServer.handleClient();
}
}
#pragma endregion
#pragma region WEB SERVER OTA
void handleOtaRoot() {
otaServer.sendHeader("Connection", "close");
otaServer.send(200, "text/html", "<form name='loginForm'>"
"<table width='20%' bgcolor='A09F9F' align='center'>"
"<tr>"
"<td colspan=2>"
"<center><font size=4><b>ESP32 Login Page</b></font></center>"
"<br>"
"</td>"
"<br>"
"<br>"
"</tr>"
"<td>Username:</td>"
"<td><input type='text' size=25 name='userid'><br></td>"
"</tr>"
"<br>"
"<br>"
"<tr>"
"<td>Password:</td>"
"<td><input type='Password' size=25 name='pwd'><br></td>"
"<br>"
"<br>"
"</tr>"
"<tr>"
"<td><input type='submit' onclick='check(this.form)' value='Login'></td>"
"</tr>"
"</table>"
"</form>"
"<script>"
"function check(form)"
"{"
"if(form.userid.value=='paladmin' && form.pwd.value==''passwordDaImpostarePerSicurezza)"
"{"
"window.open('/serverIndex')"
"}"
"else"
"{"
" alert('Error Password or Username')/*displays error message*/"
"}"
"}"
"</script>");
}
void handleOtaServerIndex() {
otaServer.sendHeader("Connection", "close");
otaServer.send(200, "text/html", "<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>"
"<form method='POST' action='#' enctype='multipart/form-data' id='upload_form'>"
"<input type='file' name='update'>"
"<input type='submit' value='Update'>"
"</form>"
"<div id='prg'>progress: 0%</div>"
"<script>"
"$('form').submit(function(e){"
"e.preventDefault();"
"var form = $('#upload_form')[0];"
"var data = new FormData(form);"
" $.ajax({"
"url: '/update',"
"type: 'POST',"
"data: data,"
"contentType: false,"
"processData:false,"
"xhr: function() {"
"var xhr = new window.XMLHttpRequest();"
"xhr.upload.addEventListener('progress', function(evt) {"
"if (evt.lengthComputable) {"
"var per = evt.loaded / evt.total;"
"$('#prg').html('progress: ' + Math.round(per*100) + '%');"
"}"
"}, false);"
"return xhr;"
"},"
"success:function(d, s) {"
"console.log('success!')"
"},"
"error: function (a, b, c) {"
"}"
"});"
"});"
"</script>");
}
void handleOtaUpdate() {
otaServer.sendHeader("Connection", "close");
otaServer.send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK");
ESP.restart();
}
void otaDoUpdate() {
HTTPUpload& upload = otaServer.upload();
if (upload.status == UPLOAD_FILE_START) {
Serial.printf("Update: %s\n", upload.filename.c_str());
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_WRITE) {
/* flashing firmware to ESP*/
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_END) {
if (Update.end(true)) { //true to set the size to the current progress
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
} else {
Update.printError(Serial);
}
}
}
#pragma endregion
void handle_SurveyLoop(){
// Handling temperature zone timer trigger
if(wdt_survey_triggered == true)
{
portENTER_CRITICAL(&timerMux);
wdt_survey_triggered = false;
portEXIT_CRITICAL(&timerMux);
//Serial.println("Zio mestre!"); // EasterEgg
Temperature = bme.readTemperature();
Humidity = bme.readHumidity();
Pressure = bme.readPressure();
}
}
void handleRoot() {
server.send(200, "text/plain", hostname + " - Climavey");
}
void handle_GetValue() {
DynamicJsonDocument doc(400);
JsonObject obj = doc.createNestedObject("Values");
obj["Temperature"] = Temperature; // Temperature
obj["Humidity"] = Humidity; // Humidity
obj["Pressure"] = Pressure; // Pressure
obj["macAddress"] = macAddress; // macAddress
String jsonData = "";
serializeJson(doc, jsonData);
server.send(200, "text/plain", jsonData);
//server.send(200, "text/plain", "{ \"Values\": { \"Temperature\": " + Temperature + ", \"Humidity\": " + Humidity + ", \"Pressure\": " + Pressure + " } }" );
/*server.send(200, "text/plain",
String(Temperature) + ";"
+ String(Humidity) + ";"
+ String(Pressure) + ";"
+ macAddress
);*/
}
void handleNotFound(){
server.send(404, "text/plain", "404: Not found");
}
#pragma region Timer Functions
void IRAM_ATTR onWdTimerElapsed() {
portENTER_CRITICAL_ISR(&timerMux);
wdt_survey_triggered = true;
portEXIT_CRITICAL_ISR(&timerMux);
}
#pragma endregion
#pragma region Setup
void bmeSetup() {
bool status = bme.begin(0x76);
if (!status) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
}
}
void webServer() {
if (!WiFi.config(localIp, gateway, subnet, primaryDNS)) {
Serial.println("STA Failed to configure");
}
WiFi.mode(WIFI_STA);
WiFi.setHostname(hostname.c_str());
WiFi.begin(ssid, password);
Serial.println("");
wdt_survey = timerBegin(0, 80, true); //timer 0, div 80
timerAttachInterrupt(wdt_survey, &onWdTimerElapsed, true);
timerAlarmWrite(wdt_survey, wdt_survey_timeout * 1000, true);
timerAlarmEnable(wdt_survey);
Serial.println("");
Serial.print("ESP Board MAC Address: ");
macAddress = WiFi.macAddress();
Serial.println(macAddress);
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
server.on("/", HTTP_GET, handleRoot);
server.on("/getValue", HTTP_GET, handle_GetValue);
server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP 80 server started");
otaServer.on("/", HTTP_GET, handleOtaRoot);
otaServer.on("/serverIndex", HTTP_GET, handleOtaServerIndex);
otaServer.on("/update", HTTP_POST, handleOtaUpdate, otaDoUpdate);
otaServer.begin();
Serial.println("HTTP 8080 server started");
}
void lcdInitilizer(){
lcd.init();
lcd.backlight();
}
#pragma endregion
void setup(void) {
Serial.begin(9600);
bmeSetup();
lcdInitilizer();
webServer();
}
void loop(void) {
handle_WiFi();
handle_SurveyLoop();
lcd.setCursor(0, 0);
lcd.print("Hello, World!");
}
BIN
View File
Binary file not shown.
+25
View File
@@ -0,0 +1,25 @@
// print a msg Hello word
//#include <iostream>
//
//int main(){
// std::cout << "Hello World!";
// return 0;
//}
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
for (const string& word : msg)
{
cout << word << " ";
}
cout << endl;
}
BIN
View File
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
#include <iostream>
using namespace std;
int main()
{
cout << "- Sum of Two integers -" << endl;
int fistNumber, secondNumber, sumOfTwoNumbers;
cout << "Int1: ";
cin >> fistNumber;
cout << "Int2: ";
cin >> secondNumber;
// sum of two numbers in stored in variable sumOfTwoNumbers
sumOfTwoNumbers = fistNumber + secondNumber;
// Print sum
cout << fistNumber << " + " << secondNumber << " = " << sumOfTwoNumbers << endl;
return 0;
}
BIN
View File
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
#include <iostream>
using namespace std;
int main()
{
cout << "- Quotient & Remainder -" << endl;
int divisor, dividend, quotient, remainder;
cout << "Enter dividend: ";
cin >> dividend;
cout << "Enter divisor: ";
cin >> divisor;
quotient = dividend / divisor;
remainder = dividend % divisor;
cout << "Quotient = " << quotient << endl;
cout << "Remainder = " << remainder << endl;
return 0;
}
BIN
View File
Binary file not shown.
+30
View File
@@ -0,0 +1,30 @@
// C++ Swap Number
#include <iostream>
using namespace std;
int main()
{
int a = 5, b = 10, c = 5, d = 10, temp;
cout << "Swap Numbers (Using Temporary Variable)" << "\nBefore swapping." << endl;
cout << "a = " << a << ", b = " << b << endl;
temp = a;
a = b;
b = temp;
cout << "\nAfter swapping." << endl;
cout << "a = " << a << ", b = " << b << endl;
cout << "\nSwap Numbers Without Using Temporary Variable" << "\nBefore swapping." << endl;
cout << "a = " << c << ", b = " << d << endl;
c = c + d;
d = c - d;
c = c - d;
cout << "\nAfter swapping." << endl;
cout << "a = " << c << ", b = " << d << endl;
return 0;
}
BIN
View File
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
#include <iostream>
using namespace std;
int main() {
char c;
cout << "Enter a character: ";
cin >> c;
cout << "ASCII Value of " << c << " is " << int(c);
return 0;
}
+235
View File
@@ -0,0 +1,235 @@
#include <esp_now.h>
#include <WiFI.h>
#include <SimpleDHT.h>
#include <WiFiUdp.h>
#include <Arduino_SNMP.h>
#include <SSD1306.h>
#include <Fs.h>
#include <SPIFS.h>
#define DHTPIN 4
#define INTERVAL 100
#define ESPNOW_CHANNEL 1
#define CONFIG_PATH "/conf.bin"
#define SSID "SSID"
#define PASSWORD "12345678"
#define IP "192.168.0.134"
WiFiUDP udp;
SNMPAgent snmp = SNMPAgent("public"); //Inicia o SMMPAgent
//Referências para o SNMP
char* strHumidity;
char* strTemperature;
//Valores caso nada esteja salvo no arquivo de configuração
int maxHumidity = 65;
int minHumidity = 55;
//parametros: address,SDA,SCL
SSD1306 display(0x3c, 21, 22); //construtor do objeto que controlaremos o display
uint8_t slaveMacAddress[] = {0x1A,0xFE,0x34,0xA5,0x90,0x69};
// uint8_t slaveMacAddress[] = {0x18,0xFE,0x34,0xA5,0x90,0x69};
esp_now_peer_info_t slave;
//Objeto que realiza a leitura da umidade
SimpleDHT22 dht;
//Variável para guardarmos o valor da umidade
float humidity = 0;
//Variável para guardarmos o valor da temperatura
float temperature = 0;
void setup() {
Serial.begin(115200);
strHumidity = (char*)malloc(6);
strTemperature = (char*)malloc(6);
memset(strHumidity, 0, 6);
memset(strTemperature, 0, 6);
if(SPIFFS.begin(true))
{
loadConfig();
}
else
{
//Se não conseguiu inicializar
Serial.println("SPIFFS Mount Failed");
}
setupWiFi();
setupSNMP();
setupDisplay();
setupESPNow();
setupSlave();
}
void loop() {
readSensor();
verifySNMP();
showOnDisplay();
verifyHumidity();
delay(INTERVAL);
}
void setupWiFi()
{
WiFi.disconnect();
WiFi.mode(WIFI_STA);
WiFi.begin(SSID, PASSWORD);
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(SSID);
//Configura o IP
IPAddress ipAddress;
ipAddress.fromString(IP);
WiFi.config(ipAddress, WiFi.gatewayIP(), WiFi.subnetMask());
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
void setupSNMP()
{
//Inicializa o snmp
snmp.setUDP(&udp);
snmp.begin();
//Adiciona o OID para umidade (apenas leitura)
snmp.addStringHandler(".1.3.6.1.4.1.12345.0", &strHumidity, false);
//Adiciona o OID para temperatura (apenas leitura)
snmp.addStringHandler(".1.3.6.1.4.1.12345.1", &strTemperature, false);
//Adiciona o OID para umidade máxima (leitura e escrita)
snmp.addIntegerHandler(".1.3.6.1.4.1.12345.2", &maxHumidity, true);
//Adiciona o OID para umidade mínima (leitura e escrita)
snmp.addIntegerHandler(".1.3.6.1.4.1.12345.3", &minHumidity, true);
}
void setupDisplay(){
display.init(); //inicializa o display
display.flipScreenVertically();
display.setFont(ArialMT_Plain_10); //configura a fonte
}
void setupESPNow() {
//Se a inicialização foi bem sucedida
if (esp_now_init() == ESP_OK) {
Serial.println("ESPNow Init Success");
}
//Se houve erro na inicialização
else {
Serial.println("ESPNow Init Failed");
ESP.restart();
}
}
void verifySNMP()
{
//Deve ser sempre chamado durante o loop principal
snmp.loop();
//Se aconteceu alteração de um dos valores
if(snmp.setOccurred)
{
//Salva as os valores
saveConfig();
//Reseta a flag de alteração
snmp.resetSetOccurred();
}
}
//Verifica se a umidade está fora dos limites e informa ao ESP8266
//se o relê deve ficar ligado ou desligado
void verifyHumidity(){
if(humidity > maxHumidity)
{
sendRelayStatus(LOW);
}
else if(humidity < minHumidity)
{
sendRelayStatus(HIGH);
}
}
//Função responsável por realizar a leitura
//da umidade e temperatura
void readSensor(){
float h, t;
int status = dht.read2(DHTPIN, &t, &h, NULL);
if (status == SimpleDHTErrSuccess) {
humidity = h;
temperature = t;
//Transforma os dados em string
String strH = String(humidity);
strH.toCharArray(strHumidity, strH.length());
String strT = String(temperature);
strT.toCharArray(strTemperature, strT.length());
}
}
//Mostra a umidade no display
void showOnDisplay(){
//apaga o conteúdo do display
display.clear();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_16);
display.drawString(0, 0, "Humidity: ");
display.drawString(70, 0, String(humidity));
display.drawString(0, 30, "Temperat: ");
display.drawString(75, 30, String(temperature));
display.display(); //mostra o conteúdo na tela
}
void saveConfig()
{
Serial.println("saveConfig");
//Abre o arquivo para escrita
File file = SPIFFS.open(CONFIG_PATH, FILE_WRITE);
//Se não conseguiu abrir/criar o arquivo
if(!file)
{
Serial.println("Failed to open file for writing");
return;
}
file.seek(0);
file.write((uint8_t*)&maxHumidity, sizeof(maxHumidity));
file.write((uint8_t*)&minHumidity, sizeof(minHumidity));
//Fecha o arquivo
file.close();
}
void loadConfig()
{
Serial.println("loadConfig");
File file = SPIFFS.open(CONFIG_PATH, FILE_READ);
//Se arquivo não existe
if(!file)
{
//Na primeira vez o arquivo ainda não foi criado
Serial.println("Failed to open file for reading");
return;
}
file.read((uint8_t*)&maxHumidity, sizeof(maxHumidity));
file.read((uint8_t*)&minHumidity, sizeof(minHumidity));
//Fecha o arquivo
file.close();
}
+93
View File
@@ -0,0 +1,93 @@
CREATE TABLE paliot.V0601A650016470_ingestion_data (
timestamp TIMESTAMPTZ NOT NULL,
machine_sensors_id INT REFERENCES paliot.machine_sensors(machine_sensors_id),
acc_x FLOAT, acc_y FLOAT, acc_z FLOAT, -- Questi dati andrebbero messi nel campo "external_sensor_data", così da gestire tutto come json
gyr_x FLOAT, gyr_y FLOAT, gyr_z FLOAT, -- idem come sopra
external_sensor_data JSONB,
PRIMARY KEY (timestamp, machine_sensors_id)
);
SELECT create_hypertable('paliot.V0601A650016470_ingestion_data', 'timestamp');
SELECT set_chunk_time_interval('paliot.V0601A650016470_ingestion_data', INTERVAL '24 hours');
-- Indexes
CREATE INDEX ON paliot.V0601A650016470_ingestion_data (machine_sensors_id);
CREATE INDEX ON paliot.V0601A650016470_ingestion_data (timestamp DESC);
-- Add compression policy (compress data older than 7 days)
ALTER TABLE paliot.V0601A650016470_ingestion_data SET (
timescaledb.compress,
timescaledb.compress_segmentby = 'machine_sensors_id',
timescaledb.compress_orderby = 'timestamp'
);
SELECT add_compression_policy('paliot.V0601A650016470_ingestion_data', INTERVAL '7 days');
-- Retention policy
SELECT add_retention_policy('paliot.V0601A650016470_ingestion_data', INTERVAL '1 month');
COMMENT ON TABLE paliot.V0601A650016470_ingestion_data IS 'Ingested raw sensor data from V0601A650016470';
--
CREATE TABLE paliot.L0601B300083712_ingestion_data (
timestamp TIMESTAMPTZ NOT NULL,
machine_sensors_id INT REFERENCES paliot.machine_sensors(machine_sensors_id),
acc_x FLOAT, acc_y FLOAT, acc_z FLOAT, -- Questi dati andrebbero messi nel campo "external_sensor_data", così da gestire tutto come json
gyr_x FLOAT, gyr_y FLOAT, gyr_z FLOAT, -- idem come sopra
external_sensor_data JSONB,
PRIMARY KEY (timestamp, machine_sensors_id)
);
SELECT create_hypertable('paliot.L0601B300083712_ingestion_data', 'timestamp');
SELECT set_chunk_time_interval('paliot.L0601B300083712_ingestion_data', INTERVAL '24 hours');
-- Indexes
CREATE INDEX ON paliot.L0601B300083712_ingestion_data (machine_sensors_id);
CREATE INDEX ON paliot.L0601B300083712_ingestion_data (timestamp DESC);
-- Add compression policy (compress data older than 7 days)
ALTER TABLE paliot.L0601B300083712_ingestion_data SET (
timescaledb.compress,
timescaledb.compress_segmentby = 'machine_sensors_id',
timescaledb.compress_orderby = 'timestamp'
);
SELECT add_compression_policy('paliot.L0601B300083712_ingestion_data', INTERVAL '7 days');
-- Retention policy
SELECT add_retention_policy('paliot.L0601B300083712_ingestion_data', INTERVAL '1 month');
COMMENT ON TABLE paliot.L0601B300083712_ingestion_data IS 'Ingested raw sensor data from L0601B300083712';
--
CREATE TABLE paliot.L0601B300029398_ingestion_data (
timestamp TIMESTAMPTZ NOT NULL,
machine_sensors_id INT REFERENCES paliot.machine_sensors(machine_sensors_id),
acc_x FLOAT, acc_y FLOAT, acc_z FLOAT, -- Questi dati andrebbero messi nel campo "external_sensor_data", così da gestire tutto come json
gyr_x FLOAT, gyr_y FLOAT, gyr_z FLOAT, -- idem come sopra
external_sensor_data JSONB,
PRIMARY KEY (timestamp, machine_sensors_id)
);
SELECT create_hypertable('paliot.L0601B300029398_ingestion_data', 'timestamp');
SELECT set_chunk_time_interval('paliot.L0601B300029398_ingestion_data', INTERVAL '24 hours');
-- Indexes
CREATE INDEX ON paliot.L0601B300029398_ingestion_data (machine_sensors_id);
CREATE INDEX ON paliot.L0601B300029398_ingestion_data (timestamp DESC);
-- Add compression policy (compress data older than 7 days)
ALTER TABLE paliot.L0601B300029398_ingestion_data SET (
timescaledb.compress,
timescaledb.compress_segmentby = 'machine_sensors_id',
timescaledb.compress_orderby = 'timestamp'
);
SELECT add_compression_policy('paliot.L0601B300029398_ingestion_data', INTERVAL '7 days');
-- Retention policy
SELECT add_retention_policy('paliot.L0601B300029398_ingestion_data', INTERVAL '1 month');
COMMENT ON TABLE paliot.L0601B300029398_ingestion_data IS 'Ingested raw sensor data from L0601B300029398';
File diff suppressed because one or more lines are too long
+12
View File
@@ -0,0 +1,12 @@
Install
nano docker-composer.yml
docker compose up -d
Dev notes
To update, simply within docker-compose.yml set the image to "ghcr.io/thilojaeggi/wingetty:stable"
and run docker compose pull and then docker compose up -d
Prob. replace off docker-compose anche re run docker compose
+53
View File
@@ -0,0 +1,53 @@
# From github
# https://github.com/thilojaeggi/WinGetty/blob/main/docker-compose.yml
version: '3'
services:
wingetty:
container_name: wingetty
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/thilojaeggi/wingetty:stable
ports:
- 8080:8080
volumes:
- instance_volume:/app/instance # This is where the database will be stored
- packages_volume:/app/app/packages # This is where the packages will be stored
environment:
- WINGETTY_SQLALCHEMY_DATABASE_URI="sqlite:///database.db" # You can use any database URI supported by SQLAlchemy, so you can use MySQL, PostgreSQL, etc.
- WINGETTY_SECRET_KEY="secret" # Change this to a random string
- WINGETTY_ENABLE_REGISTRATION=0 # Enable open registration (0 = disabled, 1 = enabled)
- WINGETTY_REPO_NAME="WinGetty" # You can change this to whatever you want
- LOG_LEVEL=INFO # Change this to DEBUG if you want to see more logs
- TZ=Europe/Paris # Change this to your timezone
volumes:
instance_volume:
packages_volume:
# Tested
version: '3'
services:
wingetty:
container_name: wingetty
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/thilojaeggi/wingetty:stable
ports:
- 8080:8080
volumes:
- instance_volume:/app/instance # This is where the database will be stored
- packages_volume:/app/app/packages # This is where the packages will be stored
environment:
- WINGETTY_SQLALCHEMY_DATABASE_URI="sqlite:///database.db" # You can use any database URI supported by SQLAlchemy, so you can use MySQL, PostgreSQL, etc.
- WINGETTY_SECRET_KEY="secret" # Change this to a random string
- WINGETTY_ENABLE_REGISTRATION=0 # Enable open registration (0 = disabled, 1 = enabled)
- WINGETTY_REPO_NAME="PAL-SFTW-Repo" # You can change this to whatever you want
- LOG_LEVEL=INFO # Change this to DEBUG if you want to see more logs
- TZ=Europe/Rome # Change this to your timezone
volumes:
instance_volume:
packages_volume:
+17191
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -0,0 +1,3 @@
another-http-check
rpmbuild/*
*.rpm
+2
View File
@@ -0,0 +1,2 @@
%_topdir /app/rpmbuild
%_tmppath /app/rpmbuild/tmp
+31
View File
@@ -0,0 +1,31 @@
FROM golang:1.13-alpine
ARG APP_GID
ARG APP_USER
RUN apk add gcc g++ ca-certificates git curl vim rpm
RUN adduser -D -u ${APP_GID} -g ${APP_USER} ${APP_USER}
ADD .rpmmacros /home/${APP_USER}
USER ${APP_USER}
RUN curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
RUN echo "call plug#begin('~/.vim/plugged')" > ~/.vimrc
RUN echo "Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }" >> ~/.vimrc
RUN echo "call plug#end()" >> ~/.vimrc
RUN echo "set tabstop=4" >> ~/.vimrc
RUN echo "set expandtab" >> ~/.vimrc
RUN echo "set shiftwidth=4" >> ~/.vimrc
RUN echo "set t_Co=256" >> ~/.vimrc
RUN echo "set number" >> ~/.vimrc
RUN vim -E -s -u ~/.vimrc +PlugInstall +qall
ENV GO111MODULE=on
WORKDIR /app
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2018 wf tech, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+39
View File
@@ -0,0 +1,39 @@
CWD=$(shell pwd)
APP_GID=$(shell id --group)
APP_USER=${USER}
CONTAINER_NAME=another-http-check
BIN_NAME=another-http-check
RPM_SPEC_NAME=another-http-check.spec
GO_VERSION=$(shell grep FROM Dockerfile | awk '{ print $$2 }' | sed 's/[a-z:-]//g' | xargs echo -n)
APP_VERSION=$(shell date +"%Y%m%d")
LDFLAGS=-ldflags "-X main.goVersion=$(GO_VERSION) -X main.appVersion=$(APP_VERSION)"
default: binary
test: build
docker run -v $(CWD):/app -it --rm $(CONTAINER_NAME) \
go test -v $(LDFLAGS)
binary: build clean
docker run -v $(CWD):/app -it --rm $(CONTAINER_NAME) \
go build $(LDFLAGS) \
-tags netgo -installsuffix netgo -o $(BIN_NAME)
rpm: binary
rm -rf rpmbuild
docker run -v $(CWD):/app -it --rm $(CONTAINER_NAME) \
rpmbuild -ba $(RPM_SPEC_NAME)
cp rpmbuild/RPMS/x86_64/*.rpm .
runshell: build
docker run -v $(CWD):/app -it --rm $(CONTAINER_NAME) sh
clean:
rm -f $(BIN_NAME)
upgrade-dependencies: build
docker run -v $(CWD):/app -it --rm $(CONTAINER_NAME) go get -u
build:
docker build --build-arg APP_GID=$(APP_GID) --build-arg=APP_USER=$(APP_USER) \
-t $(CONTAINER_NAME) .
+48
View File
@@ -0,0 +1,48 @@
# another-http-check
This is replacement for original Nagios `check_http` check plugin. The original plugin contains some bugs and
provides sometimes misleading error messages.
## Usage
another-http-check [OPTIONS]
| Application Options: | |
|----------------------|---------------------------------------------------------------------------------|
| `-H=` | Host ex. google.com |
| `-I=` | IPv4 address ex. 8.8.4.4 |
| `-u`, `--uri=` | URI to check (default: /) |
| `-p=` | Port ex. 80 for HTTP 443 for HTTPS (default: 80) |
| `-S`, `--tls` | Use HTTPS |
| `-t`, `--timeout=` | Timeout (default: 30) |
| `--auth-basic` | Use HTTP basis |
| `--auth-ntlm` | Use NTLM auth |
| `-a`, `--auth=` | provide password to authenticate. example `user:password` |
| `-e`, `--expect=` | Expected HTTP code (default: `200)` |
| `-s`, `--string=` | Search for given string in response body |
| `-C=` | Check SSL cert expiration |
| `-k`, `--insecure` | Controls whether a client verifies the server's certificate chain and host name |
| | |
| `-v`, `--verbose` | Verbose mode |
| `--guess-auth` | Guess auth type (none, basic, NTLM). Generates two requests instead of one |
| `-h`, `--help` | Show this help message |
## Build requirements
- Docker
- make
## How to compile
- `make` creates statically linked binary
- `make test` runs tests
- `make runshell` opens shell inside Docker container (`vim` setup for hacking included)
- `make rpm` - creates RPM package
## Licence
Apache 2
@@ -0,0 +1,24 @@
Name: another-http-check
Version: %(date +%%Y%%m%%d)
Release: 1
Summary: HTTP check for Nagios/Icinga
License: APACHE 2
%description
HTTP check for Nagios/Icinga
%prep
# pass
%build
# pass
%install
mkdir -p %{buildroot}/usr/lib64/nagios/plugins/
install -m 755 /app/another-http-check %{buildroot}/usr/lib64/nagios/plugins/another-http-check
%files
/usr/lib64/nagios/plugins/another-http-check
%changelog
# pass
+366
View File
@@ -0,0 +1,366 @@
package main
import (
"bytes"
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net"
"net/http"
"strconv"
"strings"
"time"
"github.com/Azure/go-ntlmssp"
)
const (
// Authentication types
AUTH_NONE = 0
AUTH_BASIC = 1
AUTH_NTLM = 2
// Exit codes
EXIT_OK = 0
EXIT_WARNING = 1
EXIT_CRITICAL = 2
EXIT_UNKNOWN = 3
)
// Authentication
type Authentication struct {
Type int
User string
Password string
}
type SSLCheck struct {
Run bool
DaysWarning int
DaysCritical int
}
type ClientCert struct {
ClientCertFile string
PrivateKeyFile string
}
// Request
type Request struct {
Scheme string
Host string
IPAddress string
TLS bool
Port int
URI string
Timeout int
Verbose bool
SSLNoVerify bool
Authentication Authentication
FollowRedirects bool
WarningTimeout int
CriticalTimeout int
NoSNI bool
ClientCert ClientCert
TLSRenegotiation bool
}
// Check params
type Expected struct {
StatusCodes []int
BodyText string
SSLCheck SSLCheck
}
// Lookup map for auth type names
var authLookup = map[int]string{
AUTH_NONE: "none",
AUTH_BASIC: "basic auth",
AUTH_NTLM: "NTLM auth",
}
// URL getter
func (r Request) GetURL() string {
var host string
if len(r.IPAddress) > 0 {
host = r.IPAddress
} else {
host = r.Host
}
return fmt.Sprintf("%s://%s:%s%s", r.Scheme, host, strconv.Itoa(r.Port), r.URI)
}
// Use timeout interval
func (r Request) UseTimoutInterval() bool {
return r.WarningTimeout > 0 && r.CriticalTimeout > 0 && r.WarningTimeout < r.CriticalTimeout
}
// Status code check helper
func checkStatusCode(code int, e *Expected) bool {
for _, expectedCode := range e.StatusCodes {
if expectedCode == code {
return true
}
}
return false
}
// Certificate check helper
func checkCerts(certs [][]*x509.Certificate, e *Expected) (string, int) {
timeNow := time.Now()
checkedCerts := make(map[string]bool)
for _, chain := range certs {
for _, cert := range chain {
if _, checked := checkedCerts[string(cert.Signature)]; checked {
continue
}
checkedCerts[string(cert.Signature)] = true
expiresIn := int(cert.NotAfter.Sub(timeNow).Hours())
if e.SSLCheck.DaysCritical > 0 && e.SSLCheck.DaysCritical*24 >= expiresIn {
return fmt.Sprintf("CRITICAL - SSL cert expires in %f days", float32(expiresIn)/24), EXIT_CRITICAL
}
if e.SSLCheck.DaysWarning > 0 && e.SSLCheck.DaysWarning*24 >= expiresIn {
return fmt.Sprintf("WARNING - SSL cert expires in %f days", float32(expiresIn)/24), EXIT_WARNING
}
}
}
return "", EXIT_OK
}
// TLS config factory
func getTLSConfig(r *Request) (*tls.Config, error) {
TLSConfig := &tls.Config{}
// InsecureSkipVerify
if r.SSLNoVerify {
TLSConfig.InsecureSkipVerify = true
}
// SNI
if !r.NoSNI && len(r.Host) > 0 {
TLSConfig.ServerName = r.Host
}
// Client cert
if r.ClientCert.ClientCertFile != "" && r.ClientCert.PrivateKeyFile != "" {
cert, err := tls.LoadX509KeyPair(r.ClientCert.ClientCertFile, r.ClientCert.PrivateKeyFile)
if err != nil {
return nil, err
}
TLSConfig.Certificates = []tls.Certificate{cert}
}
// Renegotiation
if r.TLSRenegotiation {
TLSConfig.Renegotiation = tls.RenegotiateOnceAsClient
}
return TLSConfig, nil
}
// HTTP client factory
func initHTTPClient(r *Request) (*http.Client, error) {
// Get TLS config
TLSConfig, err := getTLSConfig(r)
if err != nil {
return nil, err
}
http.DefaultTransport.(*http.Transport).TLSClientConfig = TLSConfig
// Setup timeout
var timeout time.Duration
if r.UseTimoutInterval() {
timeout = time.Duration(time.Duration(r.CriticalTimeout) * time.Second)
} else {
timeout = time.Duration(time.Duration(r.Timeout) * time.Second)
}
// Init client
client := &http.Client{
Timeout: timeout,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
if r.FollowRedirects {
return nil
} else {
return http.ErrUseLastResponse
}
},
}
return client, nil
}
// Adds custom User-Agent header
func setUserAgent(request *http.Request) {
request.Header.Set("User-Agent", fmt.Sprintf("icinga-http-check/%s Go-http-client/%s", appVersion, goVersion))
}
// Main check function
func Check(r *Request, e *Expected) (string, int, error) {
if len(r.Host) == 0 && len(r.IPAddress) == 0 {
return "UNKNOWN - No host or IP address given", EXIT_UNKNOWN, nil
}
client, err := initHTTPClient(r)
if err != nil {
return "CRITICAL", EXIT_CRITICAL, err
}
url := r.GetURL()
if r.Verbose {
fmt.Println(">> URL: " + url)
}
// Prepare request
request, err := http.NewRequest("GET", url, nil)
if err != nil {
if r.Verbose {
fmt.Println(fmt.Sprintf(">> http.NewRequest error: %v", err))
}
return "UNKNOWN", EXIT_UNKNOWN, err
}
// User agent
setUserAgent(request)
// Authentication
if r.Authentication.Type == AUTH_BASIC {
request.SetBasicAuth(r.Authentication.User, r.Authentication.Password)
}
// TODO - test
if r.Authentication.Type == AUTH_NTLM {
// Get TLS config
TLSConfig, err := getTLSConfig(r)
if err != nil {
return "CRITICAL", EXIT_CRITICAL, err
}
transport := ntlmssp.Negotiator{
RoundTripper: &http.Transport{
TLSClientConfig: TLSConfig,
},
}
client.Transport = transport
request.SetBasicAuth(r.Authentication.User, r.Authentication.Password)
}
// SNI
if !r.NoSNI && len(r.Host) > 0 {
request.Host = r.Host
}
start := time.Now()
timeInfo := func() string {
return fmt.Sprintf("time=%fs", float32(time.Now().UnixNano()-start.UnixNano())/float32(1000000000))
}
res, err := client.Do(request)
if err != nil {
if r.Verbose {
fmt.Println(fmt.Sprintf(">> client.GET error: %v", err))
}
if err, ok := err.(net.Error); ok && err.Timeout() {
var timeout int
if r.UseTimoutInterval() {
timeout = r.CriticalTimeout
} else {
timeout = r.Timeout
}
return fmt.Sprintf("CRITICAL - Timeout - No response recieved in %d seconds|%s", timeout, timeInfo()), EXIT_CRITICAL, nil
}
return fmt.Sprintf("CRITICAL - %s|%s", err.Error(), timeInfo()), EXIT_CRITICAL, nil
}
defer res.Body.Close()
// Timeout interval
if r.UseTimoutInterval() {
delta := float32(time.Now().UnixNano()-start.UnixNano()) / float32(1000000000)
if delta >= float32(r.WarningTimeout) {
return fmt.Sprintf("WARNING - Timeout - No response recieved in %d seconds|%s", r.WarningTimeout, timeInfo()), EXIT_WARNING, nil
}
}
if r.Verbose {
fmt.Println(fmt.Sprintf(">> Response status: %s", res.Status))
}
// Check status code
if !checkStatusCode(res.StatusCode, e) {
var expectedStatusCodes []string
for _, code := range e.StatusCodes {
expectedStatusCodes = append(expectedStatusCodes, strconv.Itoa(code))
}
return fmt.Sprintf("CRITICAL - Got response HTTP/1.1 %s, expected %s|%s", strconv.Itoa(res.StatusCode), strings.Join(expectedStatusCodes, ", "), timeInfo()), EXIT_CRITICAL, nil
}
// Check body text
if len(e.BodyText) > 0 {
expectedText := []byte(e.BodyText)
bodyBytes, err := ioutil.ReadAll(res.Body)
if err != nil {
return "UNKNOWN", EXIT_UNKNOWN, err
}
if !bytes.Contains(bodyBytes, expectedText) {
return fmt.Sprintf("CRITICAL - String '%s' not found in body|%s", e.BodyText, timeInfo()), EXIT_CRITICAL, nil
}
}
// Check SSL cert
if e.SSLCheck.Run {
SSLMsg, SSLExit := checkCerts(res.TLS.VerifiedChains, e)
if SSLExit != EXIT_OK {
return fmt.Sprintf("%s|%s", SSLMsg, timeInfo()), SSLExit, nil
}
}
return fmt.Sprintf("OK - Got response HTTP/1.1 %s|%s", strconv.Itoa(res.StatusCode), timeInfo()), EXIT_OK, nil
}
// Detects auth type
func DetectAuthType(r *Request) int {
client, err := initHTTPClient(r)
if err != nil {
// `Check` should handle all errors
return AUTH_NONE
}
url := r.GetURL()
request, err := http.NewRequest("GET", url, nil)
if err != nil {
// `Check` should handle all errors
return AUTH_NONE
}
// User agent
setUserAgent(request)
// SNI
if !r.NoSNI && len(r.Host) > 0 {
request.Host = r.Host
}
res, err := client.Do(request)
if err != nil {
// `Check` should handle all errors
return AUTH_NONE
}
defer res.Body.Close()
authHeaders, ok := res.Header["Www-Authenticate"]
if ok {
authHeader := strings.ToLower(authHeaders[0])
if strings.HasPrefix(authHeader, "ntlm") || strings.HasPrefix(authHeader, "negotiate") {
return AUTH_NTLM
}
if strings.HasPrefix(authHeader, "basic") {
return AUTH_BASIC
}
}
return AUTH_NONE
}
+495
View File
@@ -0,0 +1,495 @@
package main
import (
"fmt"
"strconv"
"strings"
"testing"
)
func TestHTTPCodes(t *testing.T) {
statusCodes := [4]int{200, 302, 404, 500}
for _, statusCode := range statusCodes {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: fmt.Sprintf("/status/%s", strconv.Itoa(statusCode)),
Timeout: 30,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, statusCode)
e := &Expected{
StatusCodes: currrentStatusCodes,
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "OK") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_OK {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
}
}
func TestHTTPWrongCodes(t *testing.T) {
statusCodes := [4]int{200, 302, 404, 500}
for _, statusCode := range statusCodes {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: fmt.Sprintf("/status/%s", strconv.Itoa(statusCode)),
Timeout: 30,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, statusCode+1)
e := &Expected{
StatusCodes: currrentStatusCodes,
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "CRITICAL") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_CRITICAL {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
}
}
func TestTimeout(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/delay/10",
Timeout: 5,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "CRITICAL") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_CRITICAL {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
if !strings.Contains(msg, "Timeout - No response recieved in") {
t.Errorf("Non-timeout message returned [URI: %s]", r.URI)
}
}
func TestTimeoutWarning(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/delay/10",
WarningTimeout: 5,
CriticalTimeout: 15,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "WARNING") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_WARNING {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
if !strings.Contains(msg, "Timeout - No response recieved in") {
t.Errorf("Non-timeout message returned [URI: %s]", r.URI)
}
}
func TestTimeoutCritical(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/delay/10",
WarningTimeout: 4,
CriticalTimeout: 8,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "CRITICAL") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_CRITICAL {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
if !strings.Contains(msg, "Timeout - No response recieved in") {
t.Errorf("Non-timeout message returned [URI: %s]", r.URI)
}
}
func TestBasicAuthSuccess(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/basic-auth/user/password",
Timeout: 30,
Verbose: false,
Authentication: Authentication{
Type: AUTH_BASIC,
User: "user",
Password: "password",
},
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "OK") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_OK {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
}
func TestBasicAuthFail(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/basic-auth/user/password",
Timeout: 30,
Verbose: false,
Authentication: Authentication{
Type: AUTH_BASIC,
User: "user",
Password: "password_",
},
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "CRITICAL") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_CRITICAL {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
}
func TestContainsTextOK(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/anything?foobar=baz",
Timeout: 30,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
BodyText: "foobar",
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "OK") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_OK {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
}
func TestContainsTextFail(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/anything?foobar=baz",
Timeout: 30,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
BodyText: "loremipsum",
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "CRITICAL") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_CRITICAL {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
}
func TestSSLOK(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/anything",
Timeout: 30,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
SSLCheck: SSLCheck{
Run: true,
DaysWarning: 20,
DaysCritical: 5,
},
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "OK") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_OK {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
}
func TestSSLWarning(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/anything",
Timeout: 30,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
SSLCheck: SSLCheck{
Run: true,
DaysWarning: 10000,
DaysCritical: 5,
},
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "WARNING") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_WARNING {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
}
func TestBasicAuthDetect(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/basic-auth/user/password",
Timeout: 30,
Verbose: false,
Authentication: Authentication{
Type: AUTH_BASIC,
User: "user",
Password: "password",
},
}
authCode := DetectAuthType(r)
if authCode != AUTH_BASIC {
t.Errorf("Basic auth - wrong auth type detected")
}
}
func TestNoneAuthDetect(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/status/200",
Timeout: 30,
Verbose: false,
}
authCode := DetectAuthType(r)
if authCode != AUTH_NONE {
t.Errorf("None auth - wrong auth type detected")
}
}
func TestUserAgent(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/headers",
Timeout: 30,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
BodyText: fmt.Sprintf("icinga-http-check/%s Go-http-client/%s", appVersion, goVersion),
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "OK") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_OK {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
}
func TestFollowRedirects(t *testing.T) {
r := &Request{
Scheme: "https",
Host: "httpbin.org",
Port: 443,
URI: "/absolute-redirect/5",
FollowRedirects: true,
Timeout: 30,
Verbose: false,
}
var currrentStatusCodes []int
currrentStatusCodes = append(currrentStatusCodes, 200)
e := &Expected{
StatusCodes: currrentStatusCodes,
BodyText: fmt.Sprintf("icinga-http-check/%s Go-http-client/%s", appVersion, goVersion),
}
msg, code, err := Check(r, e)
if !strings.HasPrefix(msg, "OK") {
t.Errorf("Wrong message [URI: %s]", r.URI)
}
if code != EXIT_OK {
t.Errorf("Wrong exit code [URI: %s]", r.URI)
}
if err != nil {
t.Errorf("Returned error is not nil [URI: %s]", r.URI)
}
}
+13
View File
@@ -0,0 +1,13 @@
module another-http-check
require (
github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4
github.com/jessevdk/go-flags v1.4.0
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f // indirect
golang.org/x/net v0.0.0-20190520210107-018c4d40a106 // indirect
golang.org/x/sys v0.0.0-20190520201301-c432e742b0af // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20190520220859-26647e34d3c0 // indirect
)
go 1.13
+20
View File
@@ -0,0 +1,20 @@
github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4 h1:pSm8mp0T2OH2CPmPDPtwHPr3VAQaOwVF/JbllOPP4xA=
github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
golang.org/x/crypto v0.0.0-20190227175134-215aa809caaf h1:CGelmUfSfeZpx2Pu+OznGcS0ff71WZ/ZOEkhMAB4hVQ=
golang.org/x/crypto v0.0.0-20190227175134-215aa809caaf/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190520210107-018c4d40a106/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190520201301-c432e742b0af/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190520220859-26647e34d3c0/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+171
View File
@@ -0,0 +1,171 @@
package main
import (
"fmt"
"os"
"strconv"
"strings"
"github.com/jessevdk/go-flags"
)
type Options struct {
Host string `short:"H" description:"Host ex. google.com" default:""`
IPAddress string `short:"I" description:"IPv4 address ex. 8.8.4.4" default:""`
URI string `short:"u" long:"uri" description:"URI to check" default:"/"`
Port int `short:"p" description:"Port ex. 80 for HTTP 443 for HTTPS" default:"80"`
SSL bool `short:"S" long:"tls" description:"Use HTTPS"`
Timeout int `short:"t" long:"timeout" description:"Timeout" default:"30"`
AuthBasic bool `long:"auth-basic" description:"Use bacis auth"`
AuthNtlm bool `long:"auth-ntlm" description:"Use NTLM auth"`
Auth string `short:"a" long:"auth" description:"ex. user:password" default:""`
ExpectedCode string `short:"e" long:"expect" description:"Expected HTTP code" default:"200"`
BodyText string `short:"s" long:"string" description:"Search for given string in response body" default:""`
SSLExpiration string `short:"C" description:"Check SSL cert expiration" default:""`
SSLNoVerify bool `short:"k" long:"insecure" description:"Controls whether a client verifies the server's certificate chain and host name"`
Verbose bool `short:"v" long:"verbose" description:"Verbose mode"`
GuessAuth bool `long:"guess-auth" description:"Guess auth type"`
FollowRedirects bool `long:"follow-redirects" description:"Follow redirects"`
WarningTimeout int `short:"w" description:"Warning timeout" default:"0"`
CriticalTimeout int `short:"c" description:"Critical timeout" default:"0"`
NoSNI bool `long:"no-sni" description:"Do not use SNI"`
ClientCertFile string `short:"J" long:"client-cert" description:"Name of file containing the client certificate (PEM format) to be used in establishing the SSL session"`
PrivateKeyFile string `short:"K" long:"private-key" description:"Name of file containing the private key (PEM format) matching the client certificate"`
DisableTLSRenegotiation bool `long:"disable-tls-renegotiation" description:"Disable TLS Renegotiation"`
}
var options Options
var parser = flags.NewParser(&options, flags.Default)
var appVersion string
var goVersion string
func main() {
if _, err := parser.Parse(); err != nil {
if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
os.Exit(0)
} else {
os.Exit(1)
}
}
var scheme string
if options.Port == 443 || options.SSL {
scheme = "https"
} else {
scheme = "http"
}
port := options.Port
if scheme == "https" && port == 80 {
port = 443
}
authType := AUTH_NONE
if options.AuthBasic {
authType = AUTH_BASIC
}
if options.AuthNtlm {
authType = AUTH_NTLM
}
var authUser string
var authPassword string
if strings.Contains(options.Auth, ":") {
authParts := strings.Split(options.Auth, ":")
if len(authParts) != 2 {
fmt.Println("UNKNOWN - Username and password not given: provide -a|--auth username:password")
os.Exit(EXIT_UNKNOWN)
}
authUser = authParts[0]
authPassword = authParts[1]
}
if authType == AUTH_NONE && len(authUser) > 0 && len(authPassword) > 0 {
authType = AUTH_BASIC
}
if len(options.Auth) > 0 && len(authUser) == 0 && len(authPassword) == 0 {
fmt.Println("UNKNOWN - Username and password not given: provide -a|--auth username:password")
os.Exit(EXIT_UNKNOWN)
}
r := &Request{
Host: options.Host,
IPAddress: options.IPAddress,
URI: options.URI,
Port: port,
Scheme: scheme,
Timeout: options.Timeout,
Authentication: Authentication{
Type: authType,
User: authUser,
Password: authPassword,
},
SSLNoVerify: options.SSLNoVerify,
Verbose: options.Verbose,
FollowRedirects: options.FollowRedirects,
WarningTimeout: options.WarningTimeout,
CriticalTimeout: options.CriticalTimeout,
NoSNI: options.NoSNI,
ClientCert: ClientCert{
ClientCertFile: options.ClientCertFile,
PrivateKeyFile: options.PrivateKeyFile,
},
TLSRenegotiation: !options.DisableTLSRenegotiation,
}
if options.GuessAuth {
authType = DetectAuthType(r)
if r.Verbose {
fmt.Println(fmt.Sprintf(">> Detected auth: %s", authLookup[authType]))
}
r.Authentication.Type = authType
}
var statusCodes []int
if strings.Contains(options.ExpectedCode, ",") {
for _, code := range strings.Split(options.ExpectedCode, ",") {
codeInt, _ := strconv.Atoi(code)
statusCodes = append(statusCodes, codeInt)
}
} else {
codeInt, _ := strconv.Atoi(options.ExpectedCode)
statusCodes = append(statusCodes, codeInt)
}
var SSLWarning int
var SSLCritical int
if strings.Contains(options.SSLExpiration, ",") {
SSLParts := strings.Split(options.SSLExpiration, ",")
if len(SSLParts) != 2 {
fmt.Println("UNKNOWN - SSL check has invalid parameters: provide e.g. -C 14,7")
os.Exit(EXIT_UNKNOWN)
}
SSLWarning, _ = strconv.Atoi(SSLParts[0])
SSLCritical, _ = strconv.Atoi(SSLParts[1])
} else {
SSLWarning, _ = strconv.Atoi(options.SSLExpiration)
SSLCritical = 0
}
e := &Expected{
StatusCodes: statusCodes,
BodyText: options.BodyText,
SSLCheck: SSLCheck{
Run: options.SSL,
DaysWarning: SSLWarning,
DaysCritical: SSLCritical,
},
}
msg, code, err := Check(r, e)
if err != nil {
fmt.Println(fmt.Sprintf("UNKNOWN, %s", err.Error()))
os.Exit(EXIT_UNKNOWN)
}
fmt.Println(msg)
os.Exit(code)
}
+84
View File
@@ -0,0 +1,84 @@
#!/bin/sh
test -f another-http-check || exit 1
./another-http-check -H httpbin.org -p 443 -u /status/200 -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /status/201 -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u '/anything?foobar=baz' -s 'foobar' -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u '/anything?foobar=baz' -s 'fuubar' -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /headers -s 'icinga-http-check' -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /basic-auth/user/password \
--auth-basic -a user:password -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /basic-auth/user/password \
--auth-basic -a user:password_ -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /basic-auth/user/password \
-a user:password -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /basic-auth/user/password \
-a user -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /basic-auth/user/password \
-a user:password --guess-auth -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /delay/10 -t 5 -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -C 15 -S -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -C 999999,999999 -S -v
echo "Status code: $?"
echo
./another-http-check -H self-signed.badssl.com -p 443 -v
echo "Status code: $?"
echo
./another-http-check -H self-signed.badssl.com -p 443 -k -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /absolute-redirect/3 \
-v --follow-redirects
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /absolute-redirect/3 -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /delay/5 -w 4 -c 8 -v
echo "Status code: $?"
echo
./another-http-check -H httpbin.org -p 443 -u /delay/10 -w 4 -c 8 -v
echo "Status code: $?"
+55
View File
@@ -0,0 +1,55 @@
# Vecchia versione del file
[Current Incidents]
title = "Disservizi in Corso"
disabled = "1"
[Overdue]
title = "Ritardi"
disabled = "1"
[Muted]
title = "Silenziati"
disabled = "1"
[Dashboard]
title = "Dashboard"
[Dashboard.Host Problem]
url = "icingadb/hosts?host.state.is_problem=y&sort=host.state.severity%20desc&limit=25&view=minimal"
title = "Host Problem"
[Dashboard.Tactical]
url = "icingadb/tactical"
title = "Tactical"
[Dashboard.Services Problem]
url = "icingadb/services?service.state.is_problem=y&view=minimal&sort=service.state.severity%20desc&limit=25"
title = "Service Problem"
[Dashboard.Hosts]
url = "icingadb/hosts?host.state.is_problem!=y&sort=host.state.last_state_change%20desc&limit=25&view=minimal"
title = "Host"
[Dashboard.Hostgroups]
url = "icingadb/hostgroups"
title = "Hostgroup"
[Dashboard.Services]
url = "icingadb/services?service.state.is_problem=n&view=minimal&sort=service.state.last_state_change%20desc&limit=25"
title = "Service"
[VMware]
title = "VMware"
[VMware.Host]
url = "vspheredb/hosts?columns=object_name%2Ccpu_usage%2Cmemory_usage%2Cvms_overall_status%2Cuptime"
title = "Host"
[VMware.Snapshot]
url = "vspheredb/vms/snapshot"
title = "Snapshot"
[VMware.VM Status]
url = "vspheredb/vms?columns=cpu_usage%2Cmemory_usage%2Cuptime%2Cobject_name&sort=runtime_power_state&limit=100"
title = "VM Status"
+38
View File
@@ -0,0 +1,38 @@
[Current Incidents]
title = "Disservizi in Corso"
disabled = "1"
[Overdue]
title = "Ritardi"
disabled = "1"
[Muted]
title = "Silenziati"
disabled = "1"
[Dashboard]
title = "Dashboard"
[Dashboard.Host Problem]
url = "monitoring/list/hosts?host_problem=1&sort=host_severity&limit=15"
title = "Host Problem"
[Dashboard.Tactical]
url = "monitoring/tactical"
title = "Tactical"
[Dashboard.Services Problem]
url = "monitoring/list/services?service_problem=1&sort=service_severity&limit=15"
title = "Service Problem"
[Dashboard.Hosts]
url = "monitoring/list/hosts?host_state=0&sort=host_last_state_change&modifyFilter=1&limit=10"
title = "Host"
[Dashboard.Hostgroups]
url = "monitoring/list/hostgroups"
title = "Hostgroup"
[Dashboard.Services]
url = "monitoring/list/services?service_state=0&sort=service_last_state_change&dir=desc&limit=10"
title = "Service"
@@ -0,0 +1,7 @@
Copyright 2022 Kalarumeth - https://github.com/Kalarumeth
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,172 @@
# Check WatchGuard
<img src="https://img.shields.io/badge/Dev by-Kalarumeth-blueviolet?style=flat-square" alt="Dev"> <img src="https://img.shields.io/badge/Code-Bash-orange?style=flat-square&logo=GNU Bash&logoColor=orange" alt="Bash"> <img src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" alt="MIT License">
The following script is used to monitor the basic functions of the WatchGuard firewall via snmpwalk scripts and are processed to provide easy-to-read data. It can be run separately or integrated into Icinga2 as a monitoring plugin.
**Important**: *snmpwalk command is required for script to run correctly*
# Update Note
## 1.3 - Code improvements
+Improved the code
+Add check host alive before snmp
+Merge InfoIps, InfoGav and IpsecTunnelNum to one check
<details>
<summary>1.2 - Fix</summary>
+Fix Warning and Critical state
+Add ability to set limits for waring and critical on percentage
+Add ability to set maximum Active Connections for ActiveConns
+Set default variable warning(80)
+Set default variable critical(90)
+Set default variable maximum active connections(3300000)
</details>
<details>
<summary>1.1 - Code improvements</summary>
+Improved the code
+Add Check Memory
+Add Check Info Ips Service
+Removed unnecessary code
</details>
<details>
<summary>1.0 - Release</summary>
+Release Script
</details>
# Installation
1. Download the script and give it privilages for run
```
curl -LJO https://raw.githubusercontent.com/Kalarumeth/Check-WatchGuard/main/check_watchguard.sh
```
2. Move to Icinga Plugin Dir
```
Default location: /usr/lib/nagios/plugins
```
3. Add command to Icinga
```
object CheckCommand "check_watchguard" {
import "plugin-check-command"
command = [ PluginDir + "/check_watchguard.sh" ]
arguments += {
"-ac" = {
order = 4
value = "$watchguard_ac$"
}
"-c" = {
order = 0
required = true
value = "$snmp_community$"
}
"-cr" = {
order = 3
value = "$crit$"
}
"-h" = {
order = 1
required = true
value = "$address$"
}
"-t" = {
order = 5
required = true
value = "$watchguard_type$"
}
"-wa" = {
order = 2
value = "$warn$"
}
}
vars.snmp_community = "public"
}
```
# Functions
The Script is designed to monitor the following firewall functions:
- **[ac] ActiveConns:**
Active connections in use and total number of active connections;
```
OK! Active Connections used: 0.16%
Current Active Connections: 5.412 of 3.300.000
```
- **[cpu] Cpu:**
Cpu load;
```
OK! CPU used: 2%
```
- **[data] Transfer:**
Information of file size send and recive.
```
Send 1479 GB / Recive 1982 GB
WatchGuard transfer info:
Total Data Send: 1479 GB 1855886728 Pkg
Total Data Recive: 1982 GB 2466423320 Pkg
```
- **[info] Info:**
Information of Active VPN, Intrusion Prevention Service and Gateway Antivirus Service
```
VPN active: 7
Gateway Antivirus Service: gav_version:2022020
Last Update: Fri, Feb 04 2022 11:54:03 AM
Intrusion Prevention Service: ips_version:18.196
Last Update: Thu, Feb 03 2022 06:53:47 PM
```
- **[ram] Memory:**
Ram load;
```
OK! RAM used: 2,67 / 3,77 GB (71,00 %)
RAM free: 1,10 GB (29,13 %)
```
# How it work
Method to compose the execution string:
./check_watchguard.sh -c <SNMP community> -h <host> [-wa <value> -cr <value> -ac <value>] -t <object>
### OPTIONS:
```
-c --community SNMP v2 community string with Read access.
Default is: public.
-h --host [REQUIRED OPTION] Host name or IP address to check.
Default is: localhost.
-wa --allert-wa Defines the threshold for Warning.
Default is: 80.
-cr --allert-cr Defines the threshold for Critical.
Default is: 90.
-ac --activeconns Defines the threshold for Max ActiveConnection.
Default is: 3300000
-t --type [REQUIRED OPTION] Field for select element to check on WatchGuard Device.
{ ac | cpu | data | info | ram }.
-H --help Show script help.
-V --version Show script version.
```
# Credits
## Author
Kalarumeth - https://github.com/Kalarumeth
## GitHub Supporters
kelups
## License
MIT License - Copyright 2022 Kalarumeth
@@ -0,0 +1,275 @@
#!/bin/bash
# - VAR
# - Bash info
APPNAME=$(basename $0)
NAME="Check WatchGuard"
AUTHOR="Kalarumeth"
VERSION="v1.4"
URL="https://github.com/Kalarumeth/Check-WatchGuard"
# - Default settings for connection
COMMUNITY="public"
HOST_NAME="localhost"
SNMPVERSION="2c"
# - State Variables
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
STATE=$STATE_OK
# - Range Variables
WA=80
CR=90
maxActiveConns=3300000
# - OID
WatchGuard.OIDS() {
# - wgSystemStatisticsMIB
OID_wgSystemTotalSendBytes="1.3.6.1.4.1.3097.6.3.8"
OID_wgSystemTotalRecvBytes="1.3.6.1.4.1.3097.6.3.9"
OID_wgSystemTotalSendPackets="1.3.6.1.4.1.3097.6.3.10"
OID_wgSystemTotalRecvPackets="1.3.6.1.4.1.3097.6.3.11"
OID_wgSystemCpuUtil1="1.3.6.1.4.1.3097.6.3.77"
OID_wgSystemCurrActiveConns="1.3.6.1.4.1.3097.6.3.80"
# - wgMem
OID_wgMemTotalReal="1.3.6.1.4.1.2021.4.5.0"
OID_wgMemAvailReal="1.3.6.1.4.1.2021.4.6.0"
# - wgIpsecStats
OID_wgIpsecTunnelNum="1.3.6.1.4.1.3097.6.5.1.1"
# - wgInfoSystem
OID_wgInfoGavService="1.3.6.1.4.1.3097.6.1.3.0"
OID_wgInfoIpsService="1.3.6.1.4.1.3097.6.1.4"
}
# - MAIN CODE
Source.HostAlive() {
for host in $HOST_NAME; do
ping -c1 -W1 -q $host &>/dev/null
if [[ $? != 0 ]] ; then
printf "%s\n" "$host is unreachable"
exit $STATE_UNK
fi
done
}
Source.SNMP() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oe -c $COMMUNITY $HOST_NAME $1
}
# - WatchGuard Health Monitoring
WatchGuard.Main() {
Source.HostAlive
case $1 in
ac)
WatchGuard.ActiveConns ;;
cpu)
WatchGuard.Cpu ;;
data)
WatchGuard.TransferData ;;
info)
WatchGuard.Info ;;
ram)
WatchGuard.Ram ;;
*)
echo "Unknown Monitoring: $1"
Help.WatchGuard
STATE=$STATE_UNK ;;
esac
}
WatchGuard.GetData() {
WatchGuard.OIDS
case $1 in
data)
totalSendGb=$(Source.SNMP $OID_wgSystemTotalSendBytes | cut -d " " -f 4 | awk '{ byte = $1 /1024/1024/1024; print byte }' | xargs printf "%.0f")
totalRecvGb=$(Source.SNMP $OID_wgSystemTotalRecvBytes | cut -d " " -f 4 | awk '{ byte = $1 /1024/1024/1024; print byte }' | xargs printf "%.0f")
totalSendPackets=$(Source.SNMP $OID_wgSystemTotalSendPackets | cut -d " " -f 4)
totalRecvPackets=$(Source.SNMP $OID_wgSystemTotalRecvPackets | cut -d " " -f 4) ;;
cpu)
cpuPercentage=$(Source.SNMP $OID_wgSystemCpuUtil1 | cut -d " " -f 4 | awk '{ cpu = $1 /100; print cpu }') ;;
ram)
rawRamAll=$(Source.SNMP $OID_wgMemTotalReal | cut -d " " -f 4)
rawRamFree=$(Source.SNMP $OID_wgMemAvailReal | cut -d " " -f 4)
valueRamAllGb=$(echo "$rawRamAll" | awk '{ gbyte = $1 /1024/1024; print gbyte }' | xargs printf "%.2f")
valueRamFreeGb=$(echo "$rawRamFree" | awk '{ gbyte = $1 /1024/1024; print gbyte }' | xargs printf "%.2f")
printPercetageRam=$(echo "$rawRamFree" "$rawRamAll" | awk '{ ramp = $1 /$2 *100; print ramp }' | xargs printf "%.2f")
printPercetageRamUsed=$(echo "$printPercetageRam" | awk '{ ramup = 100 - $1; print ramup }')
rangePercetageRam=$(echo "$printPercetageRamUsed" | cut -d "." -f1)
rawRamUsed=$(echo "$rawRamAll" "$rawRamFree" | awk '{ used = $1 -$2; print used }')
valueRamUsedGb=$(echo "$rawRamUsed" | awk '{ gbyte = $1 /1024/1024; print gbyte }' | xargs printf "%.2f") ;;
ac)
rawActiveConns=$(Source.SNMP $OID_wgSystemCurrActiveConns | cut -d " " -f 4)
rawPercetageActiveConns=$(echo "$rawActiveConns $maxActiveConns" | awk '{ perc = $1 /$2 *100; print perc; }')
rangeActiveConns=$(echo "$rawPercetageActiveConns" | cut -d "." -f 1 )
printPercetageActiveConns=$(echo "$rawPercetageActiveConns" | xargs printf "%.2f")
printValueActiveConns=$(echo "$rawActiveConns" | perl -pe 's/(\d{1,3})(?=(?:\d{3}){1,5}\b)/\1./g')
printMaxActiveConns=$(echo "$maxActiveConns" | perl -pe 's/(\d{1,3})(?=(?:\d{3}){1,5}\b)/\1./g') ;;
info)
ipsecNum=$(Source.SNMP $OID_wgIpsecTunnelNum | cut -d " " -f 4)
rawInfoGav=$(Source.SNMP $OID_wgInfoGavService)
InfoGavVers=$(echo "$rawInfoGav" | cut -d "<" -f 2 | cut -d ">" -f 1)
InfoGavData=$(echo "$rawInfoGav" | cut -d "(" -f 2 | cut -d ")" -f 1)
rawInfoIps=$(snmpwalk -v $SNMPVERSION -c $COMMUNITY $HOST_NAME $OID_wgInfoIpsService 2>&1 | sed 's/Timeout: No Response.*/Idle/')
if [ "$rawInfoIps" != "Idle" ] ; then
rawInfoIps=$(echo $rawInfoIps)
fi
InfoIpsVers=$(echo "$rawInfoIps" | cut -d "<" -f 2 | cut -d ">" -f 1)
InfoIpsData=$(echo "$rawInfoIps" | cut -d "(" -f 2 | cut -d ")" -f 1) ;;
esac
}
WatchGuard.TransferData() {
WatchGuard.GetData data
printf "%s\n" "Send $totalSendGb GB / Recive $totalRecvGb GB"
printf "%s\n" "WatchGuard transfer info:"
printf "%s\t%s\t%s\n" "Total Data Send:" "$totalSendGb GB" "$totalSendPackets Pkg"
printf "%s\t%s\t%s\n" "Total Data Recive:" "$totalRecvGb GB" "$totalRecvPackets Pkg"
}
WatchGuard.Cpu() {
WatchGuard.GetData cpu
for value in $cpuPercentage; do
case 1 in
$(($value <= $WA-1)))
echo "OK! CPU used: $value% | cpu_usage=$value%" && exit $STATE_OK ;;
$(($value <= $CR-1)))
echo "WARRING! CPU used: $value | cpu_usage=$value%%" && exit $STATE_WARN ;;
$(($value > $CR-1)))
echo "CRITICAL! CPU used: $value% | cpu_usage=$value%" && exit $STATE_CRIT ;;
esac
done
}
WatchGuard.Ram() {
WatchGuard.GetData ram
case 1 in
$(($rangePercetageRam <= $WA-1)))
printf "%s\n" "OK! RAM used: $valueRamUsedGb / $valueRamAllGb GB ($printPercetageRamUsed%)" "RAM free: $valueRamFreeGb GB ($printPercetageRam%) | ram_used=$printPercetageRamUsed% ram_free=$printPercetageRam%" && exit $STATE_OK ;;
$(($rangePercetageRam <= $CR-1)))
printf "%s\n" "WARRING! RAM used: $valueRamUsedGb / $valueRamAllGb GB ($printPercetageRamUsed%)" "RAM free: $valueRamFreeGb GB ($printPercetageRam%) | ram_used=$printPercetageRamUsed% ram_free=$printPercetageRam%" && exit $STATE_WARN ;;
$(($rangePercetageRam > $CR-1)))
printf "%s\n" "CRITICAL! RAM used: $valueRamUsedGb / $valueRamAllGb GB ($printPercetageRamUsed%)" "RAM free: $valueRamFreeGb GB ($printPercetageRam%) | ram_used=$printPercetageRamUsed% ram_free=$printPercetageRam%" && exit $STATE_CRIT ;;
esac
}
WatchGuard.ActiveConns() {
WatchGuard.GetData ac
case 1 in
$(($rangeActiveConns <= $WA-1)))
printf "%s\n" "OK! Active Connections used: $printPercetageActiveConns%" "Current Active Connections: $printValueActiveConns of $printMaxActiveConns | active_connections=$printPercetageActiveConns%" && exit $STATE_OK ;;
$(($rangeActiveConns <= $CR-1)))
printf "%s\n" "WARRING! Active Connections used: $printPercetageActiveConns%" "Current Active Connections: $printValueActiveConns of $printMaxActiveConns | active_connections=$printPercetageActiveConns%" && exit $STATE_WARN ;;
$(($rangeActiveConns > $CR-1)))
printf "%s\n" "CRITICAL! Active Connections used: $printPercetageActiveConns%" "Current Active Connections: $printValueActiveConns of $printMaxActiveConns | active_connections=$printPercetageActiveConns%" && exit $STATE_CRIT ;;
esac
}
WatchGuard.Info() {
WatchGuard.GetData info
printf "%s\t%s\n\n" "VPN active:" "$ipsecNum"
printf "%s\n%s\n\n" "Gateway Antivirus Service: $InfoGavVers" " Last Update: $InfoGavData"
printf "%s\n" "Intrusion Prevention Service: $InfoIpsVers" " Last Update: $InfoIpsData"
}
# - HELP
Help.Main() {
echo "Script bash for moninitoring WatchGuard Health"
echo ''
Help.Usage
echo ''
Help.Option
echo ''
Help.WatchGuard
echo ''
Help.Support
echo ''
Help.Info
echo ''
exit $STATE_UNK
}
Help.Usage() {
printf "%s\n" "Method to compose the execution string:" "./$APPNAME -c <SNMP community> -h <host> [-wa <value> -cr <value> -ac <value>] -t <object>"
}
Help.Option() {
printf "%s\n" "OPTIONS:"
printf "%s\t%s\t%s\n\t\t\t%s\n" "-c" "--community" "SNMP v2 community string with Read access." " Default is: $COMMUNITY."
printf "%s\t%s\t\t%s\n\t\t\t%s\n" "-h" "--host" "Host name or IP address to check." " Default is: $HOST_NAME."
printf "%s\t%s\t%s\n\t\t\t%s\n" "-wa" "--allert-wa" "Defines the threshold for Warning." " Default is: $WA."
printf "%s\t%s\t%s\n\t\t\t%s\n" "-cr" "--allert-cr" "Defines the threshold for Critical." " Default is: $CR."
printf "%s\t%s\t%s\n\t\t\t%s\n" "-ac" "--activeconns" "Defines the threshold for Max ActiveConnection." " Default is: $maxActiveConns."
printf "%s\t%s\t\t%s\n\t\t\t%s\n" "-t" "--type" "[REQUIRED OPTION] Field for select element to check on WatchGuard Device." " { ac | cpu | data | info | ram }"
printf "%s\t%s\t\t%s\n" "-H" "--help" "Show script help."
printf "%s\t%s\t%s\n" "-V" "--version" "Show script version."
}
Help.WatchGuard() {
printf "\n%s\n\n" "WatchGuard Check Function"
printf "%s\t%s\n\n" "Check" "Description"
printf "%s\t%s\n" "ac" "Monitoring Active Connection."
printf "%s\t%s\n" "cpu" "Monitoring Cpu load."
printf "%s\t%s\n" "data" "Monitoring Data Tranfer."
printf "%s\t%s\n" "info" "Monitoring Ip Sec, Info Gav Service and Info Ips Service."
printf "%s\t%s\n" "ram" "Monitoring RAM load."
}
Help.Support(){
printf "%s\n" "GitHub Supporters:"
printf "\t%s\n" "kelups"
}
Help.Info() {
printf "%s\t%s\t%s\n" "INFO:" "$NAME" "$VERSION" "" "$AUTHOR" "$URL"
}
# - COMMAND LINE ENCODER
# - Prompt
while test -n "$1"; do
case "$1" in
--host|-h)
HOST_NAME=$2
shift ;;
--comunity|-c)
COMMUNITY=$2
shift ;;
--activeconns|-ac)
maxActiveConns=$2
shift ;;
--allert-wa|-wa)
WA=$2
shift ;;
--allert-cr|-cr)
CR=$2
shift ;;
--type|-t)
WatchGuard.Main $2
shift ;;
--help|-H)
Help.Main ;;
--version|-V)
Help.Info
exit $STATE ;;
*)
echo "Unknown argument: $1"
Help.Main
exit $STATE_UNK ;;
esac
shift
done
exit $STATE
@@ -0,0 +1,108 @@
#! /bin/sh
# Variable
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
MAX=100
BASEURL=$(curl -s 'http://palesp02.pal.local/getValue')
# Main Code
CheckTemperature(){
COMMAND=$(echo $BASEURL | python3 -mjson.tool | grep Temperature | cut -d " " -f 10 | cut -d "." -f 1)
COMMANDS=$(echo $BASEURL | python3 -mjson.tool | grep Temperature | cut -d " " -f 10 | cut -d "," -f 1)
RESAULT=$(echo "$COMMANDS °C")
case 1 in
$(($COMMAND<= $WARNING))) echo "OK! Temperature is: $RESAULT"
exit $STATE_OK ;; # 0-79% Ok
$(($COMMAND<= $CRITICAL))) echo "WARNING! Temperature is: $RESAULT"
exit $STATE_WARN ;; # 80-89% Warring
$(($COMMAND<= $MAX))) echo "CRITICAL! Temperature is: $RESAULT"
exit $STATE_CRIT ;; # 90-100% Critical
*) echo "UNKNOWN! Temperature not found"
exit $STATE_UNK ;;
esac
}
CheckHumidity(){
COMMAND=$(echo $BASEURL | python3 -mjson.tool | grep Humidity | cut -d " " -f 10 | cut -d "." -f 1)
COMMANDS=$(echo $BASEURL | python3 -mjson.tool | grep Humidity | cut -d " " -f 10 | cut -d "," -f 1)
RESAULT=$(echo "$COMMANDS %")
case 1 in
$(($COMMAND<= $WARNING))) echo "OK! Humidity is: $RESAULT"
exit $STATE_OK ;; # 0-79% Ok
$(($COMMAND<= $CRITICAL))) echo "WARNING! Humidity is: $RESAULT"
exit $STATE_WARN ;; # 80-89% Warring
$(($COMMAND<= $MAX))) echo "CRITICAL! Humidity is: $RESAULT"
exit $STATE_CRIT ;; # 90-100% Critical
*) echo "UNKNOWN! Temperature not found"
exit $STATE_UNK ;;
esac
}
CheckPressure(){
COMMAND=$(echo $BASEURL | python3 -mjson.tool | grep Pressure | cut -d " " -f 10 | cut -d "," -f 1)
RESAULT=$(echo "$COMMAND hPa")
echo "Pressure is: $RESAULT"
exit $STATE_OK
}
while test -n "$1"; do
case "$1" in
--type|-t)
CHECK_TYPE=$2
shift
;;
--warning|-w)
WARNING=$2
shift
;;
--critical|-c)
CRICICAL=$2
shift
;;
*)
echo "Unknown argument: $1"
print_usage
exit $STATE_UNK
;;
esac
shift
done
# - Type Check
if [ ! -z $CHECK_TYPE ]; then
case "$CHECK_TYPE" in
Temperature)
CheckTemperature;;
Humidity)
CheckHumidity;;
Pressure)
CheckPressure;;
esac
else
echo "Command incomplete!"
echo ''
print_help
STATE=$STATE_UNK
fi
+7
View File
@@ -0,0 +1,7 @@
Copyright 2022 Kalarumeth - https://github.com/Kalarumeth
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+99
View File
@@ -0,0 +1,99 @@
CD-SNMP-MIB::memTotalReal.0 = INTEGER: 457656 kB 1.3.6.1.4.1.2021.4.5 RAM TOT
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 332428 kB 1.3.6.1.4.1.2021.4.11 RAM FREE
UCD-SNMP-MIB::ssCpuSystem.0 = INTEGER: 27 1.3.6.1.4.1.2021.11.10 CPU LOAD
UCD-SNMP-MIB::snmperrErrorFlag.0 = INTEGER: noError(0) 1.3.6.1.4.1.2021.101.100
UCD-SNMP-MIB::snmperrErrMessage.0 = STRING: 1.3.6.1.4.1.2021.101.101
1.3.6.1.4.1.21317.1.3.1.2
SNMPv2-SMI::enterprises.21317.1.3.1.2.1 = STRING: "51.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.2 = STRING: "24.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.3 = STRING: "34.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.6 = STRING: "23.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.7 = STRING: "27.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.8 = STRING: "41.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.9 = STRING: "35.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.10 = STRING: "31.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.11 = STRING: "31.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.12 = STRING: "26.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.13 = STRING: "10080.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.14 = STRING: "10080.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.15 = STRING: "10220.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.16 = STRING: "10080.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.17 = STRING: "10080.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.18 = STRING: "10080.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.19 = STRING: "11.920"
SNMPv2-SMI::enterprises.21317.1.3.1.2.20 = STRING: "5.020"
SNMPv2-SMI::enterprises.21317.1.3.1.2.21 = STRING: "3.361"
SNMPv2-SMI::enterprises.21317.1.3.1.2.22 = STRING: "4.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.23 = STRING: "1.300"
SNMPv2-SMI::enterprises.21317.1.3.1.2.24 = STRING: "1.219"
SNMPv2-SMI::enterprises.21317.1.3.1.2.25 = STRING: "1.235"
SNMPv2-SMI::enterprises.21317.1.3.1.2.26 = STRING: "5.129"
SNMPv2-SMI::enterprises.21317.1.3.1.2.27 = STRING: "3.310"
SNMPv2-SMI::enterprises.21317.1.3.1.2.28 = STRING: "0.855"
SNMPv2-SMI::enterprises.21317.1.3.1.2.29 = STRING: "0.893"
SNMPv2-SMI::enterprises.21317.1.3.1.2.30 = STRING: "0.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.31 = STRING: "1.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.32 = STRING: "1.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.33 = STRING: "51.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.34 = STRING: "46.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.36 = STRING: "58.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.37 = STRING: "19.000"
SNMPv2-SMI::enterprises.21317.1.3.1.2.38 = STRING: "1.000"
1.3.6.1.4.1.21317.1.3.1.13
SNMPv2-SMI::enterprises.21317.1.3.1.13.1 = STRING: "CPU Temp"
SNMPv2-SMI::enterprises.21317.1.3.1.13.2 = STRING: "System Temp"
SNMPv2-SMI::enterprises.21317.1.3.1.13.3 = STRING: "Peripheral Temp"
SNMPv2-SMI::enterprises.21317.1.3.1.13.6 = STRING: "NIC Temp"
SNMPv2-SMI::enterprises.21317.1.3.1.13.7 = STRING: "VRMCpu Temp"
SNMPv2-SMI::enterprises.21317.1.3.1.13.8 = STRING: "VRMSoc Temp"
SNMPv2-SMI::enterprises.21317.1.3.1.13.9 = STRING: "VRMABCD Temp"
SNMPv2-SMI::enterprises.21317.1.3.1.13.10 = STRING: "VRMEFGH Temp"
SNMPv2-SMI::enterprises.21317.1.3.1.13.11 = STRING: "DIMMABCD Temp"
SNMPv2-SMI::enterprises.21317.1.3.1.13.12 = STRING: "DIMMEFGH Temp"
SNMPv2-SMI::enterprises.21317.1.3.1.13.13 = STRING: "FAN1"
SNMPv2-SMI::enterprises.21317.1.3.1.13.14 = STRING: "FAN2"
SNMPv2-SMI::enterprises.21317.1.3.1.13.15 = STRING: "FAN3"
SNMPv2-SMI::enterprises.21317.1.3.1.13.16 = STRING: "FAN4"
SNMPv2-SMI::enterprises.21317.1.3.1.13.17 = STRING: "FAN5"
SNMPv2-SMI::enterprises.21317.1.3.1.13.18 = STRING: "FAN6"
SNMPv2-SMI::enterprises.21317.1.3.1.13.19 = STRING: "12V"
SNMPv2-SMI::enterprises.21317.1.3.1.13.20 = STRING: "5VCC"
SNMPv2-SMI::enterprises.21317.1.3.1.13.21 = STRING: "3.3VCC"
SNMPv2-SMI::enterprises.21317.1.3.1.13.22 = STRING: "VBAT"
SNMPv2-SMI::enterprises.21317.1.3.1.13.23 = STRING: "VDDCR"
SNMPv2-SMI::enterprises.21317.1.3.1.13.24 = STRING: "VMEMABCD"
SNMPv2-SMI::enterprises.21317.1.3.1.13.25 = STRING: "VMEMEFGH"
SNMPv2-SMI::enterprises.21317.1.3.1.13.26 = STRING: "VDD_5_DUAL"
SNMPv2-SMI::enterprises.21317.1.3.1.13.27 = STRING: "VDD_33_DUAL"
SNMPv2-SMI::enterprises.21317.1.3.1.13.28 = STRING: "SOCRUN"
SNMPv2-SMI::enterprises.21317.1.3.1.13.29 = STRING: "SOCDUAL"
SNMPv2-SMI::enterprises.21317.1.3.1.13.30 = STRING: "Chassis Intru"
SNMPv2-SMI::enterprises.21317.1.3.1.13.31 = STRING: "PS1 Status"
SNMPv2-SMI::enterprises.21317.1.3.1.13.32 = STRING: "PS2 Status"
SNMPv2-SMI::enterprises.21317.1.3.1.13.33 = STRING: "AOC_NIC2 Temp "
SNMPv2-SMI::enterprises.21317.1.3.1.13.34 = STRING: "AOC_NIC1 Temp "
SNMPv2-SMI::enterprises.21317.1.3.1.13.36 = STRING: "AOC_SAS1 Temp "
SNMPv2-SMI::enterprises.21317.1.3.1.13.37 = STRING: "HDD Temp "
SNMPv2-SMI::enterprises.21317.1.3.1.13.38 = STRING: "HDD Status "
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+140
View File
@@ -0,0 +1,140 @@
# Check WatchGuard
<img src="https://img.shields.io/badge/Dev by-Kalarumeth-blueviolet?style=flat-square" alt="Dev"> <img src="https://img.shields.io/badge/Code-Bash-orange?style=flat-square&logo=GNU Bash&logoColor=orange" alt="Bash"> <img src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" alt="MIT License">
The following script is used to monitor the basic functions of the WatchGuard firewall via snmpwalk scripts and are processed to provide easy-to-read data. It can be run separately or integrated into Icinga2 as a monitoring plugin.
**Important**: *snmpwalk command is required for script to run correctly*
# Update Note
## 0.5 - Release
+Release
# Installation
1. Download the script and give it privilages for run
```
curl -LJO https://raw.githubusercontent.com/Kalarumeth/...
```
2. Move to Icinga Plugin Dir
```
Default location: /usr/lib/nagios/plugins
```
3. Add command to Icinga
```
object CheckCommand "check_watchguard" {
import "plugin-check-command"
command = [ PluginDir + "/check_watchguard.sh" ]
arguments += {
"-ac" = {
order = 4
value = "$watchguard_ac$"
}
"-c" = {
order = 0
required = true
value = "$snmp_community$"
}
"-cr" = {
order = 3
value = "$crit$"
}
"-h" = {
order = 1
required = true
value = "$address$"
}
"-t" = {
order = 5
required = true
value = "$watchguard_type$"
}
"-wa" = {
order = 2
value = "$warn$"
}
}
vars.snmp_community = "public"
}
```
# Functions
The Script is designed to monitor the following firewall functions:
- **[ac] ActiveConns:**
Active connections in use and total number of active connections;
```
OK! Active Connections used: 0.16%
Current Active Connections: 5.412 of 3.300.000
```
- **[cpu] Cpu:**
Cpu load;
```
OK! CPU used: 2%
```
- **[data] Transfer:**
Information of file size send and recive.
```
Send 1479 GB / Recive 1982 GB
WatchGuard transfer info:
Total Data Send: 1479 GB 1855886728 Pkg
Total Data Recive: 1982 GB 2466423320 Pkg
```
- **[info] Info:**
Information of Active VPN, Intrusion Prevention Service and Gateway Antivirus Service
```
VPN active: 7
Gateway Antivirus Service: gav_version:2022020
Last Update: Fri, Feb 04 2022 11:54:03 AM
Intrusion Prevention Service: ips_version:18.196
Last Update: Thu, Feb 03 2022 06:53:47 PM
```
- **[ram] Memory:**
Ram load;
```
OK! RAM used: 2,67 / 3,77 GB (71,00 %)
RAM free: 1,10 GB (29,13 %)
```
# How it work
Method to compose the execution string:
./check_watchguard.sh -c <SNMP community> -h <host> [-wa <value> -cr <value> -ac <value>] -t <object>
### OPTIONS:
```
-c --community SNMP v2 community string with Read access.
Default is: public.
-h --host [REQUIRED OPTION] Host name or IP address to check.
Default is: localhost.
-wa --allert-wa Defines the threshold for Warning.
Default is: 80.
-cr --allert-cr Defines the threshold for Critical.
Default is: 90.
-ac --activeconns Defines the threshold for Max ActiveConnection.
Default is: 3300000
-t --type [REQUIRED OPTION] Field for select element to check on WatchGuard Device.
{ ac | cpu | data | info | ram }.
-H --help Show script help.
-V --version Show script version.
```
# Credits
### Author
Kalarumeth - https://github.com/Kalarumeth
### License
MIT License - Copyright 2022 Kalarumeth
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,641 @@
paladmin@palicinga02:~$ snmpwalk -v 2c -c pal-ro palap024.pal.local
SNMPv2-MIB::sysDescr.0 = STRING: Linux EAP245 3.3.8 #1 Fri Sep 18 16:46:11 CST 2020 mips
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.11863.3.2.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (40561988) 4 days, 16:40:19.88
SNMPv2-MIB::sysContact.0 = STRING: root@localhost
SNMPv2-MIB::sysName.0 = STRING: EAP245
SNMPv2-MIB::sysLocation.0 = STRING: Unknown
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORID.1 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.2 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.3 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.5 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORID.6 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.7 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.8 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.3 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.5 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORDescr.6 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.7 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORDescr.8 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (0) 0:00:00.00
IF-MIB::ifNumber.0 = INTEGER: 19
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.2 = INTEGER: 2
IF-MIB::ifIndex.3 = INTEGER: 3
IF-MIB::ifIndex.4 = INTEGER: 4
IF-MIB::ifIndex.5 = INTEGER: 5
IF-MIB::ifIndex.6 = INTEGER: 6
IF-MIB::ifIndex.7 = INTEGER: 7
IF-MIB::ifIndex.8 = INTEGER: 8
IF-MIB::ifIndex.9 = INTEGER: 9
IF-MIB::ifIndex.10 = INTEGER: 10
IF-MIB::ifIndex.11 = INTEGER: 11
IF-MIB::ifIndex.12 = INTEGER: 12
IF-MIB::ifIndex.13 = INTEGER: 13
IF-MIB::ifIndex.14 = INTEGER: 14
IF-MIB::ifIndex.15 = INTEGER: 15
IF-MIB::ifIndex.16 = INTEGER: 16
IF-MIB::ifIndex.17 = INTEGER: 17
IF-MIB::ifIndex.18 = INTEGER: 18
IF-MIB::ifIndex.19 = INTEGER: 19
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
IF-MIB::ifDescr.3 = STRING: br0
IF-MIB::ifDescr.4 = STRING: wifi0
IF-MIB::ifDescr.5 = STRING: wifi1
IF-MIB::ifDescr.6 = STRING: ath0
IF-MIB::ifDescr.7 = STRING: ath1
IF-MIB::ifDescr.8 = STRING: ath2
IF-MIB::ifDescr.9 = STRING: ath3
IF-MIB::ifDescr.10 = STRING: ath4
IF-MIB::ifDescr.11 = STRING: ath5
IF-MIB::ifDescr.12 = STRING: ath6
IF-MIB::ifDescr.13 = STRING: ath10
IF-MIB::ifDescr.14 = STRING: ath11
IF-MIB::ifDescr.15 = STRING: ath12
IF-MIB::ifDescr.16 = STRING: ath13
IF-MIB::ifDescr.17 = STRING: ath14
IF-MIB::ifDescr.18 = STRING: ath15
IF-MIB::ifDescr.19 = STRING: ath16
IF-MIB::ifType.1 = INTEGER: softwareLoopback(24)
IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.3 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.4 = INTEGER: other(1)
IF-MIB::ifType.5 = INTEGER: other(1)
IF-MIB::ifType.6 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.7 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.8 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.9 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.10 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.11 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.12 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.13 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.14 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.15 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.16 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.17 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.18 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.19 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifMtu.1 = INTEGER: 16436
IF-MIB::ifMtu.2 = INTEGER: 1500
IF-MIB::ifMtu.3 = INTEGER: 1500
IF-MIB::ifMtu.4 = INTEGER: 1500
IF-MIB::ifMtu.5 = INTEGER: 1500
IF-MIB::ifMtu.6 = INTEGER: 1500
IF-MIB::ifMtu.7 = INTEGER: 1500
IF-MIB::ifMtu.8 = INTEGER: 1500
IF-MIB::ifMtu.9 = INTEGER: 1500
IF-MIB::ifMtu.10 = INTEGER: 1500
IF-MIB::ifMtu.11 = INTEGER: 1500
IF-MIB::ifMtu.12 = INTEGER: 1500
IF-MIB::ifMtu.13 = INTEGER: 1500
IF-MIB::ifMtu.14 = INTEGER: 1500
IF-MIB::ifMtu.15 = INTEGER: 1500
IF-MIB::ifMtu.16 = INTEGER: 1500
IF-MIB::ifMtu.17 = INTEGER: 1500
IF-MIB::ifMtu.18 = INTEGER: 1500
IF-MIB::ifMtu.19 = INTEGER: 1500
IF-MIB::ifSpeed.1 = Gauge32: 10000000
IF-MIB::ifSpeed.2 = Gauge32: 1000000000
IF-MIB::ifSpeed.3 = Gauge32: 0
IF-MIB::ifSpeed.4 = Gauge32: 0
IF-MIB::ifSpeed.5 = Gauge32: 0
IF-MIB::ifSpeed.6 = Gauge32: 0
IF-MIB::ifSpeed.7 = Gauge32: 0
IF-MIB::ifSpeed.8 = Gauge32: 0
IF-MIB::ifSpeed.9 = Gauge32: 0
IF-MIB::ifSpeed.10 = Gauge32: 0
IF-MIB::ifSpeed.11 = Gauge32: 0
IF-MIB::ifSpeed.12 = Gauge32: 0
IF-MIB::ifSpeed.13 = Gauge32: 0
IF-MIB::ifSpeed.14 = Gauge32: 0
IF-MIB::ifSpeed.15 = Gauge32: 0
IF-MIB::ifSpeed.16 = Gauge32: 0
IF-MIB::ifSpeed.17 = Gauge32: 0
IF-MIB::ifSpeed.18 = Gauge32: 0
IF-MIB::ifSpeed.19 = Gauge32: 0
IF-MIB::ifPhysAddress.1 = STRING:
IF-MIB::ifPhysAddress.2 = STRING: 1c:3b:f3:be:e1:84
IF-MIB::ifPhysAddress.3 = STRING: 1c:3b:f3:be:e1:84
IF-MIB::ifPhysAddress.4 = STRING: 1c:3b:f3:be:e1:84
IF-MIB::ifPhysAddress.5 = STRING: 1c:3b:f3:be:e1:85
IF-MIB::ifPhysAddress.6 = STRING: 1c:3b:f3:be:e1:84
IF-MIB::ifPhysAddress.7 = STRING: 22:3b:f3:be:e1:84
IF-MIB::ifPhysAddress.8 = STRING: 26:3b:f3:be:e1:84
IF-MIB::ifPhysAddress.9 = STRING: 2a:3b:f3:be:e1:84
IF-MIB::ifPhysAddress.10 = STRING: 2e:3b:f3:be:e1:84
IF-MIB::ifPhysAddress.11 = STRING: 32:3b:f3:be:e1:84
IF-MIB::ifPhysAddress.12 = STRING: 36:3b:f3:be:e1:84
IF-MIB::ifPhysAddress.13 = STRING: 1c:3b:f3:be:e1:85
IF-MIB::ifPhysAddress.14 = STRING: 22:3b:f3:be:e1:85
IF-MIB::ifPhysAddress.15 = STRING: 26:3b:f3:be:e1:85
IF-MIB::ifPhysAddress.16 = STRING: 2a:3b:f3:be:e1:85
IF-MIB::ifPhysAddress.17 = STRING: 2e:3b:f3:be:e1:85
IF-MIB::ifPhysAddress.18 = STRING: 32:3b:f3:be:e1:85
IF-MIB::ifPhysAddress.19 = STRING: 36:3b:f3:be:e1:85
IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
IF-MIB::ifAdminStatus.2 = INTEGER: up(1)
IF-MIB::ifAdminStatus.3 = INTEGER: up(1)
IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
IF-MIB::ifAdminStatus.5 = INTEGER: up(1)
IF-MIB::ifAdminStatus.6 = INTEGER: up(1)
IF-MIB::ifAdminStatus.7 = INTEGER: up(1)
IF-MIB::ifAdminStatus.8 = INTEGER: up(1)
IF-MIB::ifAdminStatus.9 = INTEGER: up(1)
IF-MIB::ifAdminStatus.10 = INTEGER: up(1)
IF-MIB::ifAdminStatus.11 = INTEGER: up(1)
IF-MIB::ifAdminStatus.12 = INTEGER: up(1)
IF-MIB::ifAdminStatus.13 = INTEGER: up(1)
IF-MIB::ifAdminStatus.14 = INTEGER: up(1)
IF-MIB::ifAdminStatus.15 = INTEGER: up(1)
IF-MIB::ifAdminStatus.16 = INTEGER: up(1)
IF-MIB::ifAdminStatus.17 = INTEGER: up(1)
IF-MIB::ifAdminStatus.18 = INTEGER: up(1)
IF-MIB::ifAdminStatus.19 = INTEGER: up(1)
IF-MIB::ifOperStatus.1 = INTEGER: up(1)
IF-MIB::ifOperStatus.2 = INTEGER: up(1)
IF-MIB::ifOperStatus.3 = INTEGER: up(1)
IF-MIB::ifOperStatus.4 = INTEGER: up(1)
IF-MIB::ifOperStatus.5 = INTEGER: up(1)
IF-MIB::ifOperStatus.6 = INTEGER: up(1)
IF-MIB::ifOperStatus.7 = INTEGER: up(1)
IF-MIB::ifOperStatus.8 = INTEGER: up(1)
IF-MIB::ifOperStatus.9 = INTEGER: up(1)
IF-MIB::ifOperStatus.10 = INTEGER: up(1)
IF-MIB::ifOperStatus.11 = INTEGER: up(1)
IF-MIB::ifOperStatus.12 = INTEGER: up(1)
IF-MIB::ifOperStatus.13 = INTEGER: up(1)
IF-MIB::ifOperStatus.14 = INTEGER: up(1)
IF-MIB::ifOperStatus.15 = INTEGER: up(1)
IF-MIB::ifOperStatus.16 = INTEGER: up(1)
IF-MIB::ifOperStatus.17 = INTEGER: up(1)
IF-MIB::ifOperStatus.18 = INTEGER: up(1)
IF-MIB::ifOperStatus.19 = INTEGER: up(1)
IF-MIB::ifLastChange.1 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.3 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.4 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.5 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.6 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.7 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.8 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.9 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.10 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.11 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.12 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.13 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.14 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.15 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.16 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.17 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.18 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.19 = Timeticks: (0) 0:00:00.00
IF-MIB::ifInOctets.1 = Counter32: 0
IF-MIB::ifInOctets.2 = Counter32: 3018727910
IF-MIB::ifInOctets.3 = Counter32: 56637864
IF-MIB::ifInOctets.4 = Counter32: 383407055
IF-MIB::ifInOctets.5 = Counter32: 1376381
IF-MIB::ifInOctets.6 = Counter32: 3894619
IF-MIB::ifInOctets.7 = Counter32: 628
IF-MIB::ifInOctets.8 = Counter32: 36960
IF-MIB::ifInOctets.9 = Counter32: 2479045457
IF-MIB::ifInOctets.10 = Counter32: 104428755
IF-MIB::ifInOctets.11 = Counter32: 2878891
IF-MIB::ifInOctets.12 = Counter32: 0
IF-MIB::ifInOctets.13 = Counter32: 583398
IF-MIB::ifInOctets.14 = Counter32: 0
IF-MIB::ifInOctets.15 = Counter32: 18113
IF-MIB::ifInOctets.16 = Counter32: 3144
IF-MIB::ifInOctets.17 = Counter32: 0
IF-MIB::ifInOctets.18 = Counter32: 670223
IF-MIB::ifInOctets.19 = Counter32: 0
IF-MIB::ifInUcastPkts.1 = Counter32: 0
IF-MIB::ifInUcastPkts.2 = Counter32: 37076458
IF-MIB::ifInUcastPkts.3 = Counter32: 25912288
IF-MIB::ifInUcastPkts.4 = Counter32: 136011348
IF-MIB::ifInUcastPkts.5 = Counter32: 8581
IF-MIB::ifInUcastPkts.6 = Counter32: 19763
IF-MIB::ifInUcastPkts.7 = Counter32: 4
IF-MIB::ifInUcastPkts.8 = Counter32: 226
IF-MIB::ifInUcastPkts.9 = Counter32: 6445197
IF-MIB::ifInUcastPkts.10 = Counter32: 955099
IF-MIB::ifInUcastPkts.11 = Counter32: 20720
IF-MIB::ifInUcastPkts.12 = Counter32: 0
IF-MIB::ifInUcastPkts.13 = Counter32: 2689
IF-MIB::ifInUcastPkts.14 = Counter32: 0
IF-MIB::ifInUcastPkts.15 = Counter32: 155
IF-MIB::ifInUcastPkts.16 = Counter32: 35
IF-MIB::ifInUcastPkts.17 = Counter32: 0
IF-MIB::ifInUcastPkts.18 = Counter32: 5005
IF-MIB::ifInUcastPkts.19 = Counter32: 0
IF-MIB::ifInNUcastPkts.1 = Counter32: 0
IF-MIB::ifInNUcastPkts.2 = Counter32: 0
IF-MIB::ifInNUcastPkts.3 = Counter32: 0
IF-MIB::ifInNUcastPkts.4 = Counter32: 0
IF-MIB::ifInNUcastPkts.5 = Counter32: 0
IF-MIB::ifInNUcastPkts.6 = Counter32: 0
IF-MIB::ifInNUcastPkts.7 = Counter32: 0
IF-MIB::ifInNUcastPkts.8 = Counter32: 0
IF-MIB::ifInNUcastPkts.9 = Counter32: 0
IF-MIB::ifInNUcastPkts.10 = Counter32: 0
IF-MIB::ifInNUcastPkts.11 = Counter32: 0
IF-MIB::ifInNUcastPkts.12 = Counter32: 0
IF-MIB::ifInNUcastPkts.13 = Counter32: 0
IF-MIB::ifInNUcastPkts.14 = Counter32: 0
IF-MIB::ifInNUcastPkts.15 = Counter32: 0
IF-MIB::ifInNUcastPkts.16 = Counter32: 0
IF-MIB::ifInNUcastPkts.17 = Counter32: 0
IF-MIB::ifInNUcastPkts.18 = Counter32: 0
IF-MIB::ifInNUcastPkts.19 = Counter32: 0
IF-MIB::ifInDiscards.1 = Counter32: 0
IF-MIB::ifInDiscards.2 = Counter32: 132757
IF-MIB::ifInDiscards.3 = Counter32: 4421828
IF-MIB::ifInDiscards.4 = Counter32: 0
IF-MIB::ifInDiscards.5 = Counter32: 0
IF-MIB::ifInDiscards.6 = Counter32: 3
IF-MIB::ifInDiscards.7 = Counter32: 0
IF-MIB::ifInDiscards.8 = Counter32: 0
IF-MIB::ifInDiscards.9 = Counter32: 1
IF-MIB::ifInDiscards.10 = Counter32: 0
IF-MIB::ifInDiscards.11 = Counter32: 0
IF-MIB::ifInDiscards.12 = Counter32: 0
IF-MIB::ifInDiscards.13 = Counter32: 0
IF-MIB::ifInDiscards.14 = Counter32: 0
IF-MIB::ifInDiscards.15 = Counter32: 0
IF-MIB::ifInDiscards.16 = Counter32: 0
IF-MIB::ifInDiscards.17 = Counter32: 0
IF-MIB::ifInDiscards.18 = Counter32: 0
IF-MIB::ifInDiscards.19 = Counter32: 0
IF-MIB::ifInErrors.1 = Counter32: 0
IF-MIB::ifInErrors.2 = Counter32: 0
IF-MIB::ifInErrors.3 = Counter32: 0
IF-MIB::ifInErrors.4 = Counter32: 0
IF-MIB::ifInErrors.5 = Counter32: 487
IF-MIB::ifInErrors.6 = Counter32: 3
IF-MIB::ifInErrors.7 = Counter32: 0
IF-MIB::ifInErrors.8 = Counter32: 0
IF-MIB::ifInErrors.9 = Counter32: 1
IF-MIB::ifInErrors.10 = Counter32: 0
IF-MIB::ifInErrors.11 = Counter32: 0
IF-MIB::ifInErrors.12 = Counter32: 0
IF-MIB::ifInErrors.13 = Counter32: 0
IF-MIB::ifInErrors.14 = Counter32: 0
IF-MIB::ifInErrors.15 = Counter32: 0
IF-MIB::ifInErrors.16 = Counter32: 0
IF-MIB::ifInErrors.17 = Counter32: 0
IF-MIB::ifInErrors.18 = Counter32: 0
IF-MIB::ifInErrors.19 = Counter32: 0
IF-MIB::ifInUnknownProtos.1 = Counter32: 0
IF-MIB::ifInUnknownProtos.2 = Counter32: 0
IF-MIB::ifInUnknownProtos.3 = Counter32: 0
IF-MIB::ifInUnknownProtos.4 = Counter32: 0
IF-MIB::ifInUnknownProtos.5 = Counter32: 0
IF-MIB::ifInUnknownProtos.6 = Counter32: 0
IF-MIB::ifInUnknownProtos.7 = Counter32: 0
IF-MIB::ifInUnknownProtos.8 = Counter32: 0
IF-MIB::ifInUnknownProtos.9 = Counter32: 0
IF-MIB::ifInUnknownProtos.10 = Counter32: 0
IF-MIB::ifInUnknownProtos.11 = Counter32: 0
IF-MIB::ifInUnknownProtos.12 = Counter32: 0
IF-MIB::ifInUnknownProtos.13 = Counter32: 0
IF-MIB::ifInUnknownProtos.14 = Counter32: 0
IF-MIB::ifInUnknownProtos.15 = Counter32: 0
IF-MIB::ifInUnknownProtos.16 = Counter32: 0
IF-MIB::ifInUnknownProtos.17 = Counter32: 0
IF-MIB::ifInUnknownProtos.18 = Counter32: 0
IF-MIB::ifInUnknownProtos.19 = Counter32: 0
IF-MIB::ifOutOctets.1 = Counter32: 0
IF-MIB::ifOutOctets.2 = Counter32: 2865729307
IF-MIB::ifOutOctets.3 = Counter32: 408299892
IF-MIB::ifOutOctets.4 = Counter32: 576951385
IF-MIB::ifOutOctets.5 = Counter32: 15054252
IF-MIB::ifOutOctets.6 = Counter32: 97189462
IF-MIB::ifOutOctets.7 = Counter32: 4920
IF-MIB::ifOutOctets.8 = Counter32: 313466
IF-MIB::ifOutOctets.9 = Counter32: 2840977473
IF-MIB::ifOutOctets.10 = Counter32: 218063042
IF-MIB::ifOutOctets.11 = Counter32: 33605131
IF-MIB::ifOutOctets.12 = Counter32: 0
IF-MIB::ifOutOctets.13 = Counter32: 3768939
IF-MIB::ifOutOctets.14 = Counter32: 0
IF-MIB::ifOutOctets.15 = Counter32: 69534
IF-MIB::ifOutOctets.16 = Counter32: 31015
IF-MIB::ifOutOctets.17 = Counter32: 0
IF-MIB::ifOutOctets.18 = Counter32: 12315773
IF-MIB::ifOutOctets.19 = Counter32: 0
IF-MIB::ifOutUcastPkts.1 = Counter32: 0
IF-MIB::ifOutUcastPkts.2 = Counter32: 8081425
IF-MIB::ifOutUcastPkts.3 = Counter32: 634878
IF-MIB::ifOutUcastPkts.4 = Counter32: 202178584
IF-MIB::ifOutUcastPkts.5 = Counter32: 41485
IF-MIB::ifOutUcastPkts.6 = Counter32: 194758
IF-MIB::ifOutUcastPkts.7 = Counter32: 10
IF-MIB::ifOutUcastPkts.8 = Counter32: 635
IF-MIB::ifOutUcastPkts.9 = Counter32: 11197952
IF-MIB::ifOutUcastPkts.10 = Counter32: 1942736
IF-MIB::ifOutUcastPkts.11 = Counter32: 63997
IF-MIB::ifOutUcastPkts.12 = Counter32: 0
IF-MIB::ifOutUcastPkts.13 = Counter32: 12989
IF-MIB::ifOutUcastPkts.14 = Counter32: 0
IF-MIB::ifOutUcastPkts.15 = Counter32: 115
IF-MIB::ifOutUcastPkts.16 = Counter32: 102
IF-MIB::ifOutUcastPkts.17 = Counter32: 0
IF-MIB::ifOutUcastPkts.18 = Counter32: 28279
IF-MIB::ifOutUcastPkts.19 = Counter32: 0
IF-MIB::ifOutNUcastPkts.1 = Counter32: 0
IF-MIB::ifOutNUcastPkts.2 = Counter32: 0
IF-MIB::ifOutNUcastPkts.3 = Counter32: 0
IF-MIB::ifOutNUcastPkts.4 = Counter32: 0
IF-MIB::ifOutNUcastPkts.5 = Counter32: 0
IF-MIB::ifOutNUcastPkts.6 = Counter32: 0
IF-MIB::ifOutNUcastPkts.7 = Counter32: 0
IF-MIB::ifOutNUcastPkts.8 = Counter32: 0
IF-MIB::ifOutNUcastPkts.9 = Counter32: 0
IF-MIB::ifOutNUcastPkts.10 = Counter32: 0
IF-MIB::ifOutNUcastPkts.11 = Counter32: 0
IF-MIB::ifOutNUcastPkts.12 = Counter32: 0
IF-MIB::ifOutNUcastPkts.13 = Counter32: 0
IF-MIB::ifOutNUcastPkts.14 = Counter32: 0
IF-MIB::ifOutNUcastPkts.15 = Counter32: 0
IF-MIB::ifOutNUcastPkts.16 = Counter32: 0
IF-MIB::ifOutNUcastPkts.17 = Counter32: 0
IF-MIB::ifOutNUcastPkts.18 = Counter32: 0
IF-MIB::ifOutNUcastPkts.19 = Counter32: 0
IF-MIB::ifOutDiscards.1 = Counter32: 0
IF-MIB::ifOutDiscards.2 = Counter32: 0
IF-MIB::ifOutDiscards.3 = Counter32: 0
IF-MIB::ifOutDiscards.4 = Counter32: 2389
IF-MIB::ifOutDiscards.5 = Counter32: 0
IF-MIB::ifOutDiscards.6 = Counter32: 3130886
IF-MIB::ifOutDiscards.7 = Counter32: 2980266
IF-MIB::ifOutDiscards.8 = Counter32: 275491
IF-MIB::ifOutDiscards.9 = Counter32: 401445
IF-MIB::ifOutDiscards.10 = Counter32: 9432206
IF-MIB::ifOutDiscards.11 = Counter32: 329855
IF-MIB::ifOutDiscards.12 = Counter32: 224669
IF-MIB::ifOutDiscards.13 = Counter32: 0
IF-MIB::ifOutDiscards.14 = Counter32: 0
IF-MIB::ifOutDiscards.15 = Counter32: 0
IF-MIB::ifOutDiscards.16 = Counter32: 0
IF-MIB::ifOutDiscards.17 = Counter32: 0
IF-MIB::ifOutDiscards.18 = Counter32: 0
IF-MIB::ifOutDiscards.19 = Counter32: 0
IF-MIB::ifOutErrors.1 = Counter32: 0
IF-MIB::ifOutErrors.2 = Counter32: 0
IF-MIB::ifOutErrors.3 = Counter32: 0
IF-MIB::ifOutErrors.4 = Counter32: 27854
IF-MIB::ifOutErrors.5 = Counter32: 0
IF-MIB::ifOutErrors.6 = Counter32: 0
IF-MIB::ifOutErrors.7 = Counter32: 0
IF-MIB::ifOutErrors.8 = Counter32: 0
IF-MIB::ifOutErrors.9 = Counter32: 0
IF-MIB::ifOutErrors.10 = Counter32: 0
IF-MIB::ifOutErrors.11 = Counter32: 0
IF-MIB::ifOutErrors.12 = Counter32: 0
IF-MIB::ifOutErrors.13 = Counter32: 1
IF-MIB::ifOutErrors.14 = Counter32: 0
IF-MIB::ifOutErrors.15 = Counter32: 0
IF-MIB::ifOutErrors.16 = Counter32: 0
IF-MIB::ifOutErrors.17 = Counter32: 0
IF-MIB::ifOutErrors.18 = Counter32: 11
IF-MIB::ifOutErrors.19 = Counter32: 0
IF-MIB::ifOutQLen.1 = Gauge32: 0
IF-MIB::ifOutQLen.2 = Gauge32: 0
IF-MIB::ifOutQLen.3 = Gauge32: 0
IF-MIB::ifOutQLen.4 = Gauge32: 0
IF-MIB::ifOutQLen.5 = Gauge32: 0
IF-MIB::ifOutQLen.6 = Gauge32: 0
IF-MIB::ifOutQLen.7 = Gauge32: 0
IF-MIB::ifOutQLen.8 = Gauge32: 0
IF-MIB::ifOutQLen.9 = Gauge32: 0
IF-MIB::ifOutQLen.10 = Gauge32: 0
IF-MIB::ifOutQLen.11 = Gauge32: 0
IF-MIB::ifOutQLen.12 = Gauge32: 0
IF-MIB::ifOutQLen.13 = Gauge32: 0
IF-MIB::ifOutQLen.14 = Gauge32: 0
IF-MIB::ifOutQLen.15 = Gauge32: 0
IF-MIB::ifOutQLen.16 = Gauge32: 0
IF-MIB::ifOutQLen.17 = Gauge32: 0
IF-MIB::ifOutQLen.18 = Gauge32: 0
IF-MIB::ifOutQLen.19 = Gauge32: 0
IF-MIB::ifSpecific.1 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.2 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.3 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.4 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.5 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.6 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.7 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.8 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.9 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.10 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.11 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.12 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.13 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.14 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.15 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.16 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.17 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.18 = OID: SNMPv2-SMI::zeroDotZero
IF-MIB::ifSpecific.19 = OID: SNMPv2-SMI::zeroDotZero
SNMPv2-SMI::mib-2.3.1.1.1.3.1.172.16.126.254 = INTEGER: 3
SNMPv2-SMI::mib-2.3.1.1.2.3.1.172.16.126.254 = Hex-STRING: 00 09 0F 09 00 12
SNMPv2-SMI::mib-2.3.1.1.3.3.1.172.16.126.254 = IpAddress: 172.16.126.254
IP-MIB::ipForwarding.0 = INTEGER: forwarding(1)
IP-MIB::ipDefaultTTL.0 = INTEGER: 64
IP-MIB::ipInReceives.0 = Counter32: 6354664
IP-MIB::ipInHdrErrors.0 = Counter32: 0
IP-MIB::ipInAddrErrors.0 = Counter32: 0
IP-MIB::ipForwDatagrams.0 = Counter32: 0
IP-MIB::ipInUnknownProtos.0 = Counter32: 0
IP-MIB::ipInDiscards.0 = Counter32: 0
IP-MIB::ipInDelivers.0 = Counter32: 3679386
IP-MIB::ipOutRequests.0 = Counter32: 351289
IP-MIB::ipOutDiscards.0 = Counter32: 0
IP-MIB::ipOutNoRoutes.0 = Counter32: 0
IP-MIB::ipReasmTimeout.0 = INTEGER: 3 seconds
IP-MIB::ipReasmReqds.0 = Counter32: 47110
IP-MIB::ipReasmOKs.0 = Counter32: 6661
IP-MIB::ipReasmFails.0 = Counter32: 3
IP-MIB::ipFragOKs.0 = Counter32: 0
IP-MIB::ipFragFails.0 = Counter32: 0
IP-MIB::ipFragCreates.0 = Counter32: 0
IP-MIB::ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1
IP-MIB::ipAdEntAddr.172.16.126.158 = IpAddress: 172.16.126.158
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.172.16.126.158 = INTEGER: 3
IP-MIB::ipAdEntNetMask.127.0.0.1 = IpAddress: 255.0.0.0
IP-MIB::ipAdEntNetMask.172.16.126.158 = IpAddress: 255.255.255.0
IP-MIB::ipAdEntBcastAddr.127.0.0.1 = INTEGER: 0
IP-MIB::ipAdEntBcastAddr.172.16.126.158 = INTEGER: 1
IP-MIB::ip.21.1.1.0.0.0.0 = IpAddress: 0.0.0.0
IP-MIB::ip.21.1.1.172.16.126.0 = IpAddress: 172.16.126.0
IP-MIB::ip.21.1.2.0.0.0.0 = INTEGER: 3
IP-MIB::ip.21.1.2.172.16.126.0 = INTEGER: 3
IP-MIB::ip.21.1.3.0.0.0.0 = INTEGER: 1
IP-MIB::ip.21.1.3.172.16.126.0 = INTEGER: 0
IP-MIB::ip.21.1.7.0.0.0.0 = IpAddress: 172.16.126.254
IP-MIB::ip.21.1.7.172.16.126.0 = IpAddress: 0.0.0.0
IP-MIB::ip.21.1.8.0.0.0.0 = INTEGER: 4
IP-MIB::ip.21.1.8.172.16.126.0 = INTEGER: 3
IP-MIB::ip.21.1.9.0.0.0.0 = INTEGER: 2
IP-MIB::ip.21.1.9.172.16.126.0 = INTEGER: 2
IP-MIB::ip.21.1.11.0.0.0.0 = IpAddress: 0.0.0.0
IP-MIB::ip.21.1.11.172.16.126.0 = IpAddress: 255.255.255.0
IP-MIB::ip.21.1.13.0.0.0.0 = OID: SNMPv2-SMI::zeroDotZero
IP-MIB::ip.21.1.13.172.16.126.0 = OID: SNMPv2-SMI::zeroDotZero
IP-MIB::ipNetToMediaIfIndex.3.172.16.126.254 = INTEGER: 3
IP-MIB::ipNetToMediaPhysAddress.3.172.16.126.254 = STRING: 0:9:f:9:0:12
IP-MIB::ipNetToMediaNetAddress.3.172.16.126.254 = IpAddress: 172.16.126.254
IP-MIB::ipNetToMediaType.3.172.16.126.254 = INTEGER: dynamic(3)
IP-MIB::ipRoutingDiscards.0 = Counter32: 0
IP-MIB::icmpInMsgs.0 = Counter32: 5996
IP-MIB::icmpInErrors.0 = Counter32: 2
IP-MIB::icmpInDestUnreachs.0 = Counter32: 613
IP-MIB::icmpInTimeExcds.0 = Counter32: 0
IP-MIB::icmpInParmProbs.0 = Counter32: 0
IP-MIB::icmpInSrcQuenchs.0 = Counter32: 0
IP-MIB::icmpInRedirects.0 = Counter32: 0
IP-MIB::icmpInEchos.0 = Counter32: 5383
IP-MIB::icmpInEchoReps.0 = Counter32: 0
IP-MIB::icmpInTimestamps.0 = Counter32: 0
IP-MIB::icmpInTimestampReps.0 = Counter32: 0
IP-MIB::icmpInAddrMasks.0 = Counter32: 0
IP-MIB::icmpInAddrMaskReps.0 = Counter32: 0
IP-MIB::icmpOutMsgs.0 = Counter32: 5381
IP-MIB::icmpOutErrors.0 = Counter32: 0
IP-MIB::icmpOutDestUnreachs.0 = Counter32: 0
IP-MIB::icmpOutTimeExcds.0 = Counter32: 0
IP-MIB::icmpOutParmProbs.0 = Counter32: 0
IP-MIB::icmpOutSrcQuenchs.0 = Counter32: 0
IP-MIB::icmpOutRedirects.0 = Counter32: 0
IP-MIB::icmpOutEchos.0 = Counter32: 0
IP-MIB::icmpOutEchoReps.0 = Counter32: 5381
IP-MIB::icmpOutTimestamps.0 = Counter32: 0
IP-MIB::icmpOutTimestampReps.0 = Counter32: 0
IP-MIB::icmpOutAddrMasks.0 = Counter32: 0
IP-MIB::icmpOutAddrMaskReps.0 = Counter32: 0
IP-MIB::icmpStatsInMsgs.ipv4 = Counter32: 5996
IP-MIB::icmpStatsInMsgs.ipv6 = Counter32: 0
IP-MIB::icmpStatsInErrors.ipv4 = Counter32: 2
IP-MIB::icmpStatsInErrors.ipv6 = Counter32: 0
IP-MIB::icmpStatsOutMsgs.ipv4 = Counter32: 5381
IP-MIB::icmpStatsOutMsgs.ipv6 = Counter32: 0
IP-MIB::icmpStatsOutErrors.ipv4 = Counter32: 0
IP-MIB::icmpStatsOutErrors.ipv6 = Counter32: 0
IP-MIB::icmpMsgStatsInPkts.ipv4.3 = Counter32: 613
IP-MIB::icmpMsgStatsInPkts.ipv4.8 = Counter32: 5383
IP-MIB::icmpMsgStatsOutPkts.ipv4.0 = Counter32: 5381
TCP-MIB::tcpRtoAlgorithm.0 = INTEGER: other(1)
TCP-MIB::tcpRtoMin.0 = INTEGER: 200 milliseconds
TCP-MIB::tcpRtoMax.0 = INTEGER: 120000 milliseconds
TCP-MIB::tcpMaxConn.0 = INTEGER: -1
TCP-MIB::tcpActiveOpens.0 = Counter32: 2
TCP-MIB::tcpPassiveOpens.0 = Counter32: 0
TCP-MIB::tcpAttemptFails.0 = Counter32: 0
TCP-MIB::tcpEstabResets.0 = Counter32: 0
TCP-MIB::tcpCurrEstab.0 = Gauge32: 1
TCP-MIB::tcpInSegs.0 = Counter32: 66977
TCP-MIB::tcpOutSegs.0 = Counter32: 120776
TCP-MIB::tcpRetransSegs.0 = Counter32: 15
TCP-MIB::tcpConnState.0.0.0.0.80.0.0.0.0.0 = INTEGER: listen(2)
TCP-MIB::tcpConnState.0.0.0.0.443.0.0.0.0.0 = INTEGER: listen(2)
TCP-MIB::tcpConnState.0.0.0.0.22080.0.0.0.0.0 = INTEGER: listen(2)
TCP-MIB::tcpConnState.0.0.0.0.22443.0.0.0.0.0 = INTEGER: listen(2)
TCP-MIB::tcpConnState.172.16.126.158.48894.172.16.94.72.29811 = INTEGER: established(5)
TCP-MIB::tcpConnLocalAddress.0.0.0.0.80.0.0.0.0.0 = IpAddress: 0.0.0.0
TCP-MIB::tcpConnLocalAddress.0.0.0.0.443.0.0.0.0.0 = IpAddress: 0.0.0.0
TCP-MIB::tcpConnLocalAddress.0.0.0.0.22080.0.0.0.0.0 = IpAddress: 0.0.0.0
TCP-MIB::tcpConnLocalAddress.0.0.0.0.22443.0.0.0.0.0 = IpAddress: 0.0.0.0
TCP-MIB::tcpConnLocalAddress.172.16.126.158.48894.172.16.94.72.29811 = IpAddress: 172.16.126.158
TCP-MIB::tcpConnLocalPort.0.0.0.0.80.0.0.0.0.0 = INTEGER: 80
TCP-MIB::tcpConnLocalPort.0.0.0.0.443.0.0.0.0.0 = INTEGER: 443
TCP-MIB::tcpConnLocalPort.0.0.0.0.22080.0.0.0.0.0 = INTEGER: 22080
TCP-MIB::tcpConnLocalPort.0.0.0.0.22443.0.0.0.0.0 = INTEGER: 22443
TCP-MIB::tcpConnLocalPort.172.16.126.158.48894.172.16.94.72.29811 = INTEGER: 48894
TCP-MIB::tcpConnRemAddress.0.0.0.0.80.0.0.0.0.0 = IpAddress: 0.0.0.0
TCP-MIB::tcpConnRemAddress.0.0.0.0.443.0.0.0.0.0 = IpAddress: 0.0.0.0
TCP-MIB::tcpConnRemAddress.0.0.0.0.22080.0.0.0.0.0 = IpAddress: 0.0.0.0
TCP-MIB::tcpConnRemAddress.0.0.0.0.22443.0.0.0.0.0 = IpAddress: 0.0.0.0
TCP-MIB::tcpConnRemAddress.172.16.126.158.48894.172.16.94.72.29811 = IpAddress: 172.16.94.72
TCP-MIB::tcpConnRemPort.0.0.0.0.80.0.0.0.0.0 = INTEGER: 0
TCP-MIB::tcpConnRemPort.0.0.0.0.443.0.0.0.0.0 = INTEGER: 0
TCP-MIB::tcpConnRemPort.0.0.0.0.22080.0.0.0.0.0 = INTEGER: 0
TCP-MIB::tcpConnRemPort.0.0.0.0.22443.0.0.0.0.0 = INTEGER: 0
TCP-MIB::tcpConnRemPort.172.16.126.158.48894.172.16.94.72.29811 = INTEGER: 29811
TCP-MIB::tcpInErrs.0 = Counter32: 0
TCP-MIB::tcpOutRsts.0 = Counter32: 0
UDP-MIB::udpInDatagrams.0 = Counter32: 611
UDP-MIB::udpNoPorts.0 = Counter32: 0
UDP-MIB::udpInErrors.0 = Counter32: 0
UDP-MIB::udpOutDatagrams.0 = Counter32: 225241
UDP-MIB::udpLocalAddress.0.0.0.0.161 = IpAddress: 0.0.0.0
UDP-MIB::udpLocalAddress.0.0.0.0.20003 = IpAddress: 0.0.0.0
UDP-MIB::udpLocalPort.0.0.0.0.161 = INTEGER: 161
UDP-MIB::udpLocalPort.0.0.0.0.20003 = INTEGER: 20003
SNMPv2-MIB::snmpInPkts.0 = Counter32: 586
SNMPv2-MIB::snmpOutPkts.0 = Counter32: 586
SNMPv2-MIB::snmpInBadVersions.0 = Counter32: 0
SNMPv2-MIB::snmpInBadCommunityNames.0 = Counter32: 0
SNMPv2-MIB::snmpInBadCommunityUses.0 = Counter32: 0
SNMPv2-MIB::snmpInASNParseErrs.0 = Counter32: 0
SNMPv2-MIB::snmpInTooBigs.0 = Counter32: 0
SNMPv2-MIB::snmpInNoSuchNames.0 = Counter32: 0
SNMPv2-MIB::snmpInBadValues.0 = Counter32: 0
SNMPv2-MIB::snmpInReadOnlys.0 = Counter32: 0
SNMPv2-MIB::snmpInGenErrs.0 = Counter32: 0
SNMPv2-MIB::snmpInTotalReqVars.0 = Counter32: 596
SNMPv2-MIB::snmpInTotalSetVars.0 = Counter32: 0
SNMPv2-MIB::snmpInGetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpInGetNexts.0 = Counter32: 600
SNMPv2-MIB::snmpInSetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpInGetResponses.0 = Counter32: 0
SNMPv2-MIB::snmpInTraps.0 = Counter32: 0
SNMPv2-MIB::snmpOutTooBigs.0 = Counter32: 0
SNMPv2-MIB::snmpOutNoSuchNames.0 = Counter32: 0
SNMPv2-MIB::snmpOutBadValues.0 = Counter32: 0
SNMPv2-MIB::snmpOutGenErrs.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetNexts.0 = Counter32: 0
SNMPv2-MIB::snmpOutSetRequests.0 = Counter32: 0
SNMPv2-MIB::snmpOutGetResponses.0 = Counter32: 610
SNMPv2-MIB::snmpOutTraps.0 = Counter32: 0
SNMPv2-MIB::snmpEnableAuthenTraps.0 = INTEGER: disabled(2)
SNMPv2-MIB::snmpSilentDrops.0 = Counter32: 0
SNMPv2-MIB::snmpProxyDrops.0 = Counter32: 0
IF-MIB::ifTableLastChange.0 = Timeticks: (0) 0:00:00.00
@@ -0,0 +1,509 @@
#!/bin/bash
# - VAR
# - Bash info
APPNAME=$(basename $0)
NAME="Check TplinkAp"
AUTHOR="Kalarumeth"
VERSION="v0.1"
URL="https://github.com/Kalarumeth"
# - Default settings for connection
COMMUNITY="public"
HOST_NAME="localhost"
SNMPVERSION="2c"
# - State Variables
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
STATE=$STATE_OK
# - OID
TpLink.OIDS() {
OID_nameIF="1.3.6.1.2.1.2.2.1.2"
OID_typeIF="1.3.6.1.2.1.2.2.1.3"
OID_statusIF="1.3.6.1.2.1.2.2.1.8"
OID_clientCon="1.3.6.1.4.1.11863.10.1.1.1"
OID_arrayMac="1.3.6.1.4.1.11863.10.1.1.2.1.2"
}
# - MAIN CODE
Script.HostAlive() {
for server in $HOST_NAME; do
ping -c1 -W1 -q $server &>/dev/null
if [[ $? != 0 ]] ; then
printf "%s\n" "$server is unreachable"
exit $STATE_UNK
fi
done
}
Script.SNMP() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oe -c $COMMUNITY $HOST_NAME $1
}
Script.SNMP.Hex() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oa -c $COMMUNITY $HOST_NAME $1
}
# - TpLink AP Health Check
TpLink.Main() {
Script.HostAlive
case $1 in
client)
TpLink.ClientConnected
exit $STATE ;;
if)
TpLink.IF
exit $STATE ;;
*)
echo "Unknown check!"
Help.IPMI
exit $STATE_UNK ;;
esac
}
TpLink.GetData() {
TpLink.OIDS
case $1 in
interface)
nameIF=($(Script.SNMP $OID_nameIF | cut -d '"' -f 2 | sed "s/$//g"))
statusIF=($(Script.SNMP $OID_statusIF | cut -d ' ' -f 4 | sed "s/$//g"))
typeIF=($(Script.SNMP $OID_typeIF | cut -d ' ' -f 4 | sed "s/$//g")) ;;
client)
clientCon=$(Script.SNMP $OID_clientCon | cut -d ' ' -f 4 | sed "s/$//g")
raw_arrayMac=$(Script.SNMP.Hex $OID_arrayMac | cut -d '"' -f 2 | cut -d '.' -f 1 | sed "s/-/:/g")
readarray -t addressMac <<< $raw_arrayMac ;;
esac
}
TpLink.IF() {
TpLink.GetData interface
TpLink.IF.Header
for((i=0; i<${#nameIF[@]}; i++))
do
TpLink.IF.operStatus
printf "%s\t" "${nameIF[$i]}"
TpLink.IF.IANAifType
done
}
TpLink.IF.Header() {
WarningCounter=0
CriticalCounter=0
for((i=0; i<${#name[@]}; i++)); do
if [[ ${name[$i]} == *"wifi"* ]] ; then
for value in "${statusIF[$i]}"; do
if [[ $value != 1 ]] && [[ $value != 2 ]]; then
WarningCounter=$(( WarningCounter + 1 ))
elif [[ $value == 2 ]]; then
CriticalCounter=$(( CriticalCounter + 1 ))
fi
done
elif [[ ${name[$i]} == *"eth"* ]] ; then
for value in "${statusIF[$i]}"; do
if [[ $value != 1 ]] && [[ $value != 2 ]]; then
WarningCounter=$(( WarningCounter + 1 ))
elif [[ $value == 2 ]]; then
CriticalCounter=$(( CriticalCounter + 1 ))
fi
done
fi
done
for Error in "$(( WarningCounter + CriticalCounter ))"; do
if [[ $WarningCounter == 0 ]] && [[ $CriticalCounter == 0 ]] ; then
printf "%s\t%s\n\n" "OK!" "All interFace is Up"
elif [[ $WarningCounter != 0 ]] && [[ $CriticalCounter == 0 ]] ; then
printf "%s\t%s\n\n" "WARNING!" "$Error interFace with problem"
elif [[ $CriticalCounter != 0 ]] ; then
printf "%s\t%s\n\n" "CRITICAL!" "$Error interFace with problem"
fi
done
printf "%s\t%s\t%s\n" "STATUS" "NAME" "TYPE" "=============================="
}
TpLink.IF.operStatus() {
case ${statusIF[$i]} in
1) printf "%s\t" "Up" ;;
2) printf "%s\t" "Down" ;;
3) printf "%s\t" "Testing" ;;
4) printf "%s\t" "Unknown" ;;
5) printf "%s\t" "Dormant" ;;
6) printf "%s\t" "notPresent" ;;
7) printf "%s\t" "lowerLayerDown" ;;
esac
}
TpLink.IF.IANAifType() {
case ${typeIF[$i]} in
1) printf "%s\n" "other" ;;
2) printf "%s\n" "regular1822" ;;
3) printf "%s\n" "hdh1822" ;;
4) printf "%s\n" "ddnX25" ;;
5) printf "%s\n" "rfc877x25" ;;
6) printf "%s\n" "ethernetCsmacd" ;;
7) printf "%s\n" "iso88023Csmacd" ;;
8) printf "%s\n" "iso88024TokenBus" ;;
9) printf "%s\n" "iso88025TokenRing" ;;
10) printf "%s\n" "iso88026Man" ;;
11) printf "%s\n" "starLan" ;;
12) printf "%s\n" "proteon10Mbit" ;;
13) printf "%s\n" "proteon80Mbit" ;;
14) printf "%s\n" "hyperchannel" ;;
15) printf "%s\n" "fddi" ;;
16) printf "%s\n" "lapb" ;;
17) printf "%s\n" "sdlc" ;;
18) printf "%s\n" "ds1" ;;
19) printf "%s\n" "e1" ;;
20) printf "%s\n" "basicISDN" ;;
21) printf "%s\n" "primaryISDN" ;;
22) printf "%s\n" "propPointToPointSerial" ;;
23) printf "%s\n" "ppp" ;;
24) printf "%s\n" "softwareLoopback" ;;
25) printf "%s\n" "eon" ;;
26) printf "%s\n" "ethernet3Mbit" ;;
27) printf "%s\n" "nsip" ;;
28) printf "%s\n" "slip" ;;
29) printf "%s\n" "ultra" ;;
30) printf "%s\n" "ds3" ;;
31) printf "%s\n" "sip" ;;
32) printf "%s\n" "frameRelay" ;;
33) printf "%s\n" "rs232" ;;
34) printf "%s\n" "para" ;;
35) printf "%s\n" "arcnet" ;;
36) printf "%s\n" "arcnetPlus" ;;
37) printf "%s\n" "atm" ;;
38) printf "%s\n" "miox25" ;;
39) printf "%s\n" "sonet" ;;
40) printf "%s\n" "x25ple" ;;
41) printf "%s\n" "iso88022llc" ;;
42) printf "%s\n" "localTalk" ;;
43) printf "%s\n" "smdsDxi" ;;
44) printf "%s\n" "frameRelayService" ;;
45) printf "%s\n" "v35" ;;
46) printf "%s\n" "hssi" ;;
47) printf "%s\n" "hippi" ;;
48) printf "%s\n" "modem" ;;
49) printf "%s\n" "aal5" ;;
50) printf "%s\n" "sonetPath" ;;
51) printf "%s\n" "sonetVT" ;;
52) printf "%s\n" "smdsIcip" ;;
53) printf "%s\n" "propVirtual" ;;
54) printf "%s\n" "propMultiplexor" ;;
55) printf "%s\n" "ieee80212" ;;
56) printf "%s\n" "fibreChannel" ;;
57) printf "%s\n" "hippiInterface" ;;
58) printf "%s\n" "frameRelayInterconnect" ;;
59) printf "%s\n" "aflane8023" ;;
60) printf "%s\n" "aflane8025" ;;
61) printf "%s\n" "cctEmul" ;;
62) printf "%s\n" "fastEther" ;;
63) printf "%s\n" "isdn" ;;
64) printf "%s\n" "v11" ;;
65) printf "%s\n" "v36" ;;
66) printf "%s\n" "g703at64k" ;;
67) printf "%s\n" "g703at2mb" ;;
68) printf "%s\n" "qllc" ;;
69) printf "%s\n" "fastEtherFX" ;;
70) printf "%s\n" "channel" ;;
71) printf "%s\n" "ieee80211" ;;
72) printf "%s\n" "ibm370parChan" ;;
73) printf "%s\n" "escon" ;;
74) printf "%s\n" "dlsw" ;;
75) printf "%s\n" "isdns" ;;
76) printf "%s\n" "isdnu" ;;
77) printf "%s\n" "lapd" ;;
78) printf "%s\n" "ipSwitch" ;;
79) printf "%s\n" "rsrb" ;;
80) printf "%s\n" "atmLogical" ;;
81) printf "%s\n" "ds0" ;;
82) printf "%s\n" "ds0Bundle" ;;
83) printf "%s\n" "bsc" ;;
84) printf "%s\n" "async" ;;
85) printf "%s\n" "cnr" ;;
86) printf "%s\n" "iso88025Dtr" ;;
87) printf "%s\n" "eplrs" ;;
88) printf "%s\n" "arap" ;;
89) printf "%s\n" "propCnls" ;;
90) printf "%s\n" "hostPad" ;;
91) printf "%s\n" "termPad" ;;
92) printf "%s\n" "frameRelayMPI" ;;
93) printf "%s\n" "x213" ;;
94) printf "%s\n" "adsl" ;;
95) printf "%s\n" "radsl" ;;
96) printf "%s\n" "sdsl" ;;
97) printf "%s\n" "vdsl" ;;
98) printf "%s\n" "iso88025CRFPInt" ;;
99) printf "%s\n" "myrinet" ;;
100) printf "%s\n" "voiceEM" ;;
101) printf "%s\n" "voiceFXO" ;;
102) printf "%s\n" "voiceFXS" ;;
103) printf "%s\n" "voiceEncap" ;;
104) printf "%s\n" "voiceOverIp" ;;
105) printf "%s\n" "atmDxi" ;;
106) printf "%s\n" "atmFuni" ;;
107) printf "%s\n" "atmIma" ;;
108) printf "%s\n" "pppMultilinkBundle" ;;
109) printf "%s\n" "ipOverCdlc" ;;
110) printf "%s\n" "ipOverClaw" ;;
111) printf "%s\n" "stackToStack" ;;
112) printf "%s\n" "virtualIpAddress" ;;
113) printf "%s\n" "mpc" ;;
114) printf "%s\n" "ipOverAtm" ;;
115) printf "%s\n" "iso88025Fiber" ;;
116) printf "%s\n" "tdlc" ;;
117) printf "%s\n" "gigabitEthernet" ;;
118) printf "%s\n" "hdlc" ;;
119) printf "%s\n" "lapf" ;;
120) printf "%s\n" "v37" ;;
121) printf "%s\n" "x25mlp" ;;
122) printf "%s\n" "x25huntGroup" ;;
123) printf "%s\n" "transpHdlc" ;;
124) printf "%s\n" "interleave" ;;
125) printf "%s\n" "fast" ;;
126) printf "%s\n" "ip" ;;
127) printf "%s\n" "docsCableMaclayer" ;;
128) printf "%s\n" "docsCableDownstream" ;;
129) printf "%s\n" "docsCableUpstream" ;;
130) printf "%s\n" "a12MppSwitch" ;;
131) printf "%s\n" "tunnel" ;;
132) printf "%s\n" "coffee" ;;
133) printf "%s\n" "ces" ;;
134) printf "%s\n" "atmSubInterface" ;;
135) printf "%s\n" "l2vlan" ;;
136) printf "%s\n" "l3ipvlan" ;;
137) printf "%s\n" "l3ipxvlan" ;;
138) printf "%s\n" "digitalPowerline" ;;
139) printf "%s\n" "mediaMailOverIp" ;;
140) printf "%s\n" "dtm" ;;
141) printf "%s\n" "dcn" ;;
142) printf "%s\n" "ipForward" ;;
143) printf "%s\n" "msdsl" ;;
144) printf "%s\n" "ieee1394" ;;
145) printf "%s\n" "if-gsn" ;;
146) printf "%s\n" "dvbRccMacLayer" ;;
147) printf "%s\n" "dvbRccDownstream" ;;
148) printf "%s\n" "dvbRccUpstream" ;;
149) printf "%s\n" "atmVirtual" ;;
150) printf "%s\n" "mplsTunnel" ;;
151) printf "%s\n" "srp" ;;
152) printf "%s\n" "voiceOverAtm" ;;
153) printf "%s\n" "voiceOverFrameRelay" ;;
154) printf "%s\n" "idsl" ;;
155) printf "%s\n" "compositeLink" ;;
156) printf "%s\n" "ss7SigLink" ;;
157) printf "%s\n" "propWirelessP2P" ;;
158) printf "%s\n" "frForward" ;;
159) printf "%s\n" "rfc1483" ;;
160) printf "%s\n" "usb" ;;
161) printf "%s\n" "ieee8023adLag" ;;
162) printf "%s\n" "bgppolicyaccounting" ;;
163) printf "%s\n" "frf16MfrBundle" ;;
164) printf "%s\n" "h323Gatekeeper" ;;
165) printf "%s\n" "h323Proxy" ;;
166) printf "%s\n" "mpls" ;;
167) printf "%s\n" "mfSigLink" ;;
168) printf "%s\n" "hdsl2" ;;
169) printf "%s\n" "shdsl" ;;
170) printf "%s\n" "ds1FDL" ;;
171) printf "%s\n" "pos" ;;
172) printf "%s\n" "dvbAsiIn" ;;
173) printf "%s\n" "dvbAsiOut" ;;
174) printf "%s\n" "plc" ;;
175) printf "%s\n" "nfas" ;;
176) printf "%s\n" "tr008" ;;
177) printf "%s\n" "gr303RDT" ;;
178) printf "%s\n" "gr303IDT" ;;
179) printf "%s\n" "isup" ;;
180) printf "%s\n" "propDocsWirelessMaclayer" ;;
181) printf "%s\n" "propDocsWirelessDownstream" ;;
182) printf "%s\n" "propDocsWirelessUpstream" ;;
183) printf "%s\n" "hiperlan2" ;;
184) printf "%s\n" "propBWAp2Mp" ;;
185) printf "%s\n" "sonetOverheadChannel" ;;
186) printf "%s\n" "digitalWrapperOverheadChannel" ;;
187) printf "%s\n" "aal2" ;;
188) printf "%s\n" "radioMAC" ;;
189) printf "%s\n" "atmRadio" ;;
190) printf "%s\n" "imt" ;;
191) printf "%s\n" "mvl" ;;
192) printf "%s\n" "reachDSL" ;;
193) printf "%s\n" "frDlciEndPt" ;;
194) printf "%s\n" "atmVciEndPt" ;;
195) printf "%s\n" "opticalChannel" ;;
196) printf "%s\n" "opticalTransport" ;;
197) printf "%s\n" "propAtm" ;;
198) printf "%s\n" "voiceOverCable" ;;
199) printf "%s\n" "infiniband" ;;
200) printf "%s\n" "teLink" ;;
201) printf "%s\n" "q2931" ;;
202) printf "%s\n" "virtualTg" ;;
203) printf "%s\n" "sipTg" ;;
204) printf "%s\n" "sipSig" ;;
205) printf "%s\n" "docsCableUpstreamChannel" ;;
206) printf "%s\n" "econet" ;;
207) printf "%s\n" "pon155" ;;
208) printf "%s\n" "pon622" ;;
209) printf "%s\n" "bridge" ;;
210) printf "%s\n" "linegroup" ;;
211) printf "%s\n" "voiceEMFGD" ;;
212) printf "%s\n" "voiceFGDEANA" ;;
213) printf "%s\n" "voiceDID" ;;
214) printf "%s\n" "mpegTransport" ;;
215) printf "%s\n" "sixToFour" ;;
216) printf "%s\n" "gtp" ;;
217) printf "%s\n" "pdnEtherLoop1" ;;
218) printf "%s\n" "pdnEtherLoop2" ;;
219) printf "%s\n" "opticalChannelGroup" ;;
220) printf "%s\n" "homepna" ;;
221) printf "%s\n" "gfp" ;;
222) printf "%s\n" "ciscoISLvlan" ;;
223) printf "%s\n" "actelisMetaLOOP" ;;
224) printf "%s\n" "fcipLink" ;;
225) printf "%s\n" "rpr" ;;
226) printf "%s\n" "qam" ;;
227) printf "%s\n" "lmp" ;;
228) printf "%s\n" "cblVectaStar" ;;
229) printf "%s\n" "docsCableMCmtsDownstream" ;;
230) printf "%s\n" "adsl2" ;;
231) printf "%s\n" "macSecControlledIF" ;;
232) printf "%s\n" "macSecUncontrolledIF" ;;
233) printf "%s\n" "aviciOpticalEther" ;;
234) printf "%s\n" "atmbond" ;;
235) printf "%s\n" "voiceFGDOS" ;;
236) printf "%s\n" "mocaVersion1" ;;
237) printf "%s\n" "ieee80216WMAN" ;;
238) printf "%s\n" "adsl2plus" ;;
239) printf "%s\n" "dvbRcsMacLayer" ;;
240) printf "%s\n" "dvbTdm" ;;
241) printf "%s\n" "dvbRcsTdma" ;;
242) printf "%s\n" "x86Laps" ;;
243) printf "%s\n" "wwanPP" ;;
244) printf "%s\n" "wwanPP2" ;;
245) printf "%s\n" "voiceEBS" ;;
246) printf "%s\n" "ifPwType" ;;
247) printf "%s\n" "ilan" ;;
248) printf "%s\n" "pip" ;;
249) printf "%s\n" "aluELP" ;;
250) printf "%s\n" "gpon" ;;
251) printf "%s\n" "vdsl2" ;;
252) printf "%s\n" "capwapDot11Profile" ;;
253) printf "%s\n" "capwapDot11Bss" ;;
254) printf "%s\n" "capwapWtpVirtualRadio" ;;
255) printf "%s\n" "bits" ;;
256) printf "%s\n" "docsCableUpstreamRfPort" ;;
257) printf "%s\n" "cableDownstreamRfPort" ;;
258) printf "%s\n" "vmwareVirtualNic" ;;
259) printf "%s\n" "ieee802154" ;;
260) printf "%s\n" "otnOdu" ;;
261) printf "%s\n" "otnOtu" ;;
262) printf "%s\n" "ifVfiType" ;;
263) printf "%s\n" "g9981" ;;
264) printf "%s\n" "g9982" ;;
265) printf "%s\n" "g9983" ;;
266) printf "%s\n" "aluEpon" ;;
267) printf "%s\n" "aluEponOnu" ;;
268) printf "%s\n" "aluEponPhysicalUni" ;;
269) printf "%s\n" "aluEponLogicalLink" ;;
270) printf "%s\n" "aluGponOnu" ;;
271) printf "%s\n" "aluGponPhysicalUni" ;;
272) printf "%s\n" "vmwareNicTeam" ;;
esac
}
TpLink.ClientConnected() {
TpLink.GetData client
printf "%s\n" "Conneceted clients: $clientCon"
if [[ $clientCon != 0 ]] ; then
printf "\n"
for((i=0; i<${#addressMac[@]}; i++)); do
printf "%s\n" "$((i+1)). ${addressMac[$i]}"
done
fi
}
# - Help
Help.Main() {
echo "Check AP Status"
echo ''
Help.Usage
echo ''
Help.Option
echo ''
Help.Info
echo ''
exit $STATE_UNK
}
Help.Usage() {
printf "%s\n" "Method to compose the execution string"
printf "%s\n" "./$APPNAME -c <SNMP community> -h <host>"
}
Help.Option() {
printf "%s\n" "OPTIONS:"
printf "%s\t%s\t%s\n\t\t\t%s\n" "-c" "--community" "SNMP v2 community string with Read access." " Default is $COMMUNITY."
printf "%s\t%s\t\t%s\n\t\t\t%s\n" "-h" "--host" "Host name or IP address to check." " Default is $HOST_NAME."
printf "%s\t%s\t\t%s\n" "-H" "--help" "Show script help"
printf "%s\t%s\t%s\n" "-V" "--version" "Show script version"
}
Help.IPMI() {
printf "\n%s\n\n" "TpLink AP EAP265HD Check Function"
printf "%s\t%s\n\n" "Check" "Description"
printf "%s\t%s\n" "all" "Full monitoring check with single output"
printf "%s\t%s\n" "cpu" "Monitoring CPU load"
printf "%s\t%s\n" "err" "Monitoring system error"
printf "%s\t%s\n" "fan" "Monitoring fan speed"
printf "%s\t%s\n" "ram" "Monitoring RAM load"
printf "%s\t%s\n" "hw" "Monitoring Hardware status"
printf "%s\t%s\n" "temp" "Monitoring temperature sensor"
}
Help.Info() {
printf "%s\t%s\t%s\n" "INFO:" "$NAME" "$VERSION" "" "$AUTHOR" "$URL"
}
# - COMMAND LINE ENCODER
while test -n "$1"; do
case "$1" in
--host | -h)
HOST_NAME=$2
shift ;;
--comunity | -c)
COMMUNITY=$2
shift ;;
--type | -t)
TpLink.Main $2
shift ;;
--help | -H)
Help.Main ;;
--version | -V)
Help.Info
exit $STATE ;;
*)
echo "Unknown argument: $1"
print_help
exit $STATE_UNK ;;
esac
shift
done
TpLink.Main
+214
View File
@@ -0,0 +1,214 @@
#!/bin/bash
# - VAR
# - Bash info
APPNAME=$(basename $0)
NAME="Check ESXi vCenter"
AUTHOR="Kalarumeth"
VERSION="v1.0"
URL="https://github.com/Kalarumeth/ESXi-Monitoring"
# - Default settings for connection
COMMUNITY="public"
HOST_NAME="localhost"
SNMPVERSION="2c"
# - State Variables
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
STATE=$STATE_OK
eWarning=0
eCritical=0
eUnknown=0
# - OID
ESXi.OIDS() {
OID_osName=".1.3.6.1.2.1.47.1.2.1.1.2.1"
OID_fwRev=".1.3.6.1.2.1.47.1.1.1.1.9.1"
OID_serviceTag=".1.3.6.1.2.1.47.1.1.1.1.11.1"
OID_sysManufacturer=".1.3.6.1.2.1.47.1.1.1.1.12.1"
OID_sysModel=".1.3.6.1.2.1.47.1.1.1.1.13.1"
OID_prodName=".1.3.6.1.4.1.6876.1.1.0"
OID_prodVersion=".1.3.6.1.4.1.6876.1.2.0"
OID_prodBuild=".1.3.6.1.4.1.6876.1.4.0"
OID_prodUpdate=".1.3.6.1.4.1.6876.1.5.0"
OID_prodPatch=".1.3.6.1.4.1.6876.1.6.0"
OID_vmName=".1.3.6.1.4.1.6876.2.1.1.2"
}
# - MAIN CODE
Source.HostAlive() {
for server in $HOST_NAME; do
ping -c1 -W1 -q $server &>/dev/null
if [[ $? != 0 ]] ; then
printf "%s\n" "$server is unreachable"
exit $STATE_UNK
fi
done
}
Source.SNMP() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oe -c $COMMUNITY $HOST_NAME $1
}
Source.vSpheredb.Host() {
for host in $HOST_NAME; do
icingacli vspheredb check host --name $host
exit $?
done
}
Source.vSpheredb.Vm() {
for vm in $1; do
icingacli vspheredb check vm --name $vm
Source.e
done
}
Source.e() {
case $? in
1) eWarning=$(($eWarning + 1)) ;;
2) eCritical=$(($eCritical + 1)) ;;
3) eUnknown=$(($eUnknown + 1)) ;;
esac
}
# - ESXi vCenter Health Check
ESXi.Main() {
Source.HostAlive
case $1 in
host)
Source.vSpheredb.Host
exit $? ;;
info)
ESXi.Info
exit $STATE ;;
vm)
ESXi.VmList
exit $? ;;
*)
echo "Unknown check!"
Help.Function
exit $STATE_UNK ;;
esac
}
ESXi.GetData() {
ESXi.OIDS
case $1 in
info) osName=$(Source.SNMP $OID_osName | cut -d '"' -f 2)
fwRev=$(Source.SNMP $OID_fwRev | cut -d '"' -f 2)
serviceTag=$(Source.SNMP $OID_serviceTag | cut -d '"' -f 2)
sysManufacturer=$(Source.SNMP $OID_sysManufacturer | cut -d '"' -f 2)
sysModel=$(Source.SNMP $OID_sysModel | cut -d '"' -f 2)
prodName=$(Source.SNMP $OID_prodName | cut -d '"' -f 2)
prodVersion=$(Source.SNMP $OID_prodVersion | cut -d '"' -f 2)
prodBuild=$(Source.SNMP $OID_prodBuild | cut -d '"' -f 2)
prodUpdate=$(Source.SNMP $OID_prodUpdate | cut -d '"' -f 2)
prodPatch=$(Source.SNMP $OID_prodPatch | cut -d '"' -f 2) ;;
vm) vmList=($(Source.SNMP $OID_vmName | cut -d '"' -f 2)) ;;
esac
}
ESXi.Info() {
ESXi.GetData info
printf "%s\n" "$osName Rev. $fwRev" "$sysManufacturer" "Model: $sysModel" "Service Tag: $serviceTag" "$prodName $prodVersion" "Build: $prodBuild" "Update: $prodUpdate" "Patch: $prodPatch"
}
ESXi.VmList() {
ESXi.GetData vm
if [[ $? != 0 ]] ; then
printf "%s\n" "$server is unreachable"
exit $STATE_UNK
else
for((i=0; i<${#vmList[@]}; i++))
do
printf "%s\n" "$(($i+1)) - ${vmList[$i]}"
Source.vSpheredb.Vm ${vmList[$i]}
printf "\n"
done
if [[ $eWarning != 0 ]] && [[ $eCritical == 0 ]] ; then
exit $STATE_WARN
elif [[ $eCritical != 0 ]] && [[ $eUnknown != 0 ]] ; then
exit $STATE_CRIT
fi
fi
}
# - Help
Help.Main() {
echo "Check ESXi Status"
echo ''
Help.Usage
echo ''
Help.Option
echo ''
Help.Info
echo ''
exit $STATE_UNK
}
Help.Usage() {
printf "%s\n" "Method to compose the execution string"
printf "%s\n" "./$APPNAME -c <SNMP community> -h <host> -t [host/info/vm]"
}
Help.Option() {
printf "%s\n" "OPTIONS:"
printf "%s\t%s\t%s\n\t\t\t%s\n" "-c" "--community" "SNMP v2 community string with Read access." " Default is $COMMUNITY."
printf "%s\t%s\t\t%s\n\t\t\t%s\n" "-h" "--host" "Host name or IP address to check." " Default is $HOST_NAME."
printf "%s\t%s\t\t%s\n" "-t" "--type" "Argument for check function"
printf "%s\t%s\t\t%s\n" "-H" "--help" "Show script help"
printf "%s\t%s\t%s\n" "-V" "--version" "Show script version"
}
Help.Function() {
printf "\n%s\n\n" "ESXi vCenter Check Function"
printf "%s\t%s\n\n" "Check" "Description"
printf "%s\t%s\n" "host" "Get Host check from vsphere plugin."
printf "%s\t%s\n" "info" "Get Information from snmpwalk."
printf "%s\t%s\n" "vm" "Get Virtual Machine from vsphere plugin."
}
Help.Info() {
printf "%s\t%s\t%s\n" "INFO:" "$NAME" "$VERSION" "" "$AUTHOR" "$URL"
}
# - COMMAND LINE ENCODER
while test -n "$1"; do
case "$1" in
--host | -h)
HOST_NAME=$2
shift ;;
--comunity | -c)
COMMUNITY=$2
shift ;;
--type | -t)
ESXi.Main $2
shift ;;
--help | -H)
Help.Main ;;
--version | -V)
Help.Info
exit $STATE ;;
*)
echo "Unknown argument: $1"
print_help
exit $STATE_UNK ;;
esac
shift
done
@@ -0,0 +1,175 @@
#!/bin/bash
# - VAR
# - Bash info
APPNAME=$(basename $0)
NAME="Check ESXi vCenter"
AUTHOR="Kalarumeth"
VERSION="v0.1"
URL="https://github.com/Kalarumeth/ESXi-Monitoring"
# - Default settings for connection
COMMUNITY="public"
HOST_NAME="localhost"
SNMPVERSION="2c"
# - State Variables
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
STATE=$STATE_OK
# - OID
ESXi.OIDS() {
OID_osName=".1.3.6.1.2.1.47.1.2.1.1.2.1"
OID_fwRev=".1.3.6.1.2.1.47.1.1.1.1.9.1"
OID_serviceTag=".1.3.6.1.2.1.47.1.1.1.1.11.1"
OID_sysManufacturer=".1.3.6.1.2.1.47.1.1.1.1.12.1"
OID_sysModel=".1.3.6.1.2.1.47.1.1.1.1.13.1"
OID_prodName=".1.3.6.1.4.1.6876.1.1.0"
OID_prodVersion=".1.3.6.1.4.1.6876.1.2.0"
OID_prodBuild=".1.3.6.1.4.1.6876.1.4.0"
OID_prodUpdate=".1.3.6.1.4.1.6876.1.5.0"
OID_prodPatch=".1.3.6.1.4.1.6876.1.6.0"
}
# - MAIN CODE
Source.HostAlive() {
for server in $HOST_NAME; do
ping -c1 -W1 -q $server &>/dev/null
if [[ $? != 0 ]] ; then
printf "%s\n" "$server is unreachable"
exit $STATE_UNK
fi
done
}
Source.SNMP() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oe -c $COMMUNITY $HOST_NAME $1
}
Source.vSpheredb.Host() {
icingacli vspheredb check host --name $HOST_NAME
}
Source.vSpheredb.Vm() {
icingacli vspheredb check vm --name $VMNAME
}
# - ESXi vCenter Health Check
ESXi.Main() {
Source.HostAlive
case $1 in
info)
ESXi.Info
exit $STATE ;;
host)
Source.vSpheredb.Host
exit $? ;;
vm)
Source.vSpheredb.Vm
exit $? ;;
*)
echo "Unknown check!"
Help.Function
exit $STATE_UNK ;;
esac
}
ESXi.GetData() {
ESXi.OIDS
case $1 in
info) osName=$(Source.SNMP $OID_osName | cut -d '"' -f 2)
fwRev=$(Source.SNMP $OID_fwRev | cut -d '"' -f 2)
serviceTag=$(Source.SNMP $OID_serviceTag | cut -d '"' -f 2)
sysManufacturer=$(Source.SNMP $OID_sysManufacturer | cut -d '"' -f 2)
sysModel=$(Source.SNMP $OID_sysModel | cut -d '"' -f 2)
prodName=$(Source.SNMP $OID_prodName | cut -d '"' -f 2)
prodVersion=$(Source.SNMP $OID_prodVersion | cut -d '"' -f 2)
prodBuild=$(Source.SNMP $OID_prodBuild | cut -d '"' -f 2)
prodUpdate=$(Source.SNMP $OID_prodUpdate | cut -d '"' -f 2)
prodPatch=$(Source.SNMP $OID_prodPatch | cut -d '"' -f 2) ;;
esac
}
ESXi.Info() {
ESXi.GetData info
printf "%s\n" "$osName Rev. $fwRev" "$sysManufacturer Model: $sysModel Service Tag: $serviceTag" "$prodName $prodVersion Build: $prodBuild Update: $prodUpdate Patch: $prodPatch"
}
# - Help
Help.Main() {
echo "Check ESXi Status"
echo ''
Help.Usage
echo ''
Help.Option
echo ''
Help.Info
echo ''
exit $STATE_UNK
}
Help.Usage() {
printf "%s\n" "Method to compose the execution string"
printf "%s\n" "./$APPNAME -c <SNMP community> -h <host>"
}
Help.Option() {
printf "%s\n" "OPTIONS:"
printf "%s\t%s\t%s\n\t\t\t%s\n" "-c" "--community" "SNMP v2 community string with Read access." " Default is $COMMUNITY."
printf "%s\t%s\t\t%s\n\t\t\t%s\n" "-h" "--host" "Host name or IP address to check." " Default is $HOST_NAME."
printf "%s\t%s\t\t%s\n" "-t" "--type" "Argument for check function"
printf "%s\t%s\t\t%s\n" "-H" "--help" "Show script help"
printf "%s\t%s\t%s\n" "-V" "--version" "Show script version"
}
Help.Function() {
printf "\n%s\n\n" "ESXi vCenter Check Function"
printf "%s\t%s\n\n" "Check" "Description"
printf "%s\t%s\n" "info" "System Information"
}
Help.Info() {
printf "%s\t%s\t%s\n" "INFO:" "$NAME" "$VERSION" "" "$AUTHOR" "$URL"
}
# - COMMAND LINE ENCODER
while test -n "$1"; do
case "$1" in
--host | -h)
HOST_NAME=$2
shift ;;
--comunity | -c)
COMMUNITY=$2
shift ;;
--type | -t)
ESXi.Main $2
shift ;;
--VM | -vm)
VMNAME=$2
shift ;;
--help | -H)
Help.Main ;;
--version | -V)
Help.Info
exit $STATE ;;
*)
echo "Unknown argument: $1"
print_help
exit $STATE_UNK ;;
esac
shift
done
ESXi.Main
@@ -0,0 +1,235 @@
#!/bin/bash
# - VAR
# - Bash info
APPNAME=$(basename $0)
NAME="Check Switch HPE OfficeConnect 1920s"
AUTHOR="Kalarumeth"
VERSION="v0.1"
URL="https://github.com/Kalarumeth"
# - Default settings for connection
COMMUNITY="public"
HOST_NAME="localhost"
SNMPVERSION="2c"
# - State Variables
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
STATE=$STATE_OK
# - OID
HPE.OIDS() {
#Info
OID_sysDescr="1.3.6.1.2.1.1.1.0"
OID_sysUptimeIstance="1.3.6.1.2.1.1.3"
OID_sysSerial="1.3.6.1.2.1.47.1.1.1.1.11.1"
OID_sysMacAddres="1.3.6.1.2.1.67.1.2.1.1.2.0"
#interface
OID_ifName="1.3.6.1.2.1.31.1.1.1.1"
OID_ifInErrors="1.3.6.1.2.1.2.2.1.14"
OID_ifOutErrors="1.3.6.1.2.1.2.2.1.20"
#Vlan
OID_vlanID="1.3.6.1.2.1.17.7.1.4.2.1.3.0"
OID_vlanName="1.3.6.1.2.1.17.7.1.4.3.1.1"
OID_vlanEntry="1.3.6.1.2.1.17.7.1.2.1.1.2"
}
# - MAIN CODE
Script.HostAlive() {
for server in $HOST_NAME; do
ping -c1 -W1 -q $server &>/dev/null
if [[ $? != 0 ]] ; then
printf "%s\n" "$server is unreachable"
exit $STATE_UNK
fi
done
}
Script.SNMP() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oe -c $COMMUNITY $HOST_NAME $1
}
Script.SNMP.Hex() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oa -c $COMMUNITY $HOST_NAME $1
}
# - Switch HPE OfficeConnect 1920s Health Check
HPE.Main() {
Script.HostAlive
case $1 in
info)
HPE.Info
exit $STATE ;;
if)
HPE.Interface
exit $STATE ;;
vlan)
HPE.Vlan
exit $STATE ;;
*)
echo "Unknown check!"
Help.HPE
exit $STATE_UNK ;;
esac
}
HPE.GetData() {
HPE.OIDS
case $1 in
info)
raw_sysDescr=$(Script.SNMP $OID_sysDescr | cut -d '"' -f 2)
IFS=',' read -ra sysDescr <<< $raw_sysDescr;
sysUptimeIstance=$(Script.SNMP $OID_sysUptimeIstance | cut -d ')' -f 2 )
sysSerial=$(Script.SNMP $OID_sysSerial | cut -d '"' -f 2)
sysMacAddres=$(Script.SNMP $OID_sysMacAddres | cut -d '"' -f 2);;
interface)
raw_ifName=$(Script.SNMP $OID_ifName | cut -d ' ' -f 4)
raw_ifInErrors=$(Script.SNMP $OID_ifInErrors | cut -d ' ' -f 4)
raw_ifOutErrors=$(Script.SNMP $OID_ifOutErrors | cut -d ' ' -f 4)
readarray -t ifName <<< $raw_ifName
readarray -t ifInErrors <<< $raw_ifInErrors
readarray -t ifOutErrors <<< $raw_ifOutErrors ;;
vlan)
raw_vlanID=$(Script.SNMP $OID_vlanID | cut -d ' ' -f 4 | sed "s/$//g")
raw_vlanName=$(Script.SNMP $OID_vlanName | cut -d '"' -f 2 | sed "s/$//g")
raw_vlanEntry=$(Script.SNMP $OID_vlanEntry | cut -d ' ' -f 4 | sed "s/$//g")
readarray -t vlanID <<< $raw_vlanID
readarray -t vlanName <<< $raw_vlanName
readarray -t vlanEntry <<< $raw_vlanEntry ;;
esac
}
HPE.Info() {
HPE.GetData info
printf "%s\n\n" "${sysDescr[0]}"
printf "%s\t%s\n" "UpTime:" "$sysUptimeIstance"
printf "%s\t%s\n" "S/N:" " $sysSerial"
printf "%s\t%s\n" "Relase:" "${sysDescr[1]}"
printf "%s\t%s\n" "Os:" "${sysDescr[2]}"
printf "%s\t%s\n" "Bios:" "${sysDescr[3]}"
printf "%s\t%s\n" "Mac:" " $sysMacAddres"
}
HPE.Interface() {
HPE.GetData interface
ErrorCounter=0
for ((i=0; i<${#ifName[@]}; i++));
do
if [[ ${ifInErrors[$i]} != 0 || ${ifOutErrors[$i]} != 0 ]]; then
ErrorCounter=$((ErrorCounter + 1))
fi
done
for Error in "$ErrorCounter"; do
if [[ $Error == 0 ]] ; then
printf "%s\t%s\n\n" "OK!" "All interface operating normally."
break
else
printf "%s\n\n" "Warn! $ErrorCounter inteface have error."
printf "%s\t%s\t%s\n" "InEr" "OutEr" "If"
printf "%s\n" "========================="
for ((i=0; i<${#ifName[@]}; i++));
do
if [[ ${ifInErrors[$i]} != 0 || ${ifOutErrors[$i]} != 0 ]] ; then
printf "%s\t%s\t%s\n" "${ifInErrors[$i]}" "${ifOutErrors[$i]}" "${ifName[$i]}"
fi
done
STATE=$STATE_WARN
break
fi
done
}
HPE.Vlan() {
HPE.GetData vlan
printf "%s\n\n" "${#vlanID[@]} Exist Vlan"
printf "%s\t%s\t%s\n" "ID" "Entry" "Name"
printf "%s\n" "============================="
for ((i=0; i<${#vlanID[@]}; i++))
do
printf "%s\t%s\t%s\n" "${vlanID[$i]}" "${vlanEntry[$i]}" "${vlanName[$i]}"
done
}
# - Help
Help.Main() {
echo $NAME
echo ''
Help.Usage
echo ''
Help.Option
echo ''
Help.Info
echo ''
exit $STATE_UNK
}
Help.Usage() {
printf "%s\n" "Method to compose the execution string"
printf "%s\n" "./$APPNAME -c <SNMP community> -h <host>"
}
Help.Option() {
printf "%s\n" "OPTIONS:"
printf "%s\t%s\t%s\n\t\t\t%s\n" "-c" "--community" "SNMP v2 community string with Read access." " Default is $COMMUNITY."
printf "%s\t%s\t\t%s\n\t\t\t%s\n" "-h" "--host" "Host name or IP address to check." " Default is $HOST_NAME."
printf "%s\t%s\t\t%s\n" "-H" "--help" "Show script help"
printf "%s\t%s\t%s\n" "-V" "--version" "Show script version"
}
Help.HPE() {
printf "\n%s\n\n" "HPE OfficeConnect 1920s Check Function"
printf "%s\t%s\n\n" "Check" "Description"
printf "%s\t%s\n" "info" "Print Switch basic information"
printf "%s\t%s\n" "if" "Monitoring interface"
printf "%s\t%s\n" "vlan" "Monitoring Vlan"
}
Help.Info() {
printf "%s\t%s\t%s\n" "INFO:" "$NAME" "$VERSION" "" "$AUTHOR" "$URL"
}
# - COMMAND LINE ENCODER
while test -n "$1"; do
case "$1" in
--host | -h)
HOST_NAME=$2
shift ;;
--comunity | -c)
COMMUNITY=$2
shift ;;
--type | -t)
HPE.Main $2
shift ;;
--help | -H)
Help.Main ;;
--version | -V)
Help.Info
exit $STATE ;;
*)
echo "Unknown argument: $1"
print_help
exit $STATE_UNK ;;
esac
shift
done
HPE.Main
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
Copyright 2022 Kalarumeth - https://github.com/Kalarumeth
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,172 @@
# Check AirOs
<img src="https://img.shields.io/badge/Code-Bash-orange?style=flat-square&logo=GNU%20Bash&logoColor=orange" alt="Bash"> <img src="https://img.shields.io/badge/Device-AirOs-0559C9?style=flat-square&logo=Ubiquiti" alt="Checked Device"> <img src="https://img.shields.io/badge/Release-v1.0-green?style=flat-square" alt="Release">
<img src="https://img.shields.io/badge/Dev by-Kalarumeth-blueviolet?style=flat-square" alt="Dev"> <img src="https://img.shields.io/badge/License-MIT-blue?style=flat-square" alt="MIT License">
The following script is used to monitor and display the basic information of Ubiquity AirOs via snmpwalk scripts and are processed to provide easy-to-read data. It can be run separately or integrated into Icinga2 as a monitoring plugin.
**Important**: *snmpwalk command is required for script to run correctly*
# Update Note
## 1.0 - Release
+ Release
# Installation
1. Download the script and give it privilages for run
```
curl -LJO https://raw.githubusercontent.com/Kalarumeth/Monitoring-AirOs/main/check_airos.sh
```
2. Move to Icinga Plugin Dir
```
Default location: /usr/lib/nagios/plugins
```
3. Add command to Icinga
```
object CheckCommand "check_airos" {
import "plugin-check-command"
command = [ PluginDir + "/check_airos.sh" ]
arguments += {
"-c" = {
order = 0
value = "$snmp_community$"
}
"-cr" = {
order = 3
value = "$crit$"
}
"-h" = {
order = 1
required = true
value = "$address$"
}
"-t" = {
order = 4
required = true
value = "$airos_type$"
}
"-wa" = {
order = 2
value = "$warn$"
}
}
}
```
# Functions
The Script is designed to monitor the following functions:
- **[airmax] AirMax:**
Show all airMax Statistics of device
```
AirMax Information
Enabled: On
Quality: 96 %
Capacity: 45 %
Priority: None
NoAck: Off
```
- **[info] Info:**
Show basic information
```
Device Information
Location: OUTSIDE
UpTime: 2 days, 18:03:25.00
LastChange: 17:01:14.00
Ubiquiti Networks, Inc. LiteBeam M5
airOs Ver: XW.ar934x.v6.3.6.33330.210818.1930
```
- **[radio] Radio:**
Show status and statistics of radio
```
Radio Information
Mode: AP Wireless Distribution System
Country: 380
Frequency: 5185
DFS: Off
TxPower: 0
Distance: 0
Chainmask: 1
Antenna: 11x14 - 23 dBi
```
- **[ram] Ram:**
Show ram usage
```
OK! RAM used: 25.27 / 62.14 Mb (40.67%)
RAM free: 36.86 Mb (59.33%)
Buffer: 2.99 Mb
Cache: 0 Kb
```
- **[station] Station:**
Show station information, work only on station setup
```
Station Information
Name: AP041
Signal: -41 dBm
Noise floor: -100
CCQ: 99 %
Con. Time: 2
TX/RX Rate: 150 MB / 150 MB
TX/RX Bytes: 3.39 GB / 7.88 GB
```
- **[wireless] Wireless:**
Show wireless information
```
Wireless Information
SSID: Bridge
Hide: On
Signal: -42 dBm
RSSI: 54 dBm
CCQ: 99
Noise floor: -99
TX/RX Rate: 150 MB / 150 MB
Security: WPA2
WDS: On
Ap Repeater: Off
Channel Width: 40
Station Count: 1
```
# How it work
Method to compose the execution string:
./check_airos.sh -c <SNMP community> -h <host> [-wa <value> -cr <value>] -t <object>
### OPTIONS:
```
-c --community SNMP v2 community string with Read access.
Default is: public.
-h --host [REQUIRED OPTION] Host name or IP address to check.
Default is: localhost.
-wa --allert-wa Defines the threshold for Warning.
Default is: 75.
-cr --allert-cr Defines the threshold for Critical.
Default is: 50.
-t --type [REQUIRED OPTION] Field for select element to check on WatchGuard Device.
{ airmax | info | radio | ram | station | wireless }.
-H --help Show script help.
-V --version Show script version.
```
# Credits
### Author
Kalarumeth - https://github.com/Kalarumeth
### License
MIT License - Copyright 2022 Kalarumeth
@@ -0,0 +1,89 @@
SNMPwalk on Ubiquiti LiteBeam M5
Device Information
iso.2.840.10036.3.1.2.1.2.5 = STRING: "Ubiquiti Networks, Inc." dot11manufacturerName
iso.2.840.10036.3.1.2.1.3.5 = STRING: "LiteBeam M5" dot11manufacturerProductName
iso.2.840.10036.3.1.2.1.4.5 = STRING: "XW.ar934x.v6.3.6.33330.210818.1930" dot11manufacturerPro
iso.3.6.1.2.1.1.1.0 = STRING: "Linux 2.6.32.71 #1 Wed Aug 18 19:31:33 EEST 2021 mips" sysDescr
iso.3.6.1.2.1.1.3.0 = Timeticks: (58100) 0:09:41.00 sysUpTime
iso.3.6.1.2.1.1.4.0 = STRING: "PAL" sysContact
iso.3.6.1.2.1.1.5.0 = STRING: "PALAP052" sysName
iso.3.6.1.2.1.1.6.0 = STRING: "PAL5" sysLocation
iso.3.6.1.2.1.1.7.0 = INTEGER: 79 sysServices
iso.3.6.1.2.1.1.8.0 = Timeticks: (29700) 0:04:57.00 sysORLastChange
Memory
iso.3.6.1.4.1.10002.1.1.1.1.1.0 = Gauge32: 62136 memTotal KB
iso.3.6.1.4.1.10002.1.1.1.1.2.0 = Gauge32: 40468 memFree KB
iso.3.6.1.4.1.10002.1.1.1.1.3.0 = Gauge32: 1980 memBuffer KB
iso.3.6.1.4.1.10002.1.1.1.1.4.0 = Gauge32: 0 memCache KB
Cpu
iso.3.6.1.4.1.10002.1.1.1.2.1.0 = Gauge32: 0 cpuModLoad
iso.3.6.1.4.1.10002.1.1.1.2.2.0 = Gauge32: 0 cpuModUsage
Radio status & statistics
iso.3.6.1.4.1.41112.1.4.1.1.1.1 = INTEGER: 5
iso.3.6.1.4.1.41112.1.4.1.1.2.1 = INTEGER: 1 ubntRadioMode Radio mode sta(1), ap(2), aprepeater(3), apwds(4)
iso.3.6.1.4.1.41112.1.4.1.1.3.1 = INTEGER: 380 ubntRadioCCode Country code
iso.3.6.1.4.1.41112.1.4.1.1.4.1 = INTEGER: 5180 ubntRadioFreq Operation frequency
iso.3.6.1.4.1.41112.1.4.1.1.5.1 = INTEGER: 2 ubntRadioDfsEnabled DFS status
iso.3.6.1.4.1.41112.1.4.1.1.6.1 = INTEGER: 0 ubntRadioTxPower Transmit power
iso.3.6.1.4.1.41112.1.4.1.1.7.1 = INTEGER: 0 ubntRadioDistance Distance
iso.3.6.1.4.1.41112.1.4.1.1.8.1 = INTEGER: 1 ubntRadioChainmask Chainmask
iso.3.6.1.4.1.41112.1.4.1.1.9.1 = STRING: "11x14 - 23 dBi" ubntRadioAntenna Antenna
Wireless Statistic
iso.3.6.1.4.1.41112.1.4.5.1.1.1 = INTEGER: 5 wireless index
iso.3.6.1.4.1.41112.1.4.5.1.2.1 = STRING: "PAL2-PAL5 Bridge" ubntWlStatSsid SSID
iso.3.6.1.4.1.41112.1.4.5.1.3.1 = INTEGER: 2 ubntWlStatHideSsid hide on/[off]
iso.3.6.1.4.1.41112.1.4.5.1.4.1 = Hex-STRING: 68 D7 9A 9C CC D4 ubntWlStatApMac AP MAC
iso.3.6.1.4.1.41112.1.4.5.1.5.1 = INTEGER: -47 ubntWlStatSignal Intensità del segnale, dbm
iso.3.6.1.4.1.41112.1.4.5.1.6.1 = INTEGER: 49 ubntWlStatRssi RSSI, dbm
iso.3.6.1.4.1.41112.1.4.5.1.7.1 = INTEGER: 86 ubntWlStatCcq Client Connection Quality %
iso.3.6.1.4.1.41112.1.4.5.1.8.1 = INTEGER: -98 ubntWlStatNoiseFloor Rumore di fondo dbm
iso.3.6.1.4.1.41112.1.4.5.1.9.1 = INTEGER: 150000000 ubntWlStatTxRate TX
iso.3.6.1.4.1.41112.1.4.5.1.10.1 = INTEGER: 150000000 ubntWlStatRxRate RX Mbps
iso.3.6.1.4.1.41112.1.4.5.1.11.1 = STRING: "WPA2" ubntWlStatSecurity
iso.3.6.1.4.1.41112.1.4.5.1.12.1 = INTEGER: 2 ubntWlStatWdsEnabled on/off
iso.3.6.1.4.1.41112.1.4.5.1.13.1 = INTEGER: 2 ubntWlStatApRepeater on/off
iso.3.6.1.4.1.41112.1.4.5.1.14.1 = INTEGER: 40 ubntWlStatChanWidth
iso.3.6.1.4.1.41112.1.4.5.1.15.1 = Gauge32: 1 ubntWlStatStaCount
airMax Statistic
iso.3.6.1.4.1.41112.1.4.6.1.1.1 = INTEGER: 5 airMax index
iso.3.6.1.4.1.41112.1.4.6.1.2.1 = INTEGER: 1 ubntAirMaxEnabled airMax [on]/off
iso.3.6.1.4.1.41112.1.4.6.1.3.1 = INTEGER: 97 ubntAirMaxQuality Qualità airMax %
iso.3.6.1.4.1.41112.1.4.6.1.4.1 = INTEGER: 45 ubntAirMaxCapacity Capacità airMax
iso.3.6.1.4.1.41112.1.4.6.1.5.1 = INTEGER: 2 ubntAirMaxPriority Priority none(3)/high(0)/low(2)/medium(1)
iso.3.6.1.4.1.41112.1.4.6.1.6.1 = INTEGER: 2 ubntAirMaxNoAck NoACK on/[off]
Station Statistic work only for station
iso.3.6.1.4.1.41112.1.4.7.1.1.1.104.215.154.156.204.212 = Hex-STRING: 68 D7 9A 9C CC D4 ubntStaMac Mac
iso.3.6.1.4.1.41112.1.4.7.1.2.1.104.215.154.156.204.212 = STRING: "PALAP051" ubntStaName Hostname station name
iso.3.6.1.4.1.41112.1.4.7.1.3.1.104.215.154.156.204.212 = INTEGER: -47 ubntStaSignal Signal strenght, dBm
iso.3.6.1.4.1.41112.1.4.7.1.4.1.104.215.154.156.204.212 = INTEGER: -98 ubntStaNoiseFloor Noise floor
iso.3.6.1.4.1.41112.1.4.7.1.5.1.104.215.154.156.204.212 = INTEGER: 0 ubntStaDistance Distance
iso.3.6.1.4.1.41112.1.4.7.1.6.1.104.215.154.156.204.212 = INTEGER: 88 ubntStaCcq CCQ %
iso.3.6.1.4.1.41112.1.4.7.1.7.1.104.215.154.156.204.212 = INTEGER: 3 ubntStaAmp airMax priority
iso.3.6.1.4.1.41112.1.4.7.1.8.1.104.215.154.156.204.212 = INTEGER: 0 ubntStaAmq airMax Quality
iso.3.6.1.4.1.41112.1.4.7.1.9.1.104.215.154.156.204.212 = INTEGER: 0 ubntStaAmc airMax Capacity
iso.3.6.1.4.1.41112.1.4.7.1.10.1.104.215.154.156.204.212 = IpAddress: 172.16.252.4 ubntStaLastIp last ip
iso.3.6.1.4.1.41112.1.4.7.1.11.1.104.215.154.156.204.212 = INTEGER: 150000000 ubntStaTxRate TX rate
iso.3.6.1.4.1.41112.1.4.7.1.12.1.104.215.154.156.204.212 = INTEGER: 150000000 ubntStaRxRate RX rate
iso.3.6.1.4.1.41112.1.4.7.1.13.1.104.215.154.156.204.212 = Counter64: 51875 ubntStaTxBytes TX Bytes
iso.3.6.1.4.1.41112.1.4.7.1.14.1.104.215.154.156.204.212 = Counter64: 23356 ubntStaRxBytes RX Bytes
iso.3.6.1.4.1.41112.1.4.7.1.15.1.104.215.154.156.204.212 = Timeticks: (19800) 0:03:18.00 ubntStaConnTime Connection time
End of MIB
the selected device is not a station
@@ -0,0 +1,448 @@
#!/bin/bash
# - VAR
# - Bash info
APPNAME=$(basename $0)
NAME="Check Ubiquiti LiteBeam M5"
AUTHOR="Kalarumeth"
VERSION="v0.1"
URL="https://github.com/Kalarumeth"
# - Default settings for connection
COMMUNITY="public"
HOST_NAME="localhost"
SNMPVERSION="1"
# - State Variables
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
STATE=$STATE_OK
# - Range Variables
WA=75
CR=50
# - OID
UBNT.GetOIDS() {
#Device Information
OID_dot11manufacturerName="1.2.840.10036.3.1.2.1.2.5"
OID_dot11manufacturerProductName="1.2.840.10036.3.1.2.1.3.5"
OID_dot11manufacturerProductVersion="1.2.840.10036.3.1.2.1.4.5"
OID_sysDescr="1.3.6.1.2.1.1.1.0"
OID_sysUpTime="1.3.6.1.2.1.1.3.0"
OID_sysContact="1.3.6.1.2.1.1.4.0"
OID_sysName="1.3.6.1.2.1.1.5.0"
OID_sysLocation="1.3.6.1.2.1.1.6.0"
OID_sysORLastChange="1.3.6.1.2.1.1.8.0"
#Memory
OID_memTotal="1.3.6.1.4.1.10002.1.1.1.1.1.0"
OID_memFree="1.3.6.1.4.1.10002.1.1.1.1.2.0"
OID_memBuffer="1.3.6.1.4.1.10002.1.1.1.1.3.0"
OID_memCache="1.3.6.1.4.1.10002.1.1.1.1.4.0"
#Radio status & statistics
OID_ubntRadioMode="1.3.6.1.4.1.41112.1.4.1.1.2.1"
OID_ubntRadioCCode="1.3.6.1.4.1.41112.1.4.1.1.3.1"
OID_ubntRadioFreq="1.3.6.1.4.1.41112.1.4.1.1.4.1"
OID_ubntRadioDfsEnabled="1.3.6.1.4.1.41112.1.4.1.1.5.1"
OID_ubntRadioTxPower="1.3.6.1.4.1.41112.1.4.1.1.6.1"
OID_ubntRadioDistance="1.3.6.1.4.1.41112.1.4.1.1.7.1"
OID_ubntRadioChainmask="1.3.6.1.4.1.41112.1.4.1.1.8.1"
OID_ubntRadioAntenna="1.3.6.1.4.1.41112.1.4.1.1.9.1"
#Wireless statistics
OID_ubntWlStatSsid="1.3.6.1.4.1.41112.1.4.5.1.2.1"
OID_ubntWlStatHideSsid="1.3.6.1.4.1.41112.1.4.5.1.3.1"
OID_ubntWlStatApMac="1.3.6.1.4.1.41112.1.4.5.1.4.1"
OID_ubntWlStatSignal="1.3.6.1.4.1.41112.1.4.5.1.5.1"
OID_ubntWlStatRssi="1.3.6.1.4.1.41112.1.4.5.1.6.1"
OID_ubntWlStatCcq="1.3.6.1.4.1.41112.1.4.5.1.7.1"
OID_ubntWlStatNoiseFloor="1.3.6.1.4.1.41112.1.4.5.1.8.1"
OID_ubntWlStatTxRate="1.3.6.1.4.1.41112.1.4.5.1.9.1"
OID_ubntWlStatRxRate="1.3.6.1.4.1.41112.1.4.5.1.10.1"
OID_ubntWlStatSecurity="1.3.6.1.4.1.41112.1.4.5.1.11.1"
OID_ubntWlStatWdsEnabled="1.3.6.1.4.1.41112.1.4.5.1.12.1"
OID_ubntWlStatApRepeater="1.3.6.1.4.1.41112.1.4.5.1.13.1"
OID_ubntWlStatChanWidth="1.3.6.1.4.1.41112.1.4.5.1.14.1"
OID_ubntWlStatStaCount="1.3.6.1.4.1.41112.1.4.5.1.15.1"
#AirMax Statistics
OID_ubntAirMaxEnabled="1.3.6.1.4.1.41112.1.4.6.1.2.1"
OID_ubntAirMaxQuality="1.3.6.1.4.1.41112.1.4.6.1.3.1"
OID_ubntAirMaxCapacity="1.3.6.1.4.1.41112.1.4.6.1.4.1"
OID_ubntAirMaxPriority="1.3.6.1.4.1.41112.1.4.6.1.5.1"
OID_ubntAirMaxNoAck="1.3.6.1.4.1.41112.1.4.6.1.6.1"
#Station Statistics
OID_ubntStaName="1.3.6.1.4.1.41112.1.4.7.1.2.1.104.215.154.156.204.212"
OID_ubntStaSignal="1.3.6.1.4.1.41112.1.4.7.1.3.1.104.215.154.156.204.212"
OID_ubntStaNoiseFloor="1.3.6.1.4.1.41112.1.4.7.1.4.1.104.215.154.156.204.212"
OID_ubntStaDistance="1.3.6.1.4.1.41112.1.4.7.1.5.1.104.215.154.156.204.212"
OID_ubntStaCcq="1.3.6.1.4.1.41112.1.4.7.1.6.1.104.215.154.156.204.212"
OID_ubntStaAmp="1.3.6.1.4.1.41112.1.4.7.1.7.1.104.215.154.156.204.212"
OID_ubntStaAmq="1.3.6.1.4.1.41112.1.4.7.1.8.1.104.215.154.156.204.212"
OID_ubntStaAmc="1.3.6.1.4.1.41112.1.4.7.1.9.1.104.215.154.156.204.212"
OID_ubntStaLastIp="1.3.6.1.4.1.41112.1.4.7.1.10.1.104.215.154.156.204.212"
OID_ubntStaTxRate="1.3.6.1.4.1.41112.1.4.7.1.11.1.104.215.154.156.204.212"
OID_ubntStaRxRate="1.3.6.1.4.1.41112.1.4.7.1.12.1.104.215.154.156.204.212"
OID_ubntStaTxBytes="1.3.6.1.4.1.41112.1.4.7.1.13.1.104.215.154.156.204.212"
OID_ubntStaRxBytes="1.3.6.1.4.1.41112.1.4.7.1.14.1.104.215.154.156.204.212"
OID_ubntStaConnTime="1.3.6.1.4.1.41112.1.4.7.1.15.1.104.215.154.156.204.212"
}
UBNT.GetData() {
UBNT.GetOIDS
case $1 in
airmax)
ubntAirMaxEnabled=$(Source.SNMP $OID_ubntAirMaxEnabled | cut -d ' ' -f 4)
ubntAirMaxQuality=$(Source.SNMP $OID_ubntAirMaxQuality | cut -d ' ' -f 4)
ubntAirMaxCapacity=$(Source.SNMP $OID_ubntAirMaxCapacity | cut -d ' ' -f 4)
ubntAirMaxPriority=$(Source.SNMP $OID_ubntAirMaxPriority | cut -d ' ' -f 4)
ubntAirMaxNoAck=$(Source.SNMP $OID_ubntAirMaxNoAck | cut -d ' ' -f 4)
;;
info)
dot11manufacturerName=$(Source.SNMP $OID_dot11manufacturerName | cut -d '"' -f 2)
dot11manufacturerProductName=$(Source.SNMP $OID_dot11manufacturerProductName | cut -d '"' -f 2)
dot11manufacturerProductVersion=$(Source.SNMP $OID_dot11manufacturerProductVersion | cut -d '"' -f 2)
sysDescr=$(Source.SNMP $OID_sysDescr | cut -d '"' -f 2)
sysUpTime=$(Source.SNMP $OID_sysUpTime | cut -d ' ' -f 5)
sysLocation=$(Source.SNMP $OID_sysLocation | cut -d '"' -f 2)
sysORLastChange=$(Source.SNMP $OID_sysORLastChange | cut -d ' ' -f 5)
;;
radio)
ubntRadioMode=$(Source.SNMP $OID_ubntRadioMode | cut -d ' ' -f 4)
ubntRadioCCode=$(Source.SNMP $OID_ubntRadioCCode | cut -d ' ' -f 4)
ubntRadioFreq=$(Source.SNMP $OID_ubntRadioFreq | cut -d ' ' -f 4)
ubntRadioDfsEnabled=$(Source.SNMP $OID_ubntRadioDfsEnabled | cut -d ' ' -f 4)
ubntRadioTxPower=$(Source.SNMP $OID_ubntRadioTxPower | cut -d ' ' -f 4)
ubntRadioDistance=$(Source.SNMP $OID_ubntRadioDistance | cut -d ' ' -f 4)
ubntRadioChainmask=$(Source.SNMP $OID_ubntRadioChainmask | cut -d ' ' -f 4)
ubntRadioAntenna=$(Source.SNMP $OID_ubntRadioAntenna | cut -d '"' -f 2)
;;
ram)
rawRamAll=$(Source.SNMP $OID_memTotal | cut -d ' ' -f 4)
rawRamFree=$(Source.SNMP $OID_memFree | cut -d ' ' -f 4)
valueRamAllMb=$(echo "$rawRamAll" | awk '{ mbyte = $1 /1000; print mbyte }' | xargs printf "%.2f")
valueRamFreeMb=$(echo "$rawRamFree" | awk '{ mbyte = $1 /1000; print mbyte }' | xargs printf "%.2f")
printPercetageRam=$(echo "$rawRamFree" "$rawRamAll" | awk '{ ramp = $1 /$2 *100; print ramp }' | xargs printf "%.2f")
printPercetageRamUsed=$(echo "$printPercetageRam" | awk '{ ramup = 100 - $1; print ramup }')
rangePercetageRam=$(echo "$printPercetageRamUsed" | cut -d "." -f1)
rawRamUsed=$(echo "$rawRamAll" "$rawRamFree" | awk '{ used = $1 -$2; print used }')
valueRamUsedMb=$(echo "$rawRamUsed" | awk '{ mbyte = $1 /1000; print mbyte }' | xargs printf "%.2f")
rawmemBuffer=$(Source.SNMP $OID_memBuffer | cut -d ' ' -f 4)
memBuffer=$(echo "$rawmemBuffer" | awk '{ mbyte = $1 /1000; print mbyte }' | xargs printf "%.2f")
memCache=$(Source.SNMP $OID_memCache | cut -d ' ' -f 4)
;;
station)
mode=$(Source.SNMP $OID_ubntRadioMode | cut -d ' ' -f 4)
ubntStaName=$(Source.SNMP $OID_ubntStaName | cut -d '"' -f 2)
ubntStaSignal=$(Source.SNMP $OID_ubntStaSignal | cut -d ' ' -f 4)
ubntStaNoiseFloor=$(Source.SNMP $OID_ubntStaNoiseFloor | cut -d ' ' -f 4)
ubntStaCcq=$(Source.SNMP $OID_ubntStaCcq | cut -d ' ' -f 4)
ubntStaTxRate=$(Source.SNMP $OID_ubntStaTxRate | cut -d ' ' -f 4)
ubntStaRxRate=$(Source.SNMP $OID_ubntStaRxRate | cut -d ' ' -f 4)
ubntStaTxBytes=$(Source.SNMP $OID_ubntStaTxBytes | cut -d ' ' -f 4)
ubntStaRxBytes=$(Source.SNMP $OID_ubntStaRxBytes | cut -d ' ' -f 4)
ubntStaConnTime=$(Source.SNMP $OID_ubntStaConnTime | cut -d ' ' -f 5)
;;
wireless)
ubntWlStatSsid=$(Source.SNMP $OID_ubntWlStatSsid | cut -d '"' -f 2)
ubntWlStatHideSsid=$(Source.SNMP $OID_ubntWlStatHideSsid | cut -d ' ' -f 4)
ubntWlStatApMac=$(Source.SNMP $OID_ubntWlStatApMac | cut -d ' ' -f 4)
ubntWlStatSignal=$(Source.SNMP $OID_ubntWlStatSignal | cut -d ' ' -f 4)
ubntWlStatRssi=$(Source.SNMP $OID_ubntWlStatRssi | cut -d ' ' -f 4)
ubntWlStatCcq=$(Source.SNMP $OID_ubntWlStatCcq | cut -d ' ' -f 4)
ubntWlStatNoiseFloor=$(Source.SNMP $OID_ubntWlStatNoiseFloor | cut -d ' ' -f 4)
ubntWlStatTxRate=$(Source.SNMP $OID_ubntWlStatTxRate | cut -d ' ' -f 4)
ubntWlStatRxRate=$(Source.SNMP $OID_ubntWlStatRxRate | cut -d ' ' -f 4)
ubntWlStatSecurity=$(Source.SNMP $OID_ubntWlStatSecurity | cut -d '"' -f 2)
ubntWlStatWdsEnabled=$(Source.SNMP $OID_ubntWlStatWdsEnabled | cut -d ' ' -f 4)
ubntWlStatApRepeater=$(Source.SNMP $OID_ubntWlStatApRepeater | cut -d ' ' -f 4)
ubntWlStatChanWidth=$(Source.SNMP $OID_ubntWlStatChanWidth | cut -d ' ' -f 4)
ubntWlStatStaCount=$(Source.SNMP $OID_ubntWlStatStaCount | cut -d ' ' -f 4)
;;
esac
}
# - MAIN CODE
Source.HostAlive() {
for server in $HOST_NAME; do
ping -c1 -W1 -q $server &>/dev/null
if [[ $? != 0 ]] ; then
printf "%s\n" "$server is unreachable"
exit $STATE_UNK
fi
done
}
Source.SNMP() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oe -c $COMMUNITY $HOST_NAME $1
}
Source.SNMP.Hex() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oa -c $COMMUNITY $HOST_NAME $1
}
# - Ubiquiti Status Variables
GetStatus.OnOff() {
case $1 in
1) local sED="On" ;;
2) local sED="Off" ;;
esac
echo $sED
}
GetStatus.BToMB() {
local value=$(echo "$1" | awk '{ mbyte = $1 /1000/1000; print mbyte }' | xargs printf "%.f")
echo "$value MB"
}
GetStatus.BToGB() {
local value=$(echo "$1" | awk '{ gbyte = $1 /1000/1000/1000; print gbyte }' | xargs printf "%.2f")
echo "$value GB"
}
GetStatus.RadioMode() {
case $1 in
1) local sRM="Station" ;;
2) local sRM="Access Point" ;;
3) local sRM="AP Repeater" ;;
4) local sRM="AP Wireless Distribution System" ;;
esac
echo $sRM
}
GetStatus.CheckStaMode() {
if [[ $1 != "1" ]]; then
printf "%s\n%s\n%s\n" "The following device isn't set to Station." "Is setted on '$(GetStatus.RadioMode $1)'," "disable the following service for this device." && exit $STATE_UNK
fi
}
GetStatus.AMQuality() {
if [[ $1 < $CR-1 ]]; then
local sQuality="CRIT!"
STATE=$STATE_CRIT
elif [[ $1 < $WA-1 ]]; then
local sQuality="WARN!"
STATE=$STATE_WARN
fi
echo "$1" "%" "$sQuality"
}
GetStatus.AMPriority() {
case $1 in
0) local sAMP="High" ;;
1) local sAMP="Medium" ;;
2) local sAMP="Low" ;;
3) local sAMP="None" ;;
esac
echo $sAMP
}
# - Ubiquiti Monitoring
UBNT.Main() {
Source.HostAlive
case $1 in
airmax)
UBNT.AirMax
exit $STATE ;;
info)
UBNT.Info
exit $STATE ;;
radio)
UBNT.Radio
exit $STATE ;;
ram)
UBNT.Ram
exit $STATE ;;
station)
UBNT.Station
exit $STATE ;;
wireless)
UBNT.Wireless
exit $STATE ;;
*)
echo "Unknown check!"
Help.UBNT
exit $STATE_UNK ;;
esac
}
UBNT.AirMax() {
UBNT.GetData airmax
printf "%s\n\n" "AirMax Information"
printf "%s\t%s\n" "Enabled:" "$(GetStatus.OnOff $ubntAirMaxEnabled)"
printf "%s\t%s\n" "Quality:" "$(GetStatus.AMQuality $ubntAirMaxQuality)"
printf "%s\t%s\n" "Capacity:" "$ubntAirMaxCapacity %"
printf "%s\t%s\n" "Priority:" "$(GetStatus.AMPriority $ubntAirMaxPriority)"
printf "%s\t\t%s\n" "NoAck:" "$(GetStatus.OnOff $ubntAirMaxNoAck)"
}
UBNT.Info() {
UBNT.GetData info
printf "%s\n\n" "Device Information"
printf "%s\t%s\n" "Location:" "$sysLocation"
printf "%s\t\t%s\n" "UpTime:" "$sysUpTime"
printf "%s\t%s\n\n" "LastChange:" "$sysORLastChange"
printf "%s%s\n" "$dot11manufacturerProductName" "$dot11manufacturerName"
printf "%s\t%s\n" "airOs Ver:" "$dot11manufacturerProductVersion"
}
UBNT.Radio() {
UBNT.GetData radio
printf "%s\n\n" "Radio Information"
printf "%s\t\t%s\n" "Mode:" "$(GetStatus.RadioMode $ubntRadioMode)"
printf "%s\t%s\n" "Country:" "$ubntRadioCCode"
printf "%s\t%s\n" "Frequency:" "$ubntRadioFreq"
printf "%s\t\t%s\n" "DFS:" "$(GetStatus.OnOff $ubntRadioDfsEnabled)"
printf "%s\t%s\n" "TxPower:" "$ubntRadioTxPower"
printf "%s\t%s\n" "Distance:" "$ubntRadioDistance"
printf "%s\t%s\n" "Chainmask:" "$ubntRadioChainmask"
printf "%s\t%s\n" "Antenna:" "$ubntRadioAntenna"
}
UBNT.Ram() {
UBNT.GetData ram
case 1 in
$(($rangePercetageRam <= $WA-1)))
printf "%s\n" "OK! RAM used: $valueRamUsedMb / $valueRamAllMb Mb ($printPercetageRamUsed%)" "RAM free: $valueRamFreeMb Mb ($printPercetageRam%)" "Buffer: $memBuffer Mb" "Cache: $memCache Kb" && exit $STATE_OK ;;
$(($rangePercetageRam <= $CR-1)))
printf "%s\n" "WARRING! RAM used: $valueRamUsedMb / $valueRamAllMb Mb ($printPercetageRamUsed%)" "RAM free: $valueRamFreeMb Mb ($printPercetageRam%)" "Buffer: $memBuffer Mb" "Cache: $memCache Kb" && exit $STATE_WARN ;;
$(($rangePercetageRam > $CR-1)))
printf "%s\n" "CRITICAL! RAM used: $valueRamUsedMb / $valueRamAllMb Mb ($printPercetageRamUsed%)" "RAM free: $valueRamFreeMb Mb ($printPercetageRam%)" "Buffer: $memBuffer Mb" "Cache: $memCache Kb" && exit $STATE_CRIT ;;
esac
}
UBNT.Station() {
UBNT.GetData station
GetStatus.CheckStaMode $mode
printf "%s\n\n" "Station Information"
printf "%s\t\t%s\n" "Name:" "$ubntStaName"
printf "%s\t\t%s\n" "Signal:" "$ubntStaSignal dBm"
printf "%s\t%s\n" "Noise floor:" "$ubntStaNoiseFloor"
printf "%s\t\t%s\n" "CCQ:" "$ubntStaCcq %"
printf "%s\t%s\n\n" "Con. Time:" "$(echo $ubntStaConnTime)"
printf "%s\t%s\n" "TX/RX Rate:" "$(GetStatus.BToMB $ubntStaTxRate) / $(GetStatus.BToMB $ubntStaRxRate)"
printf "%s\t%s\n" "TX/RX Bytes:" "$(GetStatus.BToGB $ubntStaTxBytes) / $(GetStatus.BToGB $ubntStaRxBytes)"
}
UBNT.Wireless() {
UBNT.GetData wireless
printf "%s\n\n" "Wireless Information"
printf "%s\t\t%s\n" "SSID:" "$ubntWlStatSsid"
printf "%s\t\t%s\n" "Hide:" "$(GetStatus.OnOff $ubntWlStatHideSsid)"
printf "%s\t\t%s\n" "Signal:" "$ubntWlStatSignal dBm"
printf "%s\t\t%s\n" "RSSI:" "$ubntWlStatRssi dBm"
printf "%s\t\t%s\n" "CCQ:" "$ubntWlStatCcq"
printf "%s\t%s\n" "Noise floor:" "$ubntWlStatNoiseFloor"
printf "%s\t%s\n" "TX/RX Rate:" "$(GetStatus.BToMB $ubntWlStatTxRate) / $(GetStatus.BToMB $ubntWlStatRxRate)"
printf "%s\t%s\n" "Security:" "$ubntWlStatSecurity"
printf "%s\t\t%s\n" "WDS:" "$(GetStatus.OnOff $ubntWlStatWdsEnabled)"
printf "%s\t%s\n" "Ap Repeater:" "$(GetStatus.OnOff $ubntWlStatApRepeater)"
printf "%s\t%s\n" "Channel Width:" "$ubntWlStatChanWidth"
printf "%s\t%s\n" "Station Count:" "$ubntWlStatStaCount"
}
# - Help
Help.Main() {
echo $NAME
echo ''
Help.Usage
echo ''
Help.Option
echo ''
Help.Info
echo ''
exit $STATE_UNK
}
Help.Usage() {
printf "%s\n" "Method to compose the execution string"
printf "%s\n" "./$APPNAME -c <SNMP community> -h <host> -t <check>"
}
Help.Option() {
printf "%s\n" "OPTIONS:"
printf "%s\t%s\t%s\n\t\t\t%s\n" "-c" "--community" "SNMP v2 community string with Read access." " Default is $COMMUNITY."
printf "%s\t%s\t\t%s\n\t\t\t%s\n" "-h" "--host" "Host name or IP address to check." " Default is $HOST_NAME."
printf "%s\t%s\t\t%s\n\t\t\t%s\n" "-t" "--type" "[REQUIRED OPTION] Field for select element to check on AirOs Device." "{ airmax | info | radio | ram | station | wireless }"
printf "%s\t%s\t\t%s\n" "-H" "--help" "Show Script help"
printf "%s\t%s\t%s\n" "-V" "--version" "Show Script version"
}
Help.UBNT() {
printf "\n%s\n\n" "Ubiquiti airOs Check Function"
printf "%s\t%s\n\n" "Check" "Description"
printf "%s\t%s\n" "airmax" "Show all airMax Statistics of device"
printf "%s\t%s\n" "info" "Show basic information"
printf "%s\t%s\n" "radio" "Show status and statistics of radio"
printf "%s\t%s\n" "ram" "Show ram usage"
printf "%s\t%s\n" "station" "Show station information, work only on station setup"
printf "%s\t%s\n" "wireless" "Show wireless information"
}
Help.Info() {
printf "%s\t%s\t%s\n" "INFO:" "$NAME" "$VERSION" "" "$AUTHOR" "$URL"
}
# - COMMAND LINE ENCODER
while test -n "$1"; do
case "$1" in
--host | -h)
HOST_NAME=$2
shift ;;
--comunity | -c)
COMMUNITY=$2
shift ;;
--allert-wa|-wa)
WA=$2
shift ;;
--allert-cr|-cr)
CR=$2
shift ;;
--type | -t)
UBNT.Main $2
shift ;;
--help | -H)
Help.Main ;;
--version | -V)
Help.Info
exit $STATE ;;
*)
echo "Unknown argument: $1"
print_help
exit $STATE_UNK ;;
esac
shift
done
UBNT.Main
@@ -0,0 +1,74 @@
#!/bin/bash
# - State Variables
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
STATE=$STATE_OK
CURL_RETURN_CODE=0
Main(){
SITE="${PROTOCOL}://${URL}"
if [ ! -z $PORT ]; then
SITE+=":${PORT}"
fi
if [ ! -z $SUBDIRECTORY ]; then
SITE+="/${SUBDIRECTORY}"
fi
if [ -z $USR ]; then
CURL_OUTPUT="$(curl -s -k -w '\n%{http_code}' -m 100 --url $SITE | tail -n 1)"
else
CREDENTIAL="${USR}:${PSW}"
CURL_OUTPUT="$(curl -s -k -w '\n%{http_code}' -m 100 --ntlm --user $CREDENTIAL --url $SITE | tail -n 1)"
fi
if [ ${CURL_OUTPUT} -ne 200 ]; then
echo "Curl operation/command failed due to server return code - ${CURL_OUTPUT}"
STATE=$STATE_CRIT
else
echo "Connection success"
fi
}
while test -n "$1"; do
case "$1" in
--protocol | -p)
PROTOCOL=$2
shift ;;
--url | -u)
URL=$2
shift ;;
--user | -usr)
USR=$2
shift ;;
--password | -psw)
PSW=$2
shift;;
--port )
PORT=$2
shift;;
--subdirectory )
SUBDIRECTORY=$2
shift;;
*)
echo "Unknown argument: $1"
exit $STATE_UNK ;;
esac
shift
done
Main
exit $STATE
@@ -0,0 +1,418 @@
#!/bin/bash
# - VAR
# - Bash info
APPNAME=$(basename $0)
NAME="Check Switch Huawei"
AUTHOR="Kalarumeth"
VERSION="v0.1"
URL="https://github.com/Kalarumeth"
# - Default settings for connection
COMMUNITY="public"
HOST_NAME="localhost"
AP="authPriv"
AUTH="SHA-256"
PRIV="AES"
SNMPVERSION="3"
# - State Variables
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
STATE=$STATE_OK
# - OID
Huawei.OIDS() {
#Info
OID_sysDescr="1.3.6.1.2.1.1.1.0"
OID_sysUptimeIstance="1.3.6.1.2.1.1.3"
#Fan
OID_fanSlot="1.3.6.1.4.1.2011.5.25.31.1.1.10.1.1"
OID_fanSn="1.3.6.1.4.1.2011.5.25.31.1.1.10.1.2"
OID_fanReg="1.3.6.1.4.1.2011.5.25.31.1.1.10.1.3"
OID_fanMode="1.3.6.1.4.1.2011.5.25.31.1.1.10.1.4"
OID_fanSpeed="1.3.6.1.4.1.2011.5.25.31.1.1.10.1.5"
OID_fanPresent="1.3.6.1.4.1.2011.5.25.31.1.1.10.1.6"
OID_fanState="1.3.6.1.4.1.2011.5.25.31.1.1.10.1.7"
OID_fanDesc="1.3.6.1.4.1.2011.5.25.31.1.1.10.1.8"
#Power
OID_pwrSlot="1.3.6.1.4.1.2011.5.25.31.1.1.18.1.1"
OID_pwrSn="1.3.6.1.4.1.2011.5.25.31.1.1.18.1.2"
OID_pwrReg="1.3.6.1.4.1.2011.5.25.31.1.1.18.1.3"
OID_pwrMode="1.3.6.1.4.1.2011.5.25.31.1.1.18.1.4"
OID_pwrPresent="1.3.6.1.4.1.2011.5.25.31.1.1.18.1.5"
OID_pwrState="1.3.6.1.4.1.2011.5.25.31.1.1.18.1.6"
OID_pwrCurrent="1.3.6.1.4.1.2011.5.25.31.1.1.18.1.7"
OID_pwrVoltage="1.3.6.1.4.1.2011.5.25.31.1.1.18.1.8"
OID_pwrDesc="1.3.6.1.4.1.2011.5.25.31.1.1.18.1.9"
#Stack
OID_stkRun="1.3.6.1.4.1.2011.5.25.183.1.1"
OID_stkType="1.3.6.1.4.1.2011.5.25.183.1.2"
OID_stkPriority="1.3.6.1.4.1.2011.5.25.183.1.20.1.2"
OID_stkRole="1.3.6.1.4.1.2011.5.25.183.1.20.1.3"
OID_stkMac="1.3.6.1.4.1.2011.5.25.183.1.20.1.4"
OID_stkDevice="1.3.6.1.4.1.2011.5.25.183.1.20.1.5"
OID_stkId="1.3.6.1.4.1.2011.5.25.183.1.20.1.6"
}
# - MAIN CODE
Script.HostAlive() {
for server in $HOST_NAME; do
ping -c1 -W1 -q $server &>/dev/null
if [[ $? != 0 ]] ; then
printf "%s\n" "$server is unreachable"
exit $STATE_UNK
fi
done
}
Script.SNMP() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oen -l $AP -u $USER -e $ENGINEID -a $AUTH -A $PHAUTH -x $PRIV -X $PHPRIV $HOST_NAME $1
}
Huawei.Main() {
Script.HostAlive
case $1 in
info)
Huawei.Info
exit $STATE ;;
uptime)
Huawei.UpTime
exit $STATE ;;
fan)
Huawei.Fan
exit $STATE ;;
power)
Huawei.Power
exit $STATE ;;
stack)
Huawei.Stack
exit $STATE ;;
*)
echo "Unknown check!"
Help.Huawei
exit $STATE_UNK ;;
esac
}
Huawei.GetData() {
Huawei.OIDS
case $1 in
description)
sysDescr=$(Script.SNMP $OID_sysDescr | cut -d ':' -f 2);;
uptime)
sysUptimeIstance=$(Script.SNMP $OID_sysUptimeIstance | cut -d ')' -f 2 );;
fan)
fanSlot=($(Script.SNMP $OID_fanSlot | cut -d ' ' -f 4 ))
fanSn=($(Script.SNMP $OID_fanSn | cut -d ' ' -f 4 ))
fanReg=($(Script.SNMP $OID_fanReg | cut -d ' ' -f 4 ))
fanMode=($(Script.SNMP $OID_fanMode | cut -d ' ' -f 4 ))
fanSpeed=($(Script.SNMP $OID_fanSpeed | cut -d ' ' -f 4 ))
fanPresent=($(Script.SNMP $OID_fanPresent | cut -d ' ' -f 4 ))
fanState=($(Script.SNMP $OID_fanState | cut -d ' ' -f 4 ))
fanDesc=($(Script.SNMP $OID_fanDesc | cut -d '"' -f 2))
;;
power)
pwrSlot=($(Script.SNMP $OID_pwrSlot | cut -d ' ' -f 4 ))
pwrSn=($(Script.SNMP $OID_pwrSn | cut -d ' ' -f 4 ))
pwrReg=($(Script.SNMP $OID_pwrReg | cut -d ' ' -f 4 ))
pwrMode=($(Script.SNMP $OID_pwrMode | cut -d ' ' -f 4 ))
pwrPresent=($(Script.SNMP $OID_pwrPresent | cut -d ' ' -f 4 ))
pwrState=($(Script.SNMP $OID_pwrState | cut -d ' ' -f 4 ))
pwrCurrent=($(Script.SNMP $OID_pwrCurrent | cut -d ' ' -f 4 ))
pwrVoltage=($(Script.SNMP $OID_pwrVoltage | cut -d ' ' -f 4))
pwrDesc=($(Script.SNMP $OID_pwrDesc | cut -d '"' -f 2))
;;
stack)
stkRun=$(Script.SNMP $OID_stkRun | cut -d ' ' -f 4 )
stkType=$(Script.SNMP $OID_stkType | cut -d ' ' -f 4 )
stkPriority=($(Script.SNMP $OID_stkPriority | cut -d ' ' -f 4 ))
stkRole=($(Script.SNMP $OID_stkRole | cut -d ' ' -f 4 ))
stkMac=($(Script.SNMP $OID_stkMac | cut -d '"' -f 2 ))
stkDevice=($(Script.SNMP $OID_stkDevice | cut -d '"' -f 2 ))
stkId=($(Script.SNMP $OID_stkId | cut -d ' ' -f 4 ))
;;
esac
}
Huawei.ErrorCounter() {
for Error in "$(( WarningCounter + CriticalCounter ))"; do
if [[ $WarningCounter == 0 ]] && [[ $CriticalCounter == 0 ]] ; then
printf "%s\t%s\n\n" "OK!" "All $1 is Up"
elif [[ $WarningCounter != 0 ]] && [[ $CriticalCounter == 0 ]] ; then
printf "%s\t%s\n\n" "WARNING!" "$Error $1 with problem"
STATE=$STATE_WARN
elif [[ $CriticalCounter != 0 ]] ; then
printf "%s\t%s\n\n" "CRITICAL!" "$Error $1 with problem"
STATE=$STATE_CRIT
fi
done
}
# Device Information
Huawei.Info() {
Huawei.GetData description
printf "%s\n" "$sysDescr"
}
# UpTime
Huawei.UpTime() {
Huawei.GetData uptime
printf "%s\n" "$sysUptimeIstance"
}
# Fan
Huawei.Fan() {
Huawei.GetData fan
Huawei.Fan.Header
for((i=0; i<${#fanSlot[@]}; i++))
do
Huawei.Fan.Desc
printf "%s\t" "${fanSlot[$i]}"
printf "%s\t" "${fanSn[$i]}"
Huawei.Fan.Reg
Huawei.Fan.Mode
printf "%s\t" "${fanSpeed[$i]}"
Huawei.Fan.Present
Huawei.Fan.State
printf "\n"
done
}
Huawei.Fan.Header() {
WarningCounter=0
CriticalCounter=0
for((i=0; i<${#fanSlot[@]}; i++)); do
for value in "${fanState[$i]}"; do
if [[ $value == 2 ]]; then
CriticalCounter=$(( CriticalCounter + 1 ))
fi
done
done
Huawei.ErrorCounter "Fan"
if [[ $HOST_NAME == *"core"* ]] ; then
printf "%s\t\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" "Desc" "Unit" "Slot" "Reg" "Mode" "Speed" "Present" "State" "========================================================================"
elif [[ $HOST_NAME == *"acc"* ]] ; then
printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\n" "Unit" "Slot" "Reg" "Mode" "Speed" "Present" "State" "========================================================"
fi
}
Huawei.Fan.Desc() {
if [[ $HOST_NAME == *"core"* ]] ; then
printf "%s\t" "${fanDesc[$i]}"
fi
}
Huawei.Fan.Reg() {
case ${fanReg[$i]} in
1) printf "%s\t" "Yes" ;;
2) printf "%s\t" "No" ;;
esac
}
Huawei.Fan.Mode() {
case ${fanMode[$i]} in
1) printf "%s\t" "Auto" ;;
2) printf "%s\t" "Manual" ;;
3) printf "%s\t" "Unknown" ;;
4) printf "%s\t" "Silent" ;;
esac
}
Huawei.Fan.Present() {
case ${fanPresent[$i]} in
1) printf "%s\t" "Present" ;;
2) printf "%s\t" "absent" ;;
esac
}
Huawei.Fan.State() {
case ${fanState[$i]} in
1) printf "%s\t" "Normal" ;;
2) printf "%s\t" "Abnormal" ;;
esac
}
# Power
Huawei.Power() {
Huawei.GetData power
Huawei.Power.Header
for((i=0; i<${#pwrSlot[@]}; i++))
do
printf "%s\t" "${pwrDesc[$i]}"
printf "%s\t" "${pwrSlot[$i]}"
printf "%s\t" "${pwrSn[$i]}"
Huawei.Power.Reg
Huawei.Power.Mode
Huawei.Power.Present
Huawei.Power.State
printf "%s\t" "${pwrCurrent[$i]} mA"
printf "%s\t" "${pwrVoltage[$i]} mV"
printf "\n"
done
}
Huawei.Power.Header() {
WarningCounter=0
CriticalCounter=0
for((i=0; i<${#pwrSlot[@]}; i++)); do
for value in "${pwrState[$i]}"; do
if [[ $value == 2 ]]; then
CriticalCounter=$(( CriticalCounter + 1 ))
fi
done
done
Huawei.ErrorCounter "Power Supply"
printf "%s\t\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" "Desc" "Unit" "Slot" "Reg" "Mode" "Present" "State" "Current" "Voltage" "=================================================================================="
}
Huawei.Power.Reg() {
case ${pwrReg[$i]} in
1) printf "%s\t" "Yes" ;;
2) printf "%s\t" "No" ;;
esac
}
Huawei.Power.Mode() {
case ${pwrMode[$i]} in
1) printf "%s\t" "Unknown" ;;
2) printf "%s\t" "DC" ;;
3) printf "%s\t" "AC" ;;
4) printf "%s\t" "hvdc" ;;
esac
}
Huawei.Power.Present() {
case ${pwrPresent[$i]} in
1) printf "%s\t" "Present" ;;
2) printf "%s\t" "Absent" ;;
esac
}
Huawei.Power.State() {
case ${pwrState[$i]} in
1) printf "%s\t" "Supply" ;;
2) printf "%s\t" "NotSupply" ;;
3) printf "%s\t" "Sleep" ;;
4) printf "%s\t" "Unknown" ;;
esac
}
# Stack
Huawei.Stack() {
Huawei.GetData stack
Huawei.Stack.Header
for((i=0; i<${#stkDevice[@]}; i++))
do
printf "%s\t" "${stkId[$i]}"
printf "%s\t" "${stkDevice[$i]}"
printf "%s\t" "${stkMac[$i]}"
Huawei.Stack.Role
printf "%s\t" "${stkPriority[$i]}"
printf "\n"
done
}
Huawei.Stack.Header() {
if [[ $stkRun == 1 ]] ; then
Huawei.Stack.Status
printf "%s\t%s\t\t%s\t\t%s\t\t%s\n" "Id" "Device" "Mac Address" "Role" "Priority" "=========================================================================="
elif [[ $stkRun == 2 ]] ; then
printf "%s\t%s\n\n" "CRITICAL!" "Stack is disable"
exit $STATE_CRIT
fi
}
Huawei.Stack.Status() {
printf "%s" "OK! Stack is "
case $stkRun in
1) printf "%s" "Enable" ;;
2) printf "%s" "Disable" ;;
esac
if [[ $HOST_NAME == *"acc"* ]] ; then
printf "%s" " and topology type is "
case $stkType in
1) printf "%s" "Ring" ;;
2) printf "%s" "Link" ;;
esac
fi
printf "\n\n"
}
Huawei.Stack.Role() {
if [[ $HOST_NAME == *"acc"* ]] ; then
printf "\t"
fi
case ${stkRole[$i]} in
1) printf "%s\t" "Master Switch" ;;
2) printf "%s\t" "Backup Switch" ;;
3) printf "%s\t" "Slave Switch" ;;
esac
}
# - COMMAND LINE ENCODER
while test -n "$1"; do
case "$1" in
--host | -h)
HOST_NAME=$2
shift ;;
--user | -u)
USER=$2
shift ;;
--engineId | -e)
ENGINEID=$2
shift ;;
--phAuth | -pa)
PHAUTH=$2
shift ;;
--phPriv | -pp)
PHPRIV=$2
shift ;;
--type | -t)
Huawei.Main $2
shift ;;
--help | -H)
Help.Main ;;
--version | -V)
Help.Info
exit $STATE ;;
*)
echo "Unknown argument: $1"
print_help
exit $STATE_UNK ;;
esac
shift
done
Huawei.Main
@@ -0,0 +1,44 @@
##########################
# Writer: Claudio Boggian
# Company: PAL s.r.l.
#-------------------------
# Date: 2023/08/25
# v: 1.0
# Reason: Emission
#-------------------------
##########################
$Services = Get-WmiObject win32_service -Filter "startmode = 'auto' AND state != 'running'"
$i = 0
$objs = $null
if ($Services){
foreach ($Service in $Services) {
# Exclude Triggered
if(!(Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\$($Service.Name)\TriggerInfo\"))
{
$i++
$objs += @(New-Object -TypeName PSObject -Property @{
Name = $Service.Name
Status = $Service.State
StartMode = $Service.StartMode
} | Select-Object Name, Status, StartMode)
}
}
}
if ($i -ne 0){
Write-Output "$($i) Services is not running!"
Write-Output $objs
$exitcode = 2
} else {
Write-Output "All Services are up and running!"
$exitcode = 0
}
exit $exitcode
@@ -0,0 +1,38 @@
##########################
# Writer: Claudio Boggian
# Company: PAL s.r.l.
#-------------------------
# Date: 2023/08/25
# v: 1.0
# Reason: Emission
#-------------------------
##########################
$exclusions=$args[0]
$tempServices = Get-Service | Where-Object { `
($_.starttype -eq 'Automatic') `
-and ($_.status -ne 'Running') `
-and ($exclusions.split(',') -notcontains $_.name)
}
$Services = @()
if ($tempServices){
foreach ($Service in $tempServices) {
# Exclude Triggered
if(!(Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\$($Service.Name)\TriggerInfo\"))
{
$Services += $Service | Select-Object name, displayname, status
}
}
}
$exitState = 0
if ($Services.Count -gt 0){
Write-Output "CRITICAL - $($Services.Count) Services are not running!"
Write-Output $Services
$exitState = 2
} else {
Write-Output "OK - All Services are up and running!"
}
exit $exitState
@@ -0,0 +1,341 @@
#!/bin/bash
# - VAR
# - Bash info
APPNAME=$(basename $0)
NAME="Check FireWall Fortinet"
AUTHOR="Kalarumeth"
VERSION="v0.1"
URL="https://github.com/Kalarumeth"
# - Default settings for connection
COMMUNITY="public"
HOST_NAME="localhost"
AP="authPriv"
AUTH="SHA-256"
PRIV="AES"
SNMPVERSION="3"
# - State Variables
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
STATE=$STATE_OK
# - OID
Fortinet.OIDS() {
#Info
OID_sysDescr="1.3.6.1.2.1.1.5"
OID_sysUptimeIstance="1.3.6.1.2.1.1.3"
#CPU
OID_fgProcessorUsage="1.3.6.1.4.1.12356.101.4.4.2.1.2" # Gauge32 '%'
#Memory
OID_fgProcModMemCapacity="1.3.6.1.4.1.12356.101.4.5.3.1.6" # Kb
OID_fgProcModMemUsage="1.3.6.1.4.1.12356.101.4.5.3.1.7"
#Sensors
OID_fgHwSensorEntIndex="1.3.6.1.4.1.12356.101.4.3.2.1.1"
OID_fgHwSensorEntName="1.3.6.1.4.1.12356.101.4.3.2.1.2"
OID_fgHwSensorEntValue="1.3.6.1.4.1.12356.101.4.3.2.1.3"
OID_fgHwSensorEntAlarmStatus="1.3.6.1.4.1.12356.101.4.3.2.1.4"
#HA
OID_fgHaStatsIndex="1.3.6.1.4.1.12356.101.13.2.1.1.1"
OID_fgHaStatsSerial="1.3.6.1.4.1.12356.101.13.2.1.1.2"
OID_fgHaStatsCpuUsage="1.3.6.1.4.1.12356.101.13.2.1.1.3"
OID_fgHaStatsMemUsage="1.3.6.1.4.1.12356.101.13.2.1.1.4"
OID_fgHaStatsNetUsage="1.3.6.1.4.1.12356.101.13.2.1.1.5"
OID_fgHaStatsSesCount="1.3.6.1.4.1.12356.101.13.2.1.1.6"
OID_fgHaStatsPktCount="1.3.6.1.4.1.12356.101.13.2.1.1.7"
OID_fgHaStatsByteCount="1.3.6.1.4.1.12356.101.13.2.1.1.8"
OID_fgHaStatsIdsCount="1.3.6.1.4.1.12356.101.13.2.1.1.9"
OID_fgHaStatsAvCount="1.3.6.1.4.1.12356.101.13.2.1.1.10"
OID_fgHaStatsHostname="1.3.6.1.4.1.12356.101.13.2.1.1.11"
OID_fgHaStatsSyncStatus="1.3.6.1.4.1.12356.101.13.2.1.1.12"
OID_fgHaStatsSyncDatimeSucc="1.3.6.1.4.1.12356.101.13.2.1.1.13"
OID_fgHaStatsSyncDatimeUnsucc="1.3.6.1.4.1.12356.101.13.2.1.1.14"
OID_fgHaStatsGlobalChecksum="1.3.6.1.4.1.12356.101.13.2.1.1.15"
OID_fgHaStatsMasterSerial="1.3.6.1.4.1.12356.101.13.2.1.1.16"
}
# - MAIN CODE
Script.HostAlive() {
for server in $HOST_NAME; do
ping -c1 -W1 -q $server &>/dev/null
if [[ $? != 0 ]] ; then
printf "%s\n" "$server is unreachable"
exit $STATE_UNK
fi
done
}
Script.SNMP() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oev -l $AP -u $USER -a $AUTH -A $PHAUTH -x $PRIV -X $PHPRIV $HOST_NAME $1
}
Script.SNMP.Hex() {
snmpwalk -v $SNMPVERSION -r 1 -t 10 -Oav -l $AP -u $USER -a $AUTH -A $PHAUTH -x $PRIV -X $PHPRIV $HOST_NAME $1
}
Fortinet.Main() {
Script.HostAlive
case $1 in
uptime)
Fortinet.UpTime
exit $STATE ;;
cpu)
Fortinet.CPU
exit $STATE ;;
memory)
Fortinet.Memory
exit $STATE ;;
sensors)
Fortinet.Sensors
exit $STATE ;;
ha)
Fortinet.HAStatus
exit $STATE ;;
*)
echo "Unknown check!"
Help.Fortinet
exit $STATE_UNK ;;
esac
}
Fortinet.GetData() {
Fortinet.OIDS
case $1 in
uptime)
sysUptimeIstance=$(Script.SNMP $OID_sysUptimeIstance | cut -d ')' -f 2 )
;;
cpu)
sysCpuPerc=($(Script.SNMP $OID_fgProcessorUsage | cut -d ' ' -f 2))
;;
memory)
ramUsage=$(Script.SNMP $OID_fgProcModMemUsage | cut -d ' ' -f 2)
;;
sensors)
sensIndex=($(Script.SNMP $OID_fgHwSensorEntIndex | cut -d ' ' -f 2))
sensName=($(Script.SNMP $OID_fgHwSensorEntName | tr ' ' '_' | cut -d '"' -f 2))
sensValue=($(Script.SNMP $OID_fgHwSensorEntValue | cut -d '"' -f 2))
sensStatus=($(Script.SNMP $OID_fgHwSensorEntAlarmStatus | cut -d ' ' -f 2))
;;
ha)
fgHaStatsIndex=($(Script.SNMP $OID_fgHaStatsIndex | cut -d ' ' -f 2))
fgHaStatsSerial=($(Script.SNMP $OID_fgHaStatsSerial | cut -d '"' -f 2))
fgHaStatsCpuUsage=($(Script.SNMP $OID_fgHaStatsCpuUsage | cut -d ' ' -f 2))
fgHaStatsMemUsage=($(Script.SNMP $OID_fgHaStatsMemUsage | cut -d ' ' -f 2))
fgHaStatsNetUsage=($(Script.SNMP $OID_fgHaStatsNetUsage | cut -d ' ' -f 2))
fgHaStatsSesCount=($(Script.SNMP $OID_fgHaStatsSesCount | cut -d ' ' -f 2))
fgHaStatsPktCount=($(Script.SNMP $OID_fgHaStatsPktCount | cut -d ' ' -f 2))
fgHaStatsByteCount=($(Script.SNMP $OID_fgHaStatsByteCount | cut -d ' ' -f 2))
fgHaStatsIdsCount=($(Script.SNMP $OID_fgHaStatsIdsCount | cut -d ' ' -f 2))
fgHaStatsAvCount=($(Script.SNMP $OID_fgHaStatsAvCount | cut -d ' ' -f 2))
fgHaStatsHostname=($(Script.SNMP $OID_fgHaStatsHostname | cut -d '"' -f 2))
fgHaStatsSyncStatus=($(Script.SNMP $OID_fgHaStatsSyncStatus | cut -d ' ' -f 2))
fgHaStatsGlobalChecksum=($(Script.SNMP $OID_fgHaStatsGlobalChecksum | cut -d '"' -f 2))
fgHaStatsMasterSerial=($(Script.SNMP $OID_fgHaStatsMasterSerial | cut -d '"' -f 2))
;;
esac
}
Fortinet.ErrorCounter() {
for Error in "$(( WarningCounter + CriticalCounter ))"; do
if [[ $WarningCounter == 0 ]] && [[ $CriticalCounter == 0 ]] ; then
printf "%s\t%s\n\n" "OK!" "All $1 are on range"
elif [[ $WarningCounter != 0 ]] && [[ $CriticalCounter == 0 ]] ; then
printf "%s\t%s\n\n" "WARNING!" "$Error $1 with problem"
STATE=$STATE_WARN
elif [[ $CriticalCounter != 0 ]] ; then
printf "%s\t%s\n\n" "CRITICAL!" "$Error $1 with problem"
STATE=$STATE_CRIT
fi
done
}
# Device Information
Fortinet.UpTime() {
Fortinet.GetData uptime
printf "%s\n" "$sysUptimeIstance"
}
# CPU
Fortinet.CPU() {
Fortinet.GetData cpu
Fortinet.CPU.Header
for((i=0; i<${#sysCpuPerc[@]}; i++))
do
printf "%s\t" "${i} CPU" "${sysCpuPerc[$i]}%"
printf "\n"
done
}
Fortinet.CPU.Header() {
WarningCounter=0
CriticalCounter=0
for((i=0; i<${#sysCpuPerc[@]}; i++)); do
if [[ ${sysCpuPerc[$i]} > 80 ]]; then
WarningCounter=$(( WarningCounter + 1 ))
elif [[ ${sysCpuPerc[$i]} > 90 ]]; then
CriticalCounter=$(( CriticalCounter + 1 ))
fi
done
Fortinet.ErrorCounter "CPU"
printf "%s\t%s\n%s\n" "Id CPU" "Percentage" "======================"
}
# Memory
Fortinet.Memory() {
Fortinet.GetData memory
case 1 in
$(($ramUsage <= 85-1)))
printf "%s\n" "OK! RAM used: $ramUsage%" && exit $STATE_OK ;;
$(($ramUsage <= 95-1)))
printf "%s\n" "WARRING! RAM used: $ramUsage%" && exit $STATE_WARN ;;
$(($ramUsage > 95-1)))
printf "%s\n" "CRITICAL! RAM used: $ramUsage%"&& exit $STATE_CRIT ;;
esac
}
# Sensors
Fortinet.Sensors() {
Fortinet.GetData sensors
Fortinet.Sensors.Header
for((i=0; i<${#sensName[@]}; i++)); do
Fortinet.Sensors.Status
Fortinet.Sensors.Value
Fortinet.Sensors.Name
printf "\n"
done
}
Fortinet.Sensors.Value() {
value=$(echo ${sensValue[$i]} | cut -d "." -f 1)
printf "%s\t" "${value}"
}
Fortinet.Sensors.Status() {
case ${sensStatus[$i]} in
0) printf "%s\t" "Ok" ;;
1) printf "%s\t" "Crit!" ;;
esac
}
Fortinet.Sensors.Name() {
name=$(echo ${sensName[$i]} | tr '_' ' ')
printf "%s\t" "${name}"
}
Fortinet.Sensors.Header() {
WarningCounter=0
CriticalCounter=0
for((i=0; i<${#sensStatus[@]}; i++)); do
if [[ ${sensStatus[$i]} != 0 ]]; then
CriticalCounter=$(( CriticalCounter + 1 ))
fi
done
Fortinet.ErrorCounter "Sensors"
printf "%s\t%s\t%s\n%s\n" "Status" "Value" "Name" "==============================="
}
# HA
Fortinet.HAStatus(){
Fortinet.GetData ha
Fortinet.HAStatus.Header
for((i=0; i<${#fgHaStatsIndex[@]}; i++)); do
printf "%s\t%s\n" "Index :" ${fgHaStatsIndex[$i]}
printf "%s\t%s\n" "HostName :" ${fgHaStatsHostname[$i]}
printf "%s\t%s\n" "Serial :" ${fgHaStatsSerial[$i]}
printf "%s\t%s\n" "CPUUsage :" "${fgHaStatsCpuUsage[$i]} %"
printf "%s\t%s\n" "RamUsage :" "${fgHaStatsMemUsage[$i]} %"
printf "%s\t%s\n" "NetUsage :" "${fgHaStatsNetUsage[$i]} kbs"
printf "%s\t%s\n" "Session :" ${fgHaStatsSesCount[$i]}
printf "%s\t%s\n" "PktCount :" ${fgHaStatsPktCount[$i]}
printf "%s\t%s\n" "ByteCount :" ${fgHaStatsByteCount[$i]}
printf "%s\t%s\n" "IdsCount :" ${fgHaStatsIdsCount[$i]}
printf "%s\t%s\n" "AvCount :" ${fgHaStatsAvCount[$i]}
Fortinet.HAStatus.SyncStatus
printf "%s\t%s\n" "GlobalChecksum :" ${fgHaStatsGlobalChecksum[$i]}
printf "%s\t%s\n" "MasterSerial :" ${fgHaStatsMasterSerial[$i]}
printf '\n'
done
}
Fortinet.HAStatus.Header(){
WarningCounter=0
CriticalCounter=0
for((i=0; i<${#fgHaStatsSyncStatus[@]}; i++)); do
if [[ ${fgHaStatsSyncStatus[$i]} == 0 ]]; then
CriticalCounter=$(( CriticalCounter + 1 ))
fi
done
Fortinet.ErrorCounter "HA value"
printf "%s\n" "=================================="
}
Fortinet.HAStatus.SyncStatus(){
case ${fgHaStatsSyncStatus[$i]} in
0) printf "%s\t%s\n" "SyncStatus :" "unsynchronized" ;;
1) printf "%s\t%s\n" "SyncStatus :" "synchronized" ;;
esac
}
# - COMMAND LINE ENCODER
while test -n "$1"; do
case "$1" in
--host | -h)
HOST_NAME=$2
shift ;;
--user | -u)
USER=$2
shift ;;
--phAuth | -pa)
PHAUTH=$2
shift ;;
--phPriv | -pp)
PHPRIV=$2
shift ;;
--type | -t)
Fortinet.Main $2
shift ;;
--help | -H)
Help.Main ;;
--version | -V)
Help.Info
exit $STATE ;;
*)
echo "Unknown argument: $1"
print_help
exit $STATE_UNK ;;
esac
shift
done
Fortinet.Main
Submodule Icinga2/Monitoring/012 - SolarEdge/console_solaredge added at 33977d5047
@@ -0,0 +1,121 @@
##########################
# Writer: Claudio Boggian
# Company: PAL s.r.l.
#-------------------------
# Date: 2024/02/20
# v: 1.0
# Reason: Emission
#-------------------------
##########################
Param(
[string] $ApplicationId = "",
[string] $Secured = "",
[string] $tenantID = "",
[Int64] $warn = 30,
[Int64] $crit = 15
)
if ("" -eq $ApplicationId){
Write-Host "First param - ApplicationId not set" -ForegroundColor red
exit (2)
} elseif ("" -eq $Secured){
Write-Host "Second param - SecuredId not set" -ForegroundColor red
exit (2)
} elseif ("" -eq $TenantID){
Write-Host "Third param - TenantID not set" -ForegroundColor red
exit (2)
}
$ExitCode = 0
$SecuredPasswordPassword = ConvertTo-SecureString -String $Secured -AsPlainText -Force
$ClientSecretCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ApplicationId, $SecuredPasswordPassword
Connect-MgGraph -TenantId $tenantID -ClientSecretCredential $ClientSecretCredential -NoWelcome
$Applications = Get-MgApplication -all
$Logs = @()
$ExpiredSecrets = @()
$Res = @()
foreach ($App in $Applications) {
$AppName = $App.DisplayName
$AppID = $App.Id
$ApplID = $App.AppId
if ($null -eq $AppID) { continue }
$AppCreds = Get-MgApplication -ApplicationId $AppID | Select-Object PasswordCredentials, KeyCredentials
$Secrets = $AppCreds.PasswordCredentials
foreach ($Secret in $Secrets) {
$StartDate = $Secret.StartDateTime
$EndDate = $Secret.EndDateTime
$SecretName = $Secret.DisplayName
$RemainingDaysCount = ($EndDate - (Get-Date)).Days
if($RemainingDaysCount -le $warn -and $RemainingDaysCount -ge 0){
$Logs += [PSCustomObject]@{
ApplicationName = $AppName
ApplicationID = $ApplID
SecretName = $SecretName
SecretStartDate = $StartDate
SecretEndDate = ($EndDate).ToString("dd/MM/yyyy")
RemainingDaysCount = $RemainingDaysCount
}
} elseif ($null -ne $EndDate -and $RemainingDaysCount -lt -1) {
$ExpiredSecrets += [PSCustomObject]@{
ApplicationName = $AppName
EndDate = ($EndDate).ToString("dd/MM/yyyy")
ApplicationID = $ApplID
}
}
}
}
if ($Logs.Length -gt 0) {
Write-Host 'WARN!' $Logs.Length ' Secret need attention!'
} else {
Write-Host 'OK! All secret are in range'
}
if ($ExpiredSecrets.Length -gt 0) {
Write-Host $ExpiredSecrets.Length ' Secret expired!'
Write-Host ''
Write-Host 'Expired:'
$ExpiredSecrets | Sort-Object -Property 'ApplicationName' | Format-Table
}
if ($Logs.Length -gt 0) {
Write-Host 'Expiring:'
Write-Host ''
}
foreach ($GLog in $Logs | Sort-Object -Property 'ApplicationName' | Group-Object -Property 'ApplicationName'){
Write-Host '/!\' $GLog.Name -ForegroundColor yellow
foreach ($Log in $GLog.Group){
if ($null -ne $Log.SecretEndDate){
if ($Log.RemainingDaysCount -cle $crit) {
$ExitCode = 2
} elseif($Log.RemainingDaysCount -cle $warn){
if($ExitCode -ne 2){
$ExitCode = 1
}
}
$Res = [PSCustomObject]@{
DaysLeft = $Log.RemainingDaysCount
SecretName = $Log.SecretName
EndDate = $Log.SecretEndDate
}
}
}
$Res | Format-Table
}
exit ($ExitCode)
@@ -0,0 +1,43 @@
$Devices = @()
$Resultes = @()
$LogOutPut = @()
$DeviceCount = 0
$exitState = 0
$Devices = Get-ADComputer -Properties * -Filter { OperatingSystem -like "Windows*"} |
Where-Object { $_.Enabled -eq $true } | Select-Object Name, DNSHostName, OperatingSystem, OperatingSystemVersion | Sort-Object Name
foreach ($Device in $Devices){
if (Test-Connection -ComputerName $Device.DNSHostName -Quiet){
$DeviceCount += 1
$Resultes = Get-WmiObject Win32_LogicalDisk -ComputerName $Device.DNSHostName -Filter "DriveType=3" -ErrorAction SilentlyContinue | Select-Object DeviceID, Size, Freespace
foreach ($Result in $Resultes | Where-Object {$_.DeviceID -like "C:"}){
$Percentage = "{0:P0}" -f ($Result.Freespace / $Result.Size)
if(($Result.DeviceID -eq "C:") -and ([int]$Percentage.Split("%")[0] -cle 10)){
$LogOutPut += [PSCustomObject]@{
HostName = $Device.DNSHostName
TotCapacity = "{0:N1}" -f ($Result.Size / 1gb) + " GB"
FreeSpace = "{0:N1}" -f ($Result.Freespace / 1gb ) + " GB"
FreePercentage = $Percentage
}
}
}
}
}
if ($LogOutPut.Count -eq 0){
Write-Output "OK - All devices are in range!"
Write-Output " Devices found: $($Devices.Count)"
Write-Output " Analyzed devices: $($DeviceCount)"
} else {
$exitState = 2
Write-Output "CRITICAL! - $($LogOutPut.Count) Devices with space issue!"
Write-Output " Devices found: $($Devices.Count)"
Write-Output " Analyzed devices: $($DeviceCount)"
$LogOutPut | Format-Table
}
Exit $exitState
@@ -0,0 +1,59 @@
<#
.SYNOPSIS
Get-DiskSpaceReport.ps1
.DESCRIPTION
Export all enabled Windows Servers disk space to CSV file.
.LINK
www.alitajran.com/check-free-disk-space-windows-powershell-script
.NOTES
Written by: ALI TAJRAN
Website: www.alitajran.com
LinkedIn: linkedin.com/in/alitajran
.CHANGELOG
V1.00, 02/17/2022 - Initial version
V1.10, 11/03/2023 - Added OS name and OS version
#>
Import-Module ActiveDirectory
# Delete reports older than 60 days
$OldReports = (Get-Date).AddDays(-60)
# Location for disk reports
Get-ChildItem "C:\Temp\*.*" |
Where-Object { $_.LastWriteTime -le $OldReports } |
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
# Create variable for log date
$LogDate = Get-Date -Format yyyyMMddhhmm
# Get all systems
$Systems = Get-ADComputer -Properties * -Filter { OperatingSystem -like "Windows 11 Enterprise" } |
Where-Object { $_.Enabled -eq $true } | Select-Object Name, DNSHostName, OperatingSystem, OperatingSystemVersion | Sort-Object Name
# Loop through each system
$DiskReport = ForEach ($System in $Systems) {
$OperatingSystem = $System.OperatingSystem
$OperatingSystemVersion = $System.OperatingSystemVersion
Get-WmiObject Win32_LogicalDisk `
-ComputerName $System.DNSHostName -Filter "DriveType=3" `
-ErrorAction SilentlyContinue |
Select-Object `
@{Label = "HostName"; Expression = { $_.SystemName } },
@{Label = "DriveLetter"; Expression = { $_.DeviceID } },
@{Label = "DriveName"; Expression = { $_.VolumeName } },
@{Label = "Total Capacity (GB)"; Expression = { "{0:N1}" -f ($_.Size / 1gb) } },
@{Label = "Free Space (GB)"; Expression = { "{0:N1}" -f ($_.Freespace / 1gb ) } },
@{Label = 'Free Space (%)'; Expression = { "{0:P0}" -f ($_.Freespace / $_.Size) } },
@{Label = "Operating System"; Expression = { $OperatingSystem } },
@{Label = "Operating System Version"; Expression = { $OperatingSystemVersion } }
}
# Create disk report
$DiskReport |
Export-Csv -Path "C:\Temp\DiskReport.csv" -NoTypeInformation #-Delimiter ";"
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,718 @@
.1.3.6.1.2.1.1.1.0 = STRING: "Spectralink IP-DECT Base Station"
.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.8072.3.2.10
.1.3.6.1.2.1.1.3.0 = Timeticks: (525221) 1:27:32.21
.1.3.6.1.2.1.1.4.0 = STRING: "root@localhost"
.1.3.6.1.2.1.1.5.0 = STRING: "rpn-00.pal.local"
.1.3.6.1.2.1.1.6.0 = STRING: "Unknown"
.1.3.6.1.2.1.1.8.0 = Timeticks: (12) 0:00:00.12
.1.3.6.1.2.1.1.9.1.2.1 = OID: .1.3.6.1.6.3.1
.1.3.6.1.2.1.1.9.1.2.2 = OID: .1.3.6.1.6.3.16.2.2.1
.1.3.6.1.2.1.1.9.1.2.3 = OID: .1.3.6.1.2.1.49
.1.3.6.1.2.1.1.9.1.2.4 = OID: .1.3.6.1.2.1.50
.1.3.6.1.2.1.1.9.1.2.5 = OID: .1.3.6.1.2.1.4
.1.3.6.1.2.1.1.9.1.2.6 = OID: .1.3.6.1.6.3.10.3.1.1
.1.3.6.1.2.1.1.9.1.2.7 = OID: .1.3.6.1.6.3.11.3.1.1
.1.3.6.1.2.1.1.9.1.2.8 = OID: .1.3.6.1.6.3.15.2.1.1
.1.3.6.1.2.1.1.9.1.3.1 = STRING: "The MIB module for SNMPv2 entities"
.1.3.6.1.2.1.1.9.1.3.2 = STRING: "View-based Access Control Model for SNMP."
.1.3.6.1.2.1.1.9.1.3.3 = STRING: "The MIB module for managing TCP implementations"
.1.3.6.1.2.1.1.9.1.3.4 = STRING: "The MIB module for managing UDP implementations"
.1.3.6.1.2.1.1.9.1.3.5 = STRING: "The MIB module for managing IP and ICMP implementations"
.1.3.6.1.2.1.1.9.1.3.6 = STRING: "The SNMP Management Architecture MIB."
.1.3.6.1.2.1.1.9.1.3.7 = STRING: "The MIB for Message Processing and Dispatching."
.1.3.6.1.2.1.1.9.1.3.8 = STRING: "The management information definitions for the SNMP User-based Security Model."
.1.3.6.1.2.1.1.9.1.4.1 = Timeticks: (10) 0:00:00.10
.1.3.6.1.2.1.1.9.1.4.2 = Timeticks: (10) 0:00:00.10
.1.3.6.1.2.1.1.9.1.4.3 = Timeticks: (11) 0:00:00.11
.1.3.6.1.2.1.1.9.1.4.4 = Timeticks: (11) 0:00:00.11
.1.3.6.1.2.1.1.9.1.4.5 = Timeticks: (12) 0:00:00.12
.1.3.6.1.2.1.1.9.1.4.6 = Timeticks: (12) 0:00:00.12
.1.3.6.1.2.1.1.9.1.4.7 = Timeticks: (12) 0:00:00.12
.1.3.6.1.2.1.1.9.1.4.8 = Timeticks: (12) 0:00:00.12
.1.3.6.1.2.1.2.1.0 = INTEGER: 2
.1.3.6.1.2.1.2.2.1.1.1 = INTEGER: 1
.1.3.6.1.2.1.2.2.1.1.2 = INTEGER: 2
.1.3.6.1.2.1.2.2.1.2.1 = STRING: "lo"
.1.3.6.1.2.1.2.2.1.2.2 = STRING: "eth0"
.1.3.6.1.2.1.2.2.1.3.1 = INTEGER: 24
.1.3.6.1.2.1.2.2.1.3.2 = INTEGER: 6
.1.3.6.1.2.1.2.2.1.4.1 = INTEGER: 65536
.1.3.6.1.2.1.2.2.1.4.2 = INTEGER: 1500
.1.3.6.1.2.1.2.2.1.5.1 = Gauge32: 10000000
.1.3.6.1.2.1.2.2.1.5.2 = Gauge32: 100000000
.1.3.6.1.2.1.2.2.1.6.1 = ""
.1.3.6.1.2.1.2.2.1.6.2 = Hex-STRING: 00 13 D1 91 EC 70
.1.3.6.1.2.1.2.2.1.7.1 = INTEGER: 1
.1.3.6.1.2.1.2.2.1.7.2 = INTEGER: 1
.1.3.6.1.2.1.2.2.1.8.1 = INTEGER: 1
.1.3.6.1.2.1.2.2.1.8.2 = INTEGER: 1
.1.3.6.1.2.1.2.2.1.9.1 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.2.2.1.9.2 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.2.2.1.10.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.10.2 = Counter32: 32411612
.1.3.6.1.2.1.2.2.1.11.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.11.2 = Counter32: 534065
.1.3.6.1.2.1.2.2.1.12.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.12.2 = Counter32: 0
.1.3.6.1.2.1.2.2.1.13.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.13.2 = Counter32: 0
.1.3.6.1.2.1.2.2.1.14.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.14.2 = Counter32: 0
.1.3.6.1.2.1.2.2.1.15.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.15.2 = Counter32: 0
.1.3.6.1.2.1.2.2.1.16.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.16.2 = Counter32: 817223
.1.3.6.1.2.1.2.2.1.17.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.17.2 = Counter32: 8661
.1.3.6.1.2.1.2.2.1.18.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.18.2 = Counter32: 0
.1.3.6.1.2.1.2.2.1.19.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.19.2 = Counter32: 0
.1.3.6.1.2.1.2.2.1.20.1 = Counter32: 0
.1.3.6.1.2.1.2.2.1.20.2 = Counter32: 0
.1.3.6.1.2.1.2.2.1.21.1 = Gauge32: 0
.1.3.6.1.2.1.2.2.1.21.2 = Gauge32: 0
.1.3.6.1.2.1.2.2.1.22.1 = OID: .0.0
.1.3.6.1.2.1.2.2.1.22.2 = OID: .0.0
.1.3.6.1.2.1.3.1.1.1.2.1.172.16.78.7 = INTEGER: 2
.1.3.6.1.2.1.3.1.1.1.2.1.172.16.78.254 = INTEGER: 2
.1.3.6.1.2.1.3.1.1.2.2.1.172.16.78.7 = Hex-STRING: 00 50 56 BA C1 A9
.1.3.6.1.2.1.3.1.1.2.2.1.172.16.78.254 = Hex-STRING: 00 09 0F 09 00 12
.1.3.6.1.2.1.3.1.1.3.2.1.172.16.78.7 = IpAddress: 172.16.78.7
.1.3.6.1.2.1.3.1.1.3.2.1.172.16.78.254 = IpAddress: 172.16.78.254
.1.3.6.1.2.1.4.1.0 = INTEGER: 2
.1.3.6.1.2.1.4.2.0 = INTEGER: 64
.1.3.6.1.2.1.4.3.0 = Counter32: 9184
.1.3.6.1.2.1.4.4.0 = Counter32: 0
.1.3.6.1.2.1.4.5.0 = Counter32: 0
.1.3.6.1.2.1.4.6.0 = Counter32: 0
.1.3.6.1.2.1.4.7.0 = Counter32: 0
.1.3.6.1.2.1.4.8.0 = Counter32: 0
.1.3.6.1.2.1.4.9.0 = Counter32: 9184
.1.3.6.1.2.1.4.10.0 = Counter32: 8482
.1.3.6.1.2.1.4.11.0 = Counter32: 0
.1.3.6.1.2.1.4.12.0 = Counter32: 0
.1.3.6.1.2.1.4.13.0 = INTEGER: 0
.1.3.6.1.2.1.4.14.0 = Counter32: 0
.1.3.6.1.2.1.4.15.0 = Counter32: 0
.1.3.6.1.2.1.4.16.0 = Counter32: 0
.1.3.6.1.2.1.4.17.0 = Counter32: 0
.1.3.6.1.2.1.4.18.0 = Counter32: 0
.1.3.6.1.2.1.4.19.0 = Counter32: 0
.1.3.6.1.2.1.4.20.1.1.127.0.0.1 = IpAddress: 127.0.0.1
.1.3.6.1.2.1.4.20.1.1.172.16.78.30 = IpAddress: 172.16.78.30
.1.3.6.1.2.1.4.20.1.2.127.0.0.1 = INTEGER: 1
.1.3.6.1.2.1.4.20.1.2.172.16.78.30 = INTEGER: 2
.1.3.6.1.2.1.4.20.1.3.127.0.0.1 = IpAddress: 255.0.0.0
.1.3.6.1.2.1.4.20.1.3.172.16.78.30 = IpAddress: 255.255.255.0
.1.3.6.1.2.1.4.20.1.4.127.0.0.1 = INTEGER: 0
.1.3.6.1.2.1.4.20.1.4.172.16.78.30 = INTEGER: 1
.1.3.6.1.2.1.4.21.1.1.0.0.0.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.4.21.1.1.172.16.78.0 = IpAddress: 172.16.78.0
.1.3.6.1.2.1.4.21.1.1.224.0.0.0 = IpAddress: 224.0.0.0
.1.3.6.1.2.1.4.21.1.2.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.21.1.2.172.16.78.0 = INTEGER: 2
.1.3.6.1.2.1.4.21.1.2.224.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.21.1.3.0.0.0.0 = INTEGER: 1
.1.3.6.1.2.1.4.21.1.3.172.16.78.0 = INTEGER: 0
.1.3.6.1.2.1.4.21.1.3.224.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.4.21.1.7.0.0.0.0 = IpAddress: 172.16.78.254
.1.3.6.1.2.1.4.21.1.7.172.16.78.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.4.21.1.7.224.0.0.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.4.21.1.8.0.0.0.0 = INTEGER: 4
.1.3.6.1.2.1.4.21.1.8.172.16.78.0 = INTEGER: 3
.1.3.6.1.2.1.4.21.1.8.224.0.0.0 = INTEGER: 3
.1.3.6.1.2.1.4.21.1.9.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.21.1.9.172.16.78.0 = INTEGER: 2
.1.3.6.1.2.1.4.21.1.9.224.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.21.1.11.0.0.0.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.4.21.1.11.172.16.78.0 = IpAddress: 255.255.255.0
.1.3.6.1.2.1.4.21.1.11.224.0.0.0 = IpAddress: 240.0.0.0
.1.3.6.1.2.1.4.21.1.13.0.0.0.0 = OID: .0.0
.1.3.6.1.2.1.4.21.1.13.172.16.78.0 = OID: .0.0
.1.3.6.1.2.1.4.21.1.13.224.0.0.0 = OID: .0.0
.1.3.6.1.2.1.4.22.1.1.2.172.16.78.7 = INTEGER: 2
.1.3.6.1.2.1.4.22.1.1.2.172.16.78.254 = INTEGER: 2
.1.3.6.1.2.1.4.22.1.2.2.172.16.78.7 = Hex-STRING: 00 50 56 BA C1 A9
.1.3.6.1.2.1.4.22.1.2.2.172.16.78.254 = Hex-STRING: 00 09 0F 09 00 12
.1.3.6.1.2.1.4.22.1.3.2.172.16.78.7 = IpAddress: 172.16.78.7
.1.3.6.1.2.1.4.22.1.3.2.172.16.78.254 = IpAddress: 172.16.78.254
.1.3.6.1.2.1.4.22.1.4.2.172.16.78.7 = INTEGER: 3
.1.3.6.1.2.1.4.22.1.4.2.172.16.78.254 = INTEGER: 3
.1.3.6.1.2.1.4.23.0 = Counter32: 0
.1.3.6.1.2.1.4.24.4.1.1.0.0.0.0.0.0.0.0.0.172.16.78.254 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.4.24.4.1.1.172.16.78.0.255.255.255.0.0.0.0.0.0 = IpAddress: 172.16.78.0
.1.3.6.1.2.1.4.24.4.1.1.224.0.0.0.240.0.0.0.0.0.0.0.0 = IpAddress: 224.0.0.0
.1.3.6.1.2.1.4.24.4.1.2.0.0.0.0.0.0.0.0.0.172.16.78.254 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.4.24.4.1.2.172.16.78.0.255.255.255.0.0.0.0.0.0 = IpAddress: 255.255.255.0
.1.3.6.1.2.1.4.24.4.1.2.224.0.0.0.240.0.0.0.0.0.0.0.0 = IpAddress: 240.0.0.0
.1.3.6.1.2.1.4.24.4.1.3.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: 0
.1.3.6.1.2.1.4.24.4.1.3.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.4.24.4.1.3.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.4.24.4.1.4.0.0.0.0.0.0.0.0.0.172.16.78.254 = IpAddress: 172.16.78.254
.1.3.6.1.2.1.4.24.4.1.4.172.16.78.0.255.255.255.0.0.0.0.0.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.4.24.4.1.4.224.0.0.0.240.0.0.0.0.0.0.0.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.4.24.4.1.5.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: 2
.1.3.6.1.2.1.4.24.4.1.5.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.24.4.1.5.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.24.4.1.6.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: 4
.1.3.6.1.2.1.4.24.4.1.6.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: 3
.1.3.6.1.2.1.4.24.4.1.6.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: 3
.1.3.6.1.2.1.4.24.4.1.7.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: 2
.1.3.6.1.2.1.4.24.4.1.7.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.24.4.1.7.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.24.4.1.9.0.0.0.0.0.0.0.0.0.172.16.78.254 = OID: .0.0
.1.3.6.1.2.1.4.24.4.1.9.172.16.78.0.255.255.255.0.0.0.0.0.0 = OID: .0.0
.1.3.6.1.2.1.4.24.4.1.9.224.0.0.0.240.0.0.0.0.0.0.0.0 = OID: .0.0
.1.3.6.1.2.1.4.24.4.1.10.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: 0
.1.3.6.1.2.1.4.24.4.1.10.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.4.24.4.1.10.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.4.24.4.1.11.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: 0
.1.3.6.1.2.1.4.24.4.1.11.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.4.24.4.1.11.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.4.24.4.1.12.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.12.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.12.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.13.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.13.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.13.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.14.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.14.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.14.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.15.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.15.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.15.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.4.1.16.0.0.0.0.0.0.0.0.0.172.16.78.254 = INTEGER: 1
.1.3.6.1.2.1.4.24.4.1.16.172.16.78.0.255.255.255.0.0.0.0.0.0 = INTEGER: 1
.1.3.6.1.2.1.4.24.4.1.16.224.0.0.0.240.0.0.0.0.0.0.0.0 = INTEGER: 1
.1.3.6.1.2.1.4.24.6.0 = Gauge32: 4
.1.3.6.1.2.1.4.24.7.1.7.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = INTEGER: 2
.1.3.6.1.2.1.4.24.7.1.7.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.24.7.1.7.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.24.7.1.7.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = INTEGER: 1
.1.3.6.1.2.1.4.24.7.1.8.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = INTEGER: 4
.1.3.6.1.2.1.4.24.7.1.8.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = INTEGER: 3
.1.3.6.1.2.1.4.24.7.1.8.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = INTEGER: 3
.1.3.6.1.2.1.4.24.7.1.8.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = INTEGER: 3
.1.3.6.1.2.1.4.24.7.1.9.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = INTEGER: 2
.1.3.6.1.2.1.4.24.7.1.9.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.24.7.1.9.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.24.7.1.9.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.4.24.7.1.10.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = Gauge32: 0
.1.3.6.1.2.1.4.24.7.1.10.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = Gauge32: 0
.1.3.6.1.2.1.4.24.7.1.10.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = Gauge32: 0
.1.3.6.1.2.1.4.24.7.1.10.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = Gauge32: 0
.1.3.6.1.2.1.4.24.7.1.11.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = Gauge32: 0
.1.3.6.1.2.1.4.24.7.1.11.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = Gauge32: 0
.1.3.6.1.2.1.4.24.7.1.11.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = Gauge32: 0
.1.3.6.1.2.1.4.24.7.1.11.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = Gauge32: 0
.1.3.6.1.2.1.4.24.7.1.12.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = INTEGER: 0
.1.3.6.1.2.1.4.24.7.1.12.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.4.24.7.1.12.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.4.24.7.1.12.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.4.24.7.1.13.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.13.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.13.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.13.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.14.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.14.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.14.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.14.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.15.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.15.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.15.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.15.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.16.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.16.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.16.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.16.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = INTEGER: -1
.1.3.6.1.2.1.4.24.7.1.17.1.4.0.0.0.0.0.2.0.0.1.4.172.16.78.254 = INTEGER: 1
.1.3.6.1.2.1.4.24.7.1.17.1.4.172.16.78.0.24.3.0.0.2.1.4.0.0.0.0 = INTEGER: 1
.1.3.6.1.2.1.4.24.7.1.17.1.4.224.0.0.0.4.3.0.0.2.1.4.0.0.0.0 = INTEGER: 1
.1.3.6.1.2.1.4.24.7.1.17.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128.3.0.0.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 = INTEGER: 1
.1.3.6.1.2.1.4.25.0 = INTEGER: 2
.1.3.6.1.2.1.4.26.0 = INTEGER: 64
.1.3.6.1.2.1.4.27.0 = Timeticks: (27) 0:00:00.27
.1.3.6.1.2.1.4.28.1.2.1 = INTEGER: 65535
.1.3.6.1.2.1.4.28.1.2.2 = INTEGER: 65535
.1.3.6.1.2.1.4.28.1.3.1 = INTEGER: 1
.1.3.6.1.2.1.4.28.1.3.2 = INTEGER: 1
.1.3.6.1.2.1.4.28.1.4.1 = Gauge32: 1000
.1.3.6.1.2.1.4.28.1.4.2 = Gauge32: 1000
.1.3.6.1.2.1.4.29.0 = Timeticks: (27) 0:00:00.27
.1.3.6.1.2.1.4.30.1.2.1 = Gauge32: 65535
.1.3.6.1.2.1.4.30.1.3.1 = ""
.1.3.6.1.2.1.4.30.1.5.1 = INTEGER: 1
.1.3.6.1.2.1.4.30.1.6.1 = Gauge32: 30000
.1.3.6.1.2.1.4.30.1.7.1 = Gauge32: 1000
.1.3.6.1.2.1.4.30.1.8.1 = INTEGER: 2
.1.3.6.1.2.1.4.31.1.1.3.1 = Counter32: 9088
.1.3.6.1.2.1.4.31.1.1.3.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.4.1 = Counter64: 9088
.1.3.6.1.2.1.4.31.1.1.4.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.5.1 = Counter32: 784488
.1.3.6.1.2.1.4.31.1.1.5.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.6.1 = Counter64: 784488
.1.3.6.1.2.1.4.31.1.1.6.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.7.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.7.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.8.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.8.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.9.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.9.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.10.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.10.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.11.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.11.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.12.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.12.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.13.1 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.13.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.14.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.14.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.15.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.15.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.16.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.16.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.17.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.17.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.18.1 = Counter32: 9088
.1.3.6.1.2.1.4.31.1.1.18.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.19.1 = Counter64: 9088
.1.3.6.1.2.1.4.31.1.1.19.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.20.1 = Counter32: 8397
.1.3.6.1.2.1.4.31.1.1.20.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.21.1 = Counter64: 8397
.1.3.6.1.2.1.4.31.1.1.21.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.22.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.22.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.23.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.23.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.24.1 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.24.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.25.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.25.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.26.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.26.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.27.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.27.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.28.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.28.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.29.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.29.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.30.1 = Counter32: 8397
.1.3.6.1.2.1.4.31.1.1.30.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.31.1 = Counter64: 8397
.1.3.6.1.2.1.4.31.1.1.31.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.32.1 = Counter32: 683537
.1.3.6.1.2.1.4.31.1.1.32.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.33.1 = Counter64: 683537
.1.3.6.1.2.1.4.31.1.1.33.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.34.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.34.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.35.1 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.35.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.36.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.36.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.37.1 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.37.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.38.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.38.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.39.1 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.39.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.40.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.40.2 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.41.1 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.41.2 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.42.1 = Counter32: 731
.1.3.6.1.2.1.4.31.1.1.43.1 = Counter64: 731
.1.3.6.1.2.1.4.31.1.1.44.1 = Counter32: 0
.1.3.6.1.2.1.4.31.1.1.45.1 = Counter64: 0
.1.3.6.1.2.1.4.31.1.1.46.1 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.31.1.1.46.2 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.31.1.1.47.1 = Gauge32: 60000
.1.3.6.1.2.1.4.31.1.1.47.2 = Gauge32: 60000
.1.3.6.1.2.1.4.31.2.0 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.31.3.1.3.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.3.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.4.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.4.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.5.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.5.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.6.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.6.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.7.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.7.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.8.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.8.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.9.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.9.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.10.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.10.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.11.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.11.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.12.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.12.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.13.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.13.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.14.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.14.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.15.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.15.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.16.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.16.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.17.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.17.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.18.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.18.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.19.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.19.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.20.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.20.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.21.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.21.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.23.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.23.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.24.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.24.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.25.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.25.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.26.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.26.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.27.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.27.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.28.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.28.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.29.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.29.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.30.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.30.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.31.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.31.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.32.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.32.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.33.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.33.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.34.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.34.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.35.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.35.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.36.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.36.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.37.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.37.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.38.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.38.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.39.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.39.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.40.2.1 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.40.2.2 = Counter32: 0
.1.3.6.1.2.1.4.31.3.1.41.2.1 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.41.2.2 = Counter64: 0
.1.3.6.1.2.1.4.31.3.1.46.2.1 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.31.3.1.46.2.2 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.31.3.1.47.2.1 = Gauge32: 60000
.1.3.6.1.2.1.4.31.3.1.47.2.2 = Gauge32: 60000
.1.3.6.1.2.1.4.32.1.5.1.1.4.127.0.0.0.8 = INTEGER: 2
.1.3.6.1.2.1.4.32.1.5.1.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128 = INTEGER: 2
.1.3.6.1.2.1.4.32.1.5.2.1.4.172.16.78.0.24 = INTEGER: 2
.1.3.6.1.2.1.4.32.1.6.1.1.4.127.0.0.0.8 = INTEGER: 1
.1.3.6.1.2.1.4.32.1.6.1.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128 = INTEGER: 1
.1.3.6.1.2.1.4.32.1.6.2.1.4.172.16.78.0.24 = INTEGER: 1
.1.3.6.1.2.1.4.32.1.7.1.1.4.127.0.0.0.8 = INTEGER: 2
.1.3.6.1.2.1.4.32.1.7.1.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128 = INTEGER: 2
.1.3.6.1.2.1.4.32.1.7.2.1.4.172.16.78.0.24 = INTEGER: 2
.1.3.6.1.2.1.4.32.1.8.1.1.4.127.0.0.0.8 = Gauge32: 4294967295
.1.3.6.1.2.1.4.32.1.8.1.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128 = Gauge32: 4294967295
.1.3.6.1.2.1.4.32.1.8.2.1.4.172.16.78.0.24 = Gauge32: 4294967295
.1.3.6.1.2.1.4.32.1.9.1.1.4.127.0.0.0.8 = Gauge32: 4294967295
.1.3.6.1.2.1.4.32.1.9.1.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128 = Gauge32: 4294967295
.1.3.6.1.2.1.4.32.1.9.2.1.4.172.16.78.0.24 = Gauge32: 4294967295
.1.3.6.1.2.1.4.33.0 = INTEGER: 1443286718
.1.3.6.1.2.1.4.34.1.3.1.4.127.0.0.1 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.3.1.4.172.16.78.30 = INTEGER: 2
.1.3.6.1.2.1.4.34.1.3.1.4.172.16.78.255 = INTEGER: 2
.1.3.6.1.2.1.4.34.1.3.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.4.1.4.127.0.0.1 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.4.1.4.172.16.78.30 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.4.1.4.172.16.78.255 = INTEGER: 3
.1.3.6.1.2.1.4.34.1.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.5.1.4.127.0.0.1 = OID: .1.3.6.1.2.1.4.32.1.5.1.1.4.127.0.0.0.8
.1.3.6.1.2.1.4.34.1.5.1.4.172.16.78.30 = OID: .1.3.6.1.2.1.4.32.1.5.2.1.4.172.16.78.0.24
.1.3.6.1.2.1.4.34.1.5.1.4.172.16.78.255 = OID: .1.3.6.1.2.1.4.32.1.5.2.1.4.172.16.78.0.24
.1.3.6.1.2.1.4.34.1.5.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 = OID: .1.3.6.1.2.1.4.32.1.5.1.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.128
.1.3.6.1.2.1.4.34.1.6.1.4.127.0.0.1 = INTEGER: 2
.1.3.6.1.2.1.4.34.1.6.1.4.172.16.78.30 = INTEGER: 2
.1.3.6.1.2.1.4.34.1.6.1.4.172.16.78.255 = INTEGER: 2
.1.3.6.1.2.1.4.34.1.6.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 = INTEGER: 2
.1.3.6.1.2.1.4.34.1.7.1.4.127.0.0.1 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.7.1.4.172.16.78.30 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.7.1.4.172.16.78.255 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.7.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.8.1.4.127.0.0.1 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.34.1.8.1.4.172.16.78.30 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.34.1.8.1.4.172.16.78.255 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.34.1.8.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.34.1.9.1.4.127.0.0.1 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.34.1.9.1.4.172.16.78.30 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.34.1.9.1.4.172.16.78.255 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.34.1.9.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.4.34.1.10.1.4.127.0.0.1 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.10.1.4.172.16.78.30 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.10.1.4.172.16.78.255 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.10.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 = INTEGER: 1
.1.3.6.1.2.1.4.34.1.11.1.4.127.0.0.1 = INTEGER: 2
.1.3.6.1.2.1.4.34.1.11.1.4.172.16.78.30 = INTEGER: 2
.1.3.6.1.2.1.4.34.1.11.1.4.172.16.78.255 = INTEGER: 2
.1.3.6.1.2.1.4.34.1.11.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 = INTEGER: 2
.1.3.6.1.2.1.4.35.1.4.2.1.4.172.16.78.7 = Hex-STRING: 00 50 56 BA C1 A9
.1.3.6.1.2.1.4.35.1.4.2.1.4.172.16.78.254 = Hex-STRING: 00 09 0F 09 00 12
.1.3.6.1.2.1.4.35.1.5.2.1.4.172.16.78.7 = Timeticks: (525275) 1:27:32.75
.1.3.6.1.2.1.4.35.1.5.2.1.4.172.16.78.254 = Timeticks: (525275) 1:27:32.75
.1.3.6.1.2.1.4.35.1.6.2.1.4.172.16.78.7 = INTEGER: 3
.1.3.6.1.2.1.4.35.1.6.2.1.4.172.16.78.254 = INTEGER: 3
.1.3.6.1.2.1.4.35.1.7.2.1.4.172.16.78.7 = INTEGER: 1
.1.3.6.1.2.1.4.35.1.7.2.1.4.172.16.78.254 = INTEGER: 3
.1.3.6.1.2.1.4.35.1.8.2.1.4.172.16.78.7 = INTEGER: 1
.1.3.6.1.2.1.4.35.1.8.2.1.4.172.16.78.254 = INTEGER: 1
.1.3.6.1.2.1.4.37.1.4.1.4.172.16.78.254.2 = Gauge32: 65535
.1.3.6.1.2.1.4.37.1.5.1.4.172.16.78.254.2 = INTEGER: 0
.1.3.6.1.2.1.5.1.0 = Counter32: 14
.1.3.6.1.2.1.5.2.0 = Counter32: 0
.1.3.6.1.2.1.5.3.0 = Counter32: 12
.1.3.6.1.2.1.5.4.0 = Counter32: 0
.1.3.6.1.2.1.5.5.0 = Counter32: 0
.1.3.6.1.2.1.5.6.0 = Counter32: 0
.1.3.6.1.2.1.5.7.0 = Counter32: 0
.1.3.6.1.2.1.5.8.0 = Counter32: 2
.1.3.6.1.2.1.5.9.0 = Counter32: 0
.1.3.6.1.2.1.5.10.0 = Counter32: 0
.1.3.6.1.2.1.5.11.0 = Counter32: 0
.1.3.6.1.2.1.5.12.0 = Counter32: 0
.1.3.6.1.2.1.5.13.0 = Counter32: 0
.1.3.6.1.2.1.5.14.0 = Counter32: 2
.1.3.6.1.2.1.5.15.0 = Counter32: 0
.1.3.6.1.2.1.5.16.0 = Counter32: 0
.1.3.6.1.2.1.5.17.0 = Counter32: 0
.1.3.6.1.2.1.5.18.0 = Counter32: 0
.1.3.6.1.2.1.5.19.0 = Counter32: 0
.1.3.6.1.2.1.5.20.0 = Counter32: 0
.1.3.6.1.2.1.5.21.0 = Counter32: 0
.1.3.6.1.2.1.5.22.0 = Counter32: 2
.1.3.6.1.2.1.5.23.0 = Counter32: 0
.1.3.6.1.2.1.5.24.0 = Counter32: 0
.1.3.6.1.2.1.5.25.0 = Counter32: 0
.1.3.6.1.2.1.5.26.0 = Counter32: 0
.1.3.6.1.2.1.5.29.1.2.1 = Counter32: 14
.1.3.6.1.2.1.5.29.1.2.2 = Counter32: 0
.1.3.6.1.2.1.5.29.1.3.1 = Counter32: 0
.1.3.6.1.2.1.5.29.1.3.2 = Counter32: 0
.1.3.6.1.2.1.5.29.1.4.1 = Counter32: 2
.1.3.6.1.2.1.5.29.1.4.2 = Counter32: 0
.1.3.6.1.2.1.5.29.1.5.1 = Counter32: 0
.1.3.6.1.2.1.5.29.1.5.2 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.1.0 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.1.3 = Counter32: 12
.1.3.6.1.2.1.5.30.1.3.1.4 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.1.5 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.1.8 = Counter32: 2
.1.3.6.1.2.1.5.30.1.3.1.11 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.1.12 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.1.13 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.1.14 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.1.17 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.1.18 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.1 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.2 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.3 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.4 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.128 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.129 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.130 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.131 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.132 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.133 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.134 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.135 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.136 = Counter32: 0
.1.3.6.1.2.1.5.30.1.3.2.137 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.1.0 = Counter32: 2
.1.3.6.1.2.1.5.30.1.4.1.3 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.1.4 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.1.5 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.1.8 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.1.11 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.1.12 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.1.13 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.1.14 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.1.17 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.1.18 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.1 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.2 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.3 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.4 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.128 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.129 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.131 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.132 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.133 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.135 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.136 = Counter32: 0
.1.3.6.1.2.1.5.30.1.4.2.137 = Counter32: 0
.1.3.6.1.2.1.6.1.0 = INTEGER: 1
.1.3.6.1.2.1.6.2.0 = INTEGER: 200
.1.3.6.1.2.1.6.3.0 = INTEGER: 120000
.1.3.6.1.2.1.6.4.0 = INTEGER: -1
.1.3.6.1.2.1.6.5.0 = Counter32: 1
.1.3.6.1.2.1.6.6.0 = Counter32: 4
.1.3.6.1.2.1.6.7.0 = Counter32: 0
.1.3.6.1.2.1.6.8.0 = Counter32: 1
.1.3.6.1.2.1.6.9.0 = Gauge32: 1
.1.3.6.1.2.1.6.10.0 = Counter32: 908
.1.3.6.1.2.1.6.11.0 = Counter32: 938
.1.3.6.1.2.1.6.12.0 = Counter32: 0
.1.3.6.1.2.1.6.13.1.1.0.0.0.0.80.0.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.6.13.1.1.0.0.0.0.443.0.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.6.13.1.1.127.0.0.1.2002.0.0.0.0.0 = INTEGER: 2
.1.3.6.1.2.1.6.13.1.1.172.16.78.30.52270.172.16.78.7.56001 = INTEGER: 5
.1.3.6.1.2.1.6.13.1.2.0.0.0.0.80.0.0.0.0.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.6.13.1.2.0.0.0.0.443.0.0.0.0.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.6.13.1.2.127.0.0.1.2002.0.0.0.0.0 = IpAddress: 127.0.0.1
.1.3.6.1.2.1.6.13.1.2.172.16.78.30.52270.172.16.78.7.56001 = IpAddress: 172.16.78.30
.1.3.6.1.2.1.6.13.1.3.0.0.0.0.80.0.0.0.0.0 = INTEGER: 80
.1.3.6.1.2.1.6.13.1.3.0.0.0.0.443.0.0.0.0.0 = INTEGER: 443
.1.3.6.1.2.1.6.13.1.3.127.0.0.1.2002.0.0.0.0.0 = INTEGER: 2002
.1.3.6.1.2.1.6.13.1.3.172.16.78.30.52270.172.16.78.7.56001 = INTEGER: 52270
.1.3.6.1.2.1.6.13.1.4.0.0.0.0.80.0.0.0.0.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.6.13.1.4.0.0.0.0.443.0.0.0.0.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.6.13.1.4.127.0.0.1.2002.0.0.0.0.0 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.6.13.1.4.172.16.78.30.52270.172.16.78.7.56001 = IpAddress: 172.16.78.7
.1.3.6.1.2.1.6.13.1.5.0.0.0.0.80.0.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.6.13.1.5.0.0.0.0.443.0.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.6.13.1.5.127.0.0.1.2002.0.0.0.0.0 = INTEGER: 0
.1.3.6.1.2.1.6.13.1.5.172.16.78.30.52270.172.16.78.7.56001 = INTEGER: 56001
.1.3.6.1.2.1.6.14.0 = Counter32: 0
.1.3.6.1.2.1.6.15.0 = Counter32: 35
.1.3.6.1.2.1.6.19.1.7.1.4.172.16.78.30.52270.1.4.172.16.78.7.56001 = INTEGER: 5
.1.3.6.1.2.1.6.19.1.8.1.4.172.16.78.30.52270.1.4.172.16.78.7.56001 = Gauge32: 230
.1.3.6.1.2.1.6.20.1.4.1.4.0.0.0.0.80 = Gauge32: 215
.1.3.6.1.2.1.6.20.1.4.1.4.0.0.0.0.443 = Gauge32: 215
.1.3.6.1.2.1.6.20.1.4.1.4.127.0.0.1.2002 = Gauge32: 188
.1.3.6.1.2.1.6.20.1.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.80 = Gauge32: 215
.1.3.6.1.2.1.6.20.1.4.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.443 = Gauge32: 215
.1.3.6.1.2.1.7.1.0 = Counter32: 8041
.1.3.6.1.2.1.7.2.0 = Counter32: 0
.1.3.6.1.2.1.7.3.0 = Counter32: 0
.1.3.6.1.2.1.7.4.0 = Counter32: 8062
.1.3.6.1.2.1.7.5.1.1.0.0.0.0.161 = IpAddress: 0.0.0.0
.1.3.6.1.2.1.7.5.1.2.0.0.0.0.161 = INTEGER: 161
.1.3.6.1.2.1.7.7.1.8.1.4.0.0.0.0.161.1.4.0.0.0.0.0.3280 = Gauge32: 211
.1.3.6.1.2.1.7.7.1.8.1.4.172.16.78.30.33878.1.4.172.16.94.87.12203.3295 = Gauge32: 188
.1.3.6.1.2.1.7.7.1.8.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.161.2.16.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3281 = Gauge32: 211
dot3
.1.3.6.1.2.1.10.7.2.1.1.2 = INTEGER: 2
.1.3.6.1.2.1.10.7.2.1.3.2 = Counter32: 0
.1.3.6.1.2.1.10.7.2.1.7.2 = Counter32: 0
.1.3.6.1.2.1.10.7.2.1.10.2 = Counter32: 0
.1.3.6.1.2.1.10.7.2.1.11.2 = Counter32: 0
.1.3.6.1.2.1.10.7.2.1.13.2 = Counter32: 0
.1.3.6.1.2.1.10.7.2.1.16.2 = Counter32: 0
.1.3.6.1.2.1.10.7.2.1.19.2 = INTEGER: 3
snmp
.1.3.6.1.2.1.11.1.0 = Counter32: 1323
.1.3.6.1.2.1.11.2.0 = Counter32: 1323
.1.3.6.1.2.1.11.3.0 = Counter32: 0
.1.3.6.1.2.1.11.4.0 = Counter32: 0
.1.3.6.1.2.1.11.5.0 = Counter32: 0
.1.3.6.1.2.1.11.6.0 = Counter32: 0
.1.3.6.1.2.1.11.8.0 = Counter32: 0
.1.3.6.1.2.1.11.9.0 = Counter32: 0
.1.3.6.1.2.1.11.10.0 = Counter32: 0
.1.3.6.1.2.1.11.11.0 = Counter32: 0
.1.3.6.1.2.1.11.12.0 = Counter32: 0
.1.3.6.1.2.1.11.13.0 = Counter32: 1333
.1.3.6.1.2.1.11.14.0 = Counter32: 0
.1.3.6.1.2.1.11.15.0 = Counter32: 0
.1.3.6.1.2.1.11.16.0 = Counter32: 1337
.1.3.6.1.2.1.11.17.0 = Counter32: 0
.1.3.6.1.2.1.11.18.0 = Counter32: 0
.1.3.6.1.2.1.11.19.0 = Counter32: 0
.1.3.6.1.2.1.11.20.0 = Counter32: 0
.1.3.6.1.2.1.11.21.0 = Counter32: 0
.1.3.6.1.2.1.11.22.0 = Counter32: 0
.1.3.6.1.2.1.11.24.0 = Counter32: 0
.1.3.6.1.2.1.11.25.0 = Counter32: 0
.1.3.6.1.2.1.11.26.0 = Counter32: 0
.1.3.6.1.2.1.11.27.0 = Counter32: 0
.1.3.6.1.2.1.11.28.0 = Counter32: 1347
.1.3.6.1.2.1.11.29.0 = Counter32: 0
.1.3.6.1.2.1.11.30.0 = INTEGER: 2
.1.3.6.1.2.1.11.31.0 = Counter32: 0
.1.3.6.1.2.1.11.32.0 = Counter32: 0
.1.3.6.1.2.1.16.1.1.1.1.2 = INTEGER: 2
ifXEntry
.1.3.6.1.2.1.31.1.1.1.1.1 = STRING: "lo"
.1.3.6.1.2.1.31.1.1.1.1.2 = STRING: "eth0"
.1.3.6.1.2.1.31.1.1.1.2.1 = Counter32: 0
.1.3.6.1.2.1.31.1.1.1.2.2 = Counter32: 0
.1.3.6.1.2.1.31.1.1.1.3.1 = Counter32: 0
.1.3.6.1.2.1.31.1.1.1.3.2 = Counter32: 0
.1.3.6.1.2.1.31.1.1.1.4.1 = Counter32: 0
.1.3.6.1.2.1.31.1.1.1.4.2 = Counter32: 0
.1.3.6.1.2.1.31.1.1.1.5.1 = Counter32: 0
.1.3.6.1.2.1.31.1.1.1.5.2 = Counter32: 0
.1.3.6.1.2.1.31.1.1.1.6.1 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.6.2 = Counter64: 32411612
.1.3.6.1.2.1.31.1.1.1.7.1 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.7.2 = Counter64: 534065
.1.3.6.1.2.1.31.1.1.1.8.1 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.8.2 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.9.1 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.9.2 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.10.1 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.10.2 = Counter64: 817223
.1.3.6.1.2.1.31.1.1.1.11.1 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.11.2 = Counter64: 8661
.1.3.6.1.2.1.31.1.1.1.12.1 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.12.2 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.13.1 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.13.2 = Counter64: 0
.1.3.6.1.2.1.31.1.1.1.15.1 = Gauge32: 10
.1.3.6.1.2.1.31.1.1.1.15.2 = Gauge32: 100
.1.3.6.1.2.1.31.1.1.1.16.1 = INTEGER: 2
.1.3.6.1.2.1.31.1.1.1.16.2 = INTEGER: 2
.1.3.6.1.2.1.31.1.1.1.17.1 = INTEGER: 2
.1.3.6.1.2.1.31.1.1.1.17.2 = INTEGER: 1
.1.3.6.1.2.1.31.1.1.1.18.1 = ""
.1.3.6.1.2.1.31.1.1.1.18.2 = ""
.1.3.6.1.2.1.31.1.1.1.19.1 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.31.1.1.1.19.2 = Timeticks: (0) 0:00:00.00
.1.3.6.1.2.1.31.1.5.0 = Timeticks: (0) 0:00:00.00
IPv6
.1.3.6.1.2.1.55.1.1.0 = INTEGER: 2
.1.3.6.1.2.1.55.1.2.0 = INTEGER: 64
.1.3.6.1.2.1.55.1.3.0 = Gauge32: 1
.1.3.6.1.2.1.55.1.5.1.2.1 = STRING: "lo"
.1.3.6.1.2.1.55.1.5.1.3.1 = OID: .0.0
.1.3.6.1.2.1.55.1.5.1.4.1 = Gauge32: 65536
.1.3.6.1.2.1.55.1.5.1.8.1 = ""
.1.3.6.1.2.1.55.1.5.1.9.1 = INTEGER: 1
.1.3.6.1.2.1.55.1.5.1.10.1 = INTEGER: 1
.1.3.6.1.4.1.9749.1.3.1.1.1.0 = Gauge32: 9563248
.1.3.6.1.4.1.9749.1.3.1.1.4.0 = Gauge32: 14218700
.1.3.6.1.4.1.9749.1.3.1.1.5.0 = STRING: "11A_"
.1.3.6.1.4.1.9749.1.3.1.1.6.0 = Gauge32: 14218500
.1.3.6.1.4.1.9749.1.3.1.1.7.0 = STRING: "PCS24Bb"
.1.3.6.1.4.1.9749.1.3.1.1.8.0 = Gauge32: 126538
@@ -0,0 +1,110 @@
#!/bin/bash
# - VAR
# - Bash info
APPNAME=$(basename $0)
NAME="Check SpectraLink"
AUTHOR="Kalarumeth"
VERSION="v0.1"
URL="https://github.com/Kalarumeth"
# - Default settings for connection
COMMUNITY="public"
HOST_NAME="localhost"
SNMPVERSION="2c"
# - State Variables
STATE_OK=0
STATE_WARN=1
STATE_CRIT=2
STATE_UNK=3
STATE=$STATE_OK
# - OID
SL.OIDS() {
OID_pUptime="1.3.6.1.2.1.1.3.0" #String The uptime of SL.
}
# - MAIN CODE
Script.HostAlive() {
for server in $HOST_NAME; do
ping -c1 -W1 -q $server &>/dev/null
if [[ $? != 0 ]] ; then
printf "%s\n" "$server is unreachable"
exit $STATE_UNK
fi
done
}
Script.SNMP() {
snmpwalk -v $SNMPVERSION -c $COMMUNITY -r 1 -t 10 -Oev $HOST_NAME $1
}
SL.Main() {
Script.HostAlive
case $1 in
uptime)
SL.UpTime
exit $STATE ;;
*)
echo "Unknown check!"
Help.SL
exit $STATE_UNK ;;
esac
}
SL.GetData() {
SL.OIDS
case $1 in
uptime)
sysUptimeIstance=$(Script.SNMP $OID_pUptime | cut -d ')' -f 2 )
;;
esac
}
# Device Information
SL.UpTime() {
SL.GetData uptime
printf "%s\n" "UpTime: $sysUptimeIstance"
}
# - HELP
Help.Main(){
printf "%s\n" "OPTIONS:"
printf "%s\t%s\t\t%s\n\t\t\t%s\n" "-t" "--type" "[REQUIRED OPTION] Field for select element to check." " { uptime } "
}
# - COMMAND LINE ENCODER
while test -n "$1"; do
case "$1" in
--host | -h)
HOST_NAME=$2
shift ;;
--community | -c)
COMMUNITY=$2
shift ;;
--type | -t)
SL.Main $2
shift ;;
--help | -H)
Help.Main ;;
--version | -V)
Help.Info
exit $STATE ;;
*)
echo "Unknown argument: $1"
print_help
exit $STATE_UNK ;;
esac
shift
done
SL.Main

Some files were not shown because too many files have changed in this diff Show More