{"id":19585912,"url":"https://github.com/cacti/plugin_npc","last_synced_at":"2025-06-29T22:40:17.968Z","repository":{"id":37257574,"uuid":"166364814","full_name":"Cacti/plugin_npc","owner":"Cacti","description":"Nagios Plugin for Cacti is a complete UI replacement for Nagios fully integrated into Cacti.","archived":false,"fork":false,"pushed_at":"2024-10-17T16:22:52.000Z","size":3974,"stargazers_count":4,"open_issues_count":4,"forks_count":3,"subscribers_count":12,"default_branch":"develop","last_synced_at":"2024-10-20T00:09:14.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cacti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-18T07:40:49.000Z","updated_at":"2024-10-17T16:22:57.000Z","dependencies_parsed_at":"2024-06-08T14:25:14.628Z","dependency_job_id":null,"html_url":"https://github.com/Cacti/plugin_npc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cacti%2Fplugin_npc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cacti%2Fplugin_npc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cacti%2Fplugin_npc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cacti%2Fplugin_npc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cacti","download_url":"https://codeload.github.com/Cacti/plugin_npc/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224069493,"owners_count":17250456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T07:57:46.123Z","updated_at":"2025-06-29T22:40:17.957Z","avatar_url":"https://github.com/Cacti.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NPC Quick Start Guide\n\nNPC is designed to be a complete web based UI replacement to Nagios while fully\nintegrating into Cacti using the Cacti Plugin Architecture. This integration\nwill provide a single point of access for trending and alert monitoring.\n\n**IMPORTANT NOTE:** Since this is a fresh port of a 10 year old Cacti plugin,\nyou should be using it in a non-production setup until further migration testing\nhas been performed by the Cacti community.\n\n## Features\n\n1) A complete Nagios UI replacement integrated into Cacti.\n\n2) A feature rich user interface developed on ExtJS.\n\n3) A central location to monitor trending and alerting.\n\n4) All NPC data is updated asynchronously via JSON (no reloading web pages).\n\n5) Automated importing/syncing of hosts from Nagios to Cacti (N2C).\n\n6) The UI can be customized on a per user basis.\n\n## Usage\n\nWith the exception of some installation notes documentation is very slim. Watch\nthe forums and the NPC GitHub for additional info. Here are a few tips to get\nyou started:\n\n* Most lists including services or hosts can be double clicked to open\n  additional detail screens.\n\n* Most lists including services or hosts can be right clicked to popup a context\n  menu used to issue service or host commands.\n\n* If a graph is mapped to a service or host, a graph icon will be displayed in\n  the hosts and services screens.  A single left click of this icon will popup\n  the graph.\n\n* Most green check marks (started/enabled) or most red X (stopped/disabled) can\n  be double clicked to toggle the option (requires that remote commands are\n  enabled.)\n\n* Most grid columns can be re-ordered via drag and drop.\n\n* Most grid columns can be hidden and currently hidden columns can be viewed by\n  clicking a down arrow to the right of the column heading.\n\n* Dashboard portlets can be closed or minimized. Closed portlets can be made\n  visible again by clicking the Portlets button on the far right of the toolbar\n  on the Dashboard tab and then select which portlets you want displayed.\n\n* All changes to the interface (portlets, column order, etc.) are saved server\n  side on a per user basis.  Customize the UI your way and it is available\n  anywhere you login.\n\n* Importing Nagios hosts is done from the N2C link on the left side tree menu.\n  Before starting an import you need to click in the template field to the right\n  of the hostgroup you are importing. Doing so will expose a select box for\n  assigning a host template.  Presently, this may be broken in Cacti 1.x due to\n  it's redesigned tree architecture.\n\n**IMPORTANT NOTE:** Since this is a fresh port of a 10 year old Cacti plugin,\nyou should be using it in a non-production setup until further migration testing\nhas been performed by the Cacti community.\n\n## Installation\n\nThe remainder of the document provides the steps that are required to install\nand configure the NPC Plugin for Cacti.\n\n## Requirements\n\nBelow are the minimum requirements:\n\n- Cacti 1.2.1\n- NDOUtils 1.4b7\n- Nagios 3.x\n\nThe NPC Plugin, first written for Cacti 0.8.7, has been updated to work with\nCacti 1.2.x.  However, testing has been very light.  We will need feedback from\nusers as to its usability with this Cacti version.\n\nIt is anticipated that there will be many changes forthcoming as we review the\narchitecture and the ExtJS framework to see how it co-exists with the Cacti\nFramework.  So far so good.\n\nThe default memory limit for PHP probably will not be enough to run NPC. Edit\n/etc/php.ini and update the memory_limit option if you find times when NPC is\ncausing Cacti to run out of memory.\n\n**IMPORTANT NOTE:** Since this is a fresh port of a 10 year old Cacti plugin,\nyou should be using it in a non-production setup until further migration testing\nhas been performed by the Cacti community.\n\n## Installing NPC\n\nGrab the latest version of NPC from GitHub using the following steps:\n\n1. `cd \u003cpath_to_cacti\u003e/plugins`\n\n2. `git clone https://github.com/Cacti/plugin_npc.git npc`\n\n3. Ensure permissions are set for the apache user to read\n\n4. login to Cacti as an admin.\n\n5. Install the NPC Plugin\n\n   1. Go to Console \u003e Configuration \u003e Plugins\n\n   2. Click the Install link to the left of the 'Npc' plugin line\n\n   3. Next, click 'Enable' link to the left of the 'Npc' plugin line\n\n6. You can find the NPC plugin options under Console \u003e Configuration \u003e Settings\n   section\n\nWithout NDO2DB feeding Nagios data into NPC the dashboard (and other screens)\nwill be empty.\n\nNext, there are a few NPC settings to add/update. Goto Console \u003e Configuration \u003e\nSettings \u003e NPC.\n\n* **Remote Commands** - Check the checkbox to enable remote commands. At the\n  moment this is system wide so all users that can access NPC will be able to\n  execute commands.\n\n* **Nagios Command File Path** - Add the path to the Nagios command file. It\n  will be something like /usr/local/nagios/var/rw/nagios.cmd\n\n* **Nagios URL** - The URL to the Nagios web interface is used to get access to\n  the status map and reporting CGI's. You can also access the Nagios UI by\n  clicking the \"Nagios\" link in the left hand \"Navigation\" pane in NPC.\n\n* Set the date and time format to your liking.\n\n## Configuring Nagios\n\nRefer to the Nagios documentation for installation. Some parts of NPC like\nreporting and the status map use the Nagios interface by wrapping the Nagios\nCGI's in an Iframe. Be sure to have the Nagios web UI working if you want to use\nthe reporting and status map features.\n\nThe following parameters are found in the Nagios configuration file nagios.cfg\n\nThe power of NPC is greatly enhanced by the ability to issue commands to the\nNagios process. To enable external commands in Nagios set:\n\n```console\ncheck_external_commands=1\n```\n\nCheck external commands as often as possible.\n\n```console\ncommand_check_interval=-1\n```\n\nBroker all events.\n\n```console\nevent_broker_options=-1\n```\n\nThe path to the event broker module and config file which you will install next.\nThis example assumes Nagios is installed in /usr/local/nagios. Adjust the path\nto suit your installation.\n\n```console\nbroker_module=/usr/local/nagios/bin/ndomod.o\nconfig_file=/usr/local/nagios/etc/ndomod.cfg\n```\n\nIf you want to use performance data from Nagios plugins to create graphs in\nCacti then set the following parameter.\n\n```console\nprocess_performance_data=1\n```\n\nSetting `host_perfdata_command` and `service_perfdata_command` is not necessary.\nThe performance data will be written to the NPC database where it can be polled\nby cacti using the `perfdata.php` script included with NPC.\n\n## Installing/Configuring NDO2DB\n\nNOD2DB is part of the NDOUTILS package. Nagios hands events off to NDO2DB via\nthe event broker. NDO2DB handles the actual inserts of Nagios data into the NPC\ntables.\n\nInstructions for compiling, installing, and configuring NDO2DB are included in\nthe README file of the ndoutils package. The README has four sections. Skip the\nsection on initializing the database.\n\n1. Follow the 'COMPILING INSTRUCTIONS' section of the README.\n\n2. Skip the 'INITIALIZING THE SQL DATABASE' section of the README\n\n3. Follow the 'INSTALLING THE NDOMOD BROKER MODULE' section of the README\n\n4. Follow the 'INSTALLING THE NDO2DB DAEMON' section of the README\n\nEdit `/usr/local/nagios/etc/ndo2db.cfg` and add/update the following parameters:\n\n```console\ndb_servertype=mysql\ndb_host=localhost (the host/ip where cacti database is running)\ndb_port=3306\ndb_name=cacti (Your cacti database name)\ndb_prefix=npc_\ndb_user=\u003cuser\u003e (Your cacti database user)\ndb_pass=\u003cpass\u003e (Your cacti user password)\n```\n\nThe user/pass you assign needs select, insert, update, delete on all the npc_\ntables.\n\nndo2db can communicates with the Nagios ndo2db.o module via unix socket or TCP.\nUse whatever works for you (I use the TCP mode) but you need to set it the same\nin both the ndo2db.cfg and ndomod.cfg.\n\n**NOTE:** The config_output_options parameter in ndomod.cfg must be set to 2\n(config_output_options=2).\n\nHere are working ndo2db.cfg and ndomod.cfg configs. As noted above the database\nparameters need to be changed for your database.\n\n### ndo2db.cfg\n\n```console\nndo2db_user=nagios\nndo2db_group=nagios\nsocket_type=tcp\nsocket_name=/usr/local/nagios/var/ndo.sock\ntcp_port=5668\ndb_servertype=mysql\ndb_host=localhost\ndb_port=3306\ndb_name=DATABASE_NAME\ndb_user=DATABASE_USER\ndb_pass=DATABASE_PASSWORD\ndb_prefix=npc_\nmax_timedevents_age=1440\nmax_systemcommands_age=10080\nmax_servicechecks_age=10080\nmax_hostchecks_age=10080\nmax_eventhandlers_age=44640\ndebug_level=1\ndebug_verbosity=1\ndebug_file=/usr/local/nagios/var/ndo2db.debug\nmax_debug_file_size=1000000\n```\n\n### ndomod.cfg\n\n```console\ninstance_name=default\noutput_type=tcpsocket\noutput=127.0.0.1\ntcp_port=5668\noutput_buffer_items=5000\nbuffer_file=/usr/local/nagios/var/ndomod.tmp\nfile_rotation_interval=14400\nfile_rotation_timeout=60\nreconnect_interval=15\nreconnect_warning_interval=15\ndata_processing_options=-1\nconfig_output_options=2\n```\n\n**NOTE:** There have been reports of the ndo2db process dying (regularly) on old\nversions of ndo2db. To get this, setup the process to respawn via init or\nsystemd. If you have trouble with the daemon dying you can add the following\nline to /etc/inittab. Only do this if ndo2db frequently dies unexpectedly on\nyou.\n\n```console\nndo:345:respawn:/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg\n```\n\nAfter editing inittab issue the following command:\n\n```shell\ntelinit Q\n```\n\nYou may see messages like the following in your syslog when using init to\nrespawn ndo2db:\n\n```console\nApr 19 11:11:55 acid init: Id \"ndo\" respawning too fast: disabled for 5 minutes\n```\n\nBesides muddying the logs there is no harm and so far this is the only way I\nhave been able to keep ndo2db running.\n\n## Bugs and Feature Enhancements\n\nBug and feature enhancements for the npc plugin are handled in GitHub. If you\nfind a first search the Cacti forums for a solution before creating an issue in\nGitHub.\n\n## Changelog\n\n--- develop ---\n\n* issue#13: Nagios sync partially to NPC plugin - only can see update of\n  hostgroup\n\n\n--- 3.1 ---\n\n* issue: Adding some missing columns to a few tables\n\n* issue: Undefined variables in controllers settings.php\n\n\n--- 3.0 ---\n\n* feature: compatibility improvements for cacti 1.2.x\n\n-----------------------------------------------\nCopyright (c) 2004-2025 - The Cacti Group, Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcacti%2Fplugin_npc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcacti%2Fplugin_npc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcacti%2Fplugin_npc/lists"}