• Products
    • View all products
    • Free trials
    • Buy online
    • Product lines
      • ApexSQL
      • Change Auditor
      • Enterprise Reporter
      • Foglight Database Monitoring
      • Foglight Evolve
      • KACE
      • Metalogix
      • Migration Manager
      • NetVault Backup
      • One Identity
      • QoreStor
      • Quest On Demand
      • Rapid Recovery
      • Recovery Manager
      • RemoteScan
      • SharePlex
      • Spotlight
      • Stat
      • Toad
    • Featured products
      • Cloud Management
        • Cloud Access Manager
        • Foglight for Virtualization, Enterprise Edition
        • Identity Manager
        • On Demand Migration for Email
        • Quest On Demand
        • Rapid Recovery
      • Data Protection
        • Foglight for Virtualization
        • NetVault
        • NetVault for Office 365
        • QorePortal
        • QoreStor
        • Rapid Recovery
        • vRanger
      • Database Management
        • Foglight for Databases
        • Litespeed for SQL Server
        • SharePlex
        • Spotlight SQL Server Enterprise
        • Toad Data Point
        • Toad DevOps Toolkit
        • Toad Edge
        • Toad for Oracle
        • Toad for SQL Server
      • Identity & Access Management
        • Active Roles
        • Defender
        • Identity Manager
        • Identity Manager Data Governance
        • One Identity Safeguard
        • Password Manager
        • Privileged Access Suite for Unix
        • Starling Connect
        • Starling Two-Factor Authentication
        • syslog-ng
      • Microsoft Platform Management
        • Active Administrator
        • Change Auditor
        • Enterprise Reporter
        • GPOADmin
        • InTrust
        • Metalogix
        • Migration Manager
        • On Demand Migration for Email
        • Quest On Demand
        • Recovery Manager
      • Performance Monitoring
        • Foglight Capacity Director
        • Foglight Hybrid Cloud Manager
        • Foglight for Databases
        • Foglight for Operating Systems
        • Foglight for Oracle
        • Foglight for PostgreSQL
        • Foglight for SQL Server
        • Foglight for Storage Management
        • Foglight for Virtualization
        • Spotlight on SQL Server
      • Unified Endpoint Management
        • Desktop Authority Management Suite
        • KACE Cloud Mobile Device Manager
        • KACE Desktop Authority
        • KACE Privilege Manager
        • KACE Systems Deployment Appliance
        • KACE Systems Management Appliance
        • RemoteScan
  • Solutions
    • View all Solutions
    • Industries
      • Education
      • Energy
      • Federal Government
      • Financial Services
      • Healthcare
      • State & Local Government
    • Platforms
      • Active Directory
      • Cisco
      • DB2
      • Exchange
      • Google
      • Hyper-v
      • Lotus Notes
      • OneDrive for Business
      • Office 365
      • Oracle
      • SAP/Sybase
      • SharePoint
      • SQL Server
      • Teams
      • Unix/Linux
      • VMware
      • Windows Server
    • Cloud Management
    • Data Protection
      • Overview
      • Backup & Recovery
      • Cloud Management
      • Deduplication & Compression
      • Disaster Recovery
      • Office 365 Data Protection
      • Virtualization Management
    • Database Management
      • Overview
      • Administration
      • Cloud Migration
      • Data Preparation and Provisioning
      • Development
      • DevOps
      • Performance Monitoring
      • Replication
      • Supported Platforms
        • IBM DB2
        • MySQL
        • Oracle
        • PostgreSQL
        • SAP Solutions
        • SQL Server
    • GDPR Compliance
    • Identity & Access Management
      • Overview
      • Identity Administration
      • Identity Governance
      • Privileged Access Management
      • AD Account Lifecycle Management
      • Access Control
      • Cloud
      • Log Management
    • Microsoft Platform Management
      • Overview
      • Mergers & Acquisitions
      • Migration & Consolidation
      • Office 365 Migration & Management
      • Security & Compliance
      • Windows Backup & Recovery
      • Supported Platforms
        • Active Directory
        • Cisco
        • Exchange
        • Google
        • Groupwise
        • Lotus Notes
        • Office 365
        • OneDrive for Business
        • SharePoint
        • SQL Server
        • Teams
        • Unix/Linux
        • Windows Server
    • Performance Monitoring
      • Overview
      • Database Performance Monitoring
      • Operating System Monitoring
      • Storage Performance & Utilization Management
      • Supported Platforms
        • Active Directory
        • DB2
        • Exchange
        • Java
        • Hyper-V
        • .NET
        • Oracle
        • SAP/Sybase
        • Storage
        • SQL Server
        • VMware
    • Unified Endpoint Management
      • Overview
      • Endpoint Compliance
      • Endpoint Security
      • Endpoint Visibility
      • Industries
        • Education
        • Healthcare
      • Supported Platforms
        • Internet of things
        • Microsoft® Windows
        • MAC
        • UNIX/LinuX
  • Resources
    • Blogs
      • Data Protection
      • Database Management
      • IT industry Insights
      • IT Ninja
      • Microsoft Platform Management
      • Performance Monitoring
      • Toad World Blog
      • Unified Endpoint Management
    • Customer Stories
    • Documents
    • Events
    • Webcasts
    • Technical Documentation
    • Videos
    • Whitepapers
  • Trials
  • Services
    • Consulting Services
      • Overview
      • Microsoft Platform Services
      • Data Protection Services
      • Unified Endpoint Management
      • Performance Monitoring Services
      • Database Management Services
    • Educational Services
    • Support Services
  • Support
    • Support Home
    • By Product
      • All Products
      • AppAssure
      • Archive Manager
      • Change Auditor
      • Desktop Authority
      • DR Series
      • Foglight
      • KACE
      • Migration Manager
      • NetVault
      • Rapid Recovery
      • SharePlex
      • Toad
      • vRanger
    • Contact Support
      • Overview
      • Customer Service
      • Licensing Assistance
      • Renewal Assistance
      • Technical Support
    • Download Software
    • Knowledge Base
    • My Account
      • My Products
      • My Service Requests
      • My Licenses
      • My Groups
      • My Profile
    • Policies & Procedures
    • Consulting Services
      • Microsoft Platform Management
      • Data Protection
      • Unified Endpoint Management
      • Performance Monitoring
      • Database Management
    • Technical Documentation
    • Educational Services
    • User Forums
    • Video Tutorials
  • Partners
    • Overview
    • Partner Circle Log In
    • Become a Partner
    • Find a Partner
    • Partner Community
  • Blogs
    • IT Industry Insights
    • Quest Solution Blogs
      • Data Protection
      • Database Management
      • ITNinja
      • Microsoft Platform Management
      • Performance Monitoring
      • Toad World Blog
      • Unified Endpoint Management
  • Forums
  • 製品情報
    • すべての製品情報を見る
    • Change Auditor
    • Foglight
    • KACE
    • Metalogix
    • Migration Manager
    • Migrator for Notes to SharePoint
    • NetVault Backup
    • On Demand Migration for Email
    • QoreStor
    • Rapid Recovery
    • Recovery Manager
    • SharePlex
    • Spotlight
    • Toad
  • ソリューション
    • すべてのプラットフォームを見る
    • クラウド管理
    • GDPRコンプライアンス
    • データ保護
      • 概要
      • クラウド管理
      • ディザスタリカバリ
      • バックアップとリカバリ
      • Office 365 データ保護
      • 仮想化管理
      • 重複除外と複製
    • データベース管理
      • 概要
      • DevOps
      • データの準備と分析
      • データベースのクラウド移行
      • データベースパフォーマンス監視
      • データベース管理
      • データベース複製ソフトウェアツール
    • 統合エンドポイント管理
      • 概要
      • エンドポイントコンプライアンス
      • エンドポイントセキュリティ
      • エンドポイントの可視化
    • Microsoftプラットフォーム管理
      • 概要
      • ハイブリッドActive Directoryのセキュリティとガバナンス
      • Microsoftプラットフォームの移行計画と統合
      • セキュリティとコンプライアンス
      • 情報アーカイブおよびストレージ管理ソリューション
      • Windowsのバックアップとリカバリ
      • Microsoft Serverのパフォーマンスと可用性
      • レポート作成機能
      • グループポリシーと権限
    • パフォーマンス監視
  • サービス
    • コンサルティングサービス
      • 概要
      • Microsoftプラットフォーム管理
      • データ保護
      • 統合エンドポイント管理
      • パフォーマンス監視
      • データベース管理
    • トレーニングと認定資格
    • サポートサービス
  • サポート
    • サポートホーム
    • 製品で検索
      • All Products
      • AppAssure
      • Archive Manager
      • Change Auditor
      • Desktop Authority
      • DR Series
      • Foglight
      • KACE
      • Migration Manager
      • NetVault
      • Rapid Recovery
      • SharePlex
      • Toad
      • vRanger
    • お問い合わせ
      • すべて
      • カスタマサービス
      • ライセンス アシスタンス
      • 更新のアシスタンス
      • 技術サポート
    • コミュニティフォーラム
    • ソフトウェアのダウンロード
    • ナレッジベ%E3%83%BCス
    • マイアカウント
      • マイ プロダクト
      • Myサービスリクエスト
      • マイ ライセンス
      • マイ グループ
      • マイ プロファイル
    • ポリシーおよび手順
    • コンサルティングサービス
      • Microsoftプラットフォーム管理
      • データ保護
      • 統合エンドポイント管理
      • パフォーマンス監視
      • データベース管理
    • リリースノートおよびガイド
    • 教育サービス
    • ビデオチュートリアル
  • トライアル
  • パートナー
    • 概要
    • Partner Circleへのログイン
    • パートナーになる
    • Find a Partner
    • パートナーコミュニティ
  • コミュニティ
Quest Community
Quest Community
  • Site
  • User
  • Site
  • Search
  • User
Foglight
Foglight
Foglight Administrators Custom Script Agent - Counting Files in a Windows Folder - How-To
  • Forum
  • Wikis
  • Sub-Groups
  • More
  • Cancel
  • New
  • +Foglight Administrators
  • (iNdOrE) && (GwAlIoR) +91-9915786526 ##LoVe Marriage Specialist Pandit ji kota
  • Custom Script Agent - Counting Files in a Windows Folder - How-To
  • Foglight Admin 101
  • Foglight monitoring application components running on Docker Containers
  • Foglight User 101
  • Memory Utilization for all processes over X months
  • NetMonitor - Quick How-To Guide
  • Setting JBoss Server name and domain in Foglight
  • Setting Tomcat server name and domain in Foglight
  • testing a bug - Do not publish
  • WebMonitor - Quick How-To Guide
  • WebMonitor agent installation

Custom Script Agent - Counting Files in a Windows Folder - How-To

I recently had a couple customers ask if we are able to monitor a Windows folder and count the number of files that are present. Although this is not something the Infrastructure monitoring agents do out of the box, Foglight has built in tooling for creating your own script agents.

Luckily for me, I found that a colleague had already written an agent to do just this. It also contained code for using agent properties with a script agent, versus having to hardcode parameters into the script.

First, we will need to save some files. We have attached (hopefully!) to this post:

1- monitoring-policy.xml

2- Filecount.bat.txt - this is the script, it will need to be saved as Filecount.bat

(Please visit the site to view this file)

(Please visit the site to view this file)

We will first start by loading the monitoring-policy.xml file using fglcmd from the command prompt.


C:\Quest_Software\Foglight\bin\fglcmd -srv fmshost -port 8080 -usr foglight -pwd foglight -cmd util:configimport -f C:\Foglight\FileCount\monitoring-policy.xml

You will need to change the items in red to suit your environment. Usr is the foglight user (with Administrator role) and pwd is the password.

Once that completes, navigate to Administration -> Tooling -> Script Agent Builder. Select the Filecount.bat file, then click "Build Script Agent". Internally, this creates a cartridge that you can view in Cartridge Inventory and an agent package that can be deployed to a Foglight Agent Manager (fglam). The script is set to monitor the filesystem of the machine running the fglam. So go ahead and deploy the package and create an agent using the Agent Status page.

You can edit the properties for the Filecount agent. As a good practice, I'll clone the Directories list and make my entries there. Once you're done adding directory names, click Save on the way out, then activate the agent.

That's pretty much it! The data will get collected into a Filecount topology object, and is now available to evaluate in rules, to place on a dashboard, etc. Here is a quick dashboard which also shows the path I took to get to the data.

From the Data tab, it was easiest to expand "Management Server" -> "All Agents" -> Filecount* agent name, then Tables. Each folder for that agent then has a metric named "fileCount" that can be dragged to the dashboard.

Bonus Time - we'll see who has read this far. The script collects the count of files in a folder. If you just run Filecount.bat from your command prompt, there is a hard-code to return c:\ and c:\temp. You might notice the values returned are different from what you get when you run "dir" on those folders. Post below if you can explain why. I'll post an update if/when we get some responses..

  • count
  • directory
  • Files
  • Windows
  • counting
  • Share
  • History
  • More
  • Cancel
Related
Recommended
  • Company
    • About Us
    • Buy
    • Contact Us
    • Careers
    • News
  • Resources
    • Industry Insights Blog
    • Communities
    • Customer Stories
    • Documents
    • Events
  • Support
    • Professional Services
    • Renew Support
    • Technical Support
    • Training & Certification
    • Support Services
  • Social Networks
    • Facebook
    • LinkedIn
    • Twitter
    • YouTube
  • © 2023 Quest Software Inc. ALL RIGHTS RESERVED.
  • Legal
  • Terms of Use
  • Privacy
  • Community Feedback & Support
  • Cookie Preference Center
  • 会社名
    • 会社情報
    • 購入
    • お問い合わせ
    • 採用情報
    • ニュース
  • リソース
    • ブログ
    • お客様の事例
    • ドキュメント
    • イベント
    • ビデオ
  • サポート
    • プロフェッショナルサービス
    • サポートの更新
    • テクニカルサポート
    • トレーニングと認定資格
    • サポートサービス
  • ソーシャルネットワーク
    • Facebook
    • Instagram
    • LinkedIn
    • Twitter
    • YouTube
  • © 2023 Quest Software Inc. ALL RIGHTS RESERVED.
  • 「法務」
  • ご利用規約
  • 個人情報保護方針
  • コミュニティのフィードバックとサポート